コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 protected string GetPlainText(int startIndex, int endIndex)
 => TokenRangeHelper.GetPlainText(GetTokens(startIndex, endIndex));