public ElementContent ContentAfter(ElementContent innerContent) { int last = Position + Length; int innerLast = innerContent.Position + innerContent.Length; return new ElementContent(Text, innerLast, last - innerLast); }
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; }
public ElementContent(ElementContent content, int relativePosition, int length) { if (relativePosition + length > content.Length) throw new ArgumentOutOfRangeException("length", length, "Invalid content length."); _text = content.Text; _position = content.Position + relativePosition; _length = length; }
protected ContainerElementBase(ParsingContext parsingContext, ElementContent elementContent, ElementContent innerContent) : base(parsingContext, elementContent) { InnerElements = new LinkedList<IWikiElement>(); InnerContentChunks = new LinkedList<ElementContent>(); if (innerContent.Length > 0) InnerContentChunks.AddFirst(innerContent); }
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; }
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; }
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; }
public ElementContent ContentBefore(ElementContent innerContent) { return new ElementContent(Text, Position, innerContent.Position - Position); }
public ElementContent(ElementContent content, Capture capture) : this(content, capture.Index, capture.Length) { }
public FormattedTextElement(ParsingContext parsingContext, ElementContent elementContent) : base(parsingContext, elementContent, elementContent) { }
public abstract LinkedList<IWikiElement> Parse(ParsingContext parsingContext, ElementContent containerContent);
public ContentElementBase(ParsingContext parsingContext, ElementContent elementContent, IWikiElement innerElement) : base(parsingContext, elementContent) { InnerElement = innerElement; }
protected WikiElementBase(ParsingContext parsingContext, ElementContent elementContent) { ParsingContext = parsingContext; Content = elementContent; }
public FormattingElement(ParsingContext parsingContext, ElementContent elementContent, ElementContent innerContent, Formatting formatting) : base(parsingContext, elementContent, new FormattedTextElement(parsingContext, innerContent)) { _formatting = formatting; }
public ParagraphElement(ParsingContext parsingContext, ElementContent elementContent, ElementContent innerContent) : base(parsingContext, elementContent, new FormattedTextElement(parsingContext, innerContent)) { }
public ListElement(ParsingContext parsingContext, ElementContent elementContent, ListType listType) : base(parsingContext, elementContent, elementContent) { _listType = listType; }
public ListItemElement(ParsingContext parsingContext, ElementContent elementContent, ElementContent innerContent) : base(parsingContext, elementContent, new FormattedTextElement(parsingContext, innerContent)) { }
public HeaderElement(ParsingContext parsingContext, ElementContent elementContent, ElementContent innerContent, int level) : base(parsingContext, elementContent, new FormattedTextElement(parsingContext, innerContent)) { _level = level; }
public SkipElement(ParsingContext parsingContext, ElementContent elementContent) : base(parsingContext, elementContent) { }
public TextElement(ParsingContext parsingContext, ElementContent elementContent, bool disableTypography = false) : base(parsingContext, elementContent) { _disableTypography = disableTypography; }