Exemplo n.º 1
0
        private string RecoursionTagRender(IEnumerator <IMatch> entityIterator, string markdown)
        {
            var renderBuilder = new StringBuilder();

            while (!handler.NoPairTagDetected && entityIterator.MoveNext() && entityIterator.Current != null)
            {
                if (TrySaveSymbol(entityIterator.Current, renderBuilder))
                {
                    continue;
                }

                var tag = htmlWriter.PatternMatchAsTag(entityIterator.Current, markdown);

                if (handler.IsClosingTagFounded(tag, openedTagsStack))
                {
                    return(renderBuilder.ToString());
                }

                if (tag.Type == TagType.Opening)
                {
                    openedTagsStack.Push(tag);
                }

                var currentTagContent = RecoursionTagRender(entityIterator, markdown);
                var isCorrectTag      = TagAnalyser.CheckTagRules(tag, openedTagsStack, markdown);

                handler.UpdateSearchStatuses(tag, openedTagsStack);

                var renderedLine = HtmlWriter.RenderLine(tag, currentTagContent, handler.PairTagFounded, isCorrectTag);
                renderBuilder.Append(renderedLine);
            }
            handler.PairTagFounded = false;

            return(renderBuilder.ToString());
        }
Exemplo n.º 2
0
        public Tag PatternMatchAsTag(IMatch currentEntity, string markdown)
        {
            var tagMatch = (PatternMatch)currentEntity;

            return(GetTagEntity(tagMatch.PatternValue, tagMatch.Position,
                                TagAnalyser.GetTagType(tagMatch, markdown)));
        }