예제 #1
0
        public override LinkedList<IWikiElement> Parse(ParsingContext parsingContext, ElementContent containerContent)
        {
            var elements = new LinkedList<IWikiElement>();

            foreach (Match match in _linkExpression.Matches(containerContent.ToString()))
            {
                var elementContent = new ElementContent(containerContent, match);
                var innerContent = new ElementContent(containerContent, match.Groups["content"]);

                string originalAddress, normalizedAddress;

                if (match.Groups["url"].Success)
                {
                    originalAddress = match.Groups["url"].Value;
                    normalizedAddress = FormatUrl(originalAddress);
                }
                else if (match.Groups["email"].Success)
                {
                    originalAddress = match.Groups["email"].Value;
                    normalizedAddress = FormatEmail(originalAddress);
                }
                else
                    continue;

                string text = match.Groups["text"].Success ? match.Groups["text"].Value : originalAddress;
                bool noFollow = match.Groups["nofollow"].Success;

                var element = new LinkElement(parsingContext, elementContent, innerContent, normalizedAddress, text, noFollow);

                elements.AddLast(element);
            }

            return elements;
        }
예제 #2
0
        public override LinkedList<IWikiElement> Parse(ParsingContext parsingContext, ElementContent containerContent)
        {
            var elements = new LinkedList<IWikiElement>();

            foreach (Match match in _listItemExpression.Matches(containerContent.ToString()))
            {
                var elementContent = new ElementContent(containerContent, match);
                var innerContent = new ElementContent(containerContent, match.Groups["content"]);

                var listItem = new ListItemElement(parsingContext, elementContent, innerContent);

                elements.AddLast(listItem);
            }

            return elements;
        }
예제 #3
0
        public override LinkedList<IWikiElement> Parse(ParsingContext parsingContext, ElementContent containerContent)
        {
            if (!parsingContext.SkipLinesEnabled)
                return new LinkedList<IWikiElement>();
            
            var elements = new LinkedList<IWikiElement>();

            foreach (Match match in _skipExpression.Matches(containerContent.ToString()))
            {
                var elementContent = new ElementContent(containerContent, match);

                elements.AddLast(new SkipElement(parsingContext, elementContent));
            }

            return elements;
        }
예제 #4
0
        public override LinkedList<IWikiElement> Parse(ParsingContext parsingContext, ElementContent containerContent)
        {
            var elements = new LinkedList<IWikiElement>();

            foreach (Match match in _formattingExpression.Matches(containerContent.ToString()))
            {
                var elementContent = new ElementContent(containerContent, match);
                var innerContent = new ElementContent(containerContent, match.Groups["content"]);

                var formatting = GetFormatting(match.Groups["symbol"].Value);

                var element = new FormattingElement(parsingContext, elementContent, innerContent, formatting);

                elements.AddLast(element);
            }

            return elements;
        }