private string _GetUrlFrom(TokenRange <CreoleTokenCode> tokens, CreoleRichTextElementNodeData richTextElementData) { var urlStartIndex = richTextElementData.UrlStartIndex; var urlEndIdnex = richTextElementData.UrlEndIndex; var urlRange = tokens.SubRange(urlStartIndex, (urlEndIdnex - urlStartIndex)); return(TokenRangeHelper.GetPlainText(urlRange)); }
private string _GetContentFrom(TokenRange <CreoleTokenCode> tokens, CreoleRichTextElementNodeData richTextElementData) { var contentStartIndex = richTextElementData.ContentStartIndex; var contentEndIdnex = richTextElementData.ContentEndIndex; var contentRange = tokens.SubRange(contentStartIndex, (contentEndIdnex - contentStartIndex)); return(TokenRangeHelper.GetPlainText(contentRange)); }
private IEnumerable <Element> _GetCreoleElements(TokenRange <CreoleTokenCode> tokens, int startIndex, int endIndex, IEnumerable <CreoleRichTextElementNodeData> nodesData) { var elements = new List <Element>(); var subRangeStartIndex = startIndex; foreach (var nodeData in nodesData) { if (subRangeStartIndex < nodeData.StartIndex) { elements.Add(new TextElement(TokenRangeHelper.GetPlainText(tokens.SubRange(subRangeStartIndex, (nodeData.StartIndex - subRangeStartIndex))))); } elements.Add(_GetCreoleElementFrom(tokens, nodeData)); subRangeStartIndex = nodeData.EndIndex; } if (subRangeStartIndex < endIndex) { var subRange = tokens.SubRange(subRangeStartIndex, (endIndex - subRangeStartIndex)); elements.Add(new TextElement(TokenRangeHelper.GetPlainText(subRange))); } return(elements); }
protected string GetPlainText(int startIndex, int endIndex) => TokenRangeHelper.GetPlainText(GetTokens(startIndex, endIndex));