/// <inheritdoc /> protected override string GetContentPlainText(NodePlainTextOptions options) { if ((options & NodePlainTextOptions.RemoveRefTags) == NodePlainTextOptions.RemoveRefTags && string.Equals(Name, "ref", StringComparison.OrdinalIgnoreCase)) { return(null); } return(Content); }
/// <inheritdoc /> public override string ToPlainText(NodePlainTextOptions options) { if (!Brackets) { return(Target.ToPlainText(options)); } var text = Text?.ToPlainText(options); // We should have shown something like [1] if (string.IsNullOrWhiteSpace(text)) { return("[#]"); } return(text); }
/// <inheritdoc /> public override string ToPlainText(NodePlainTextOptions options) { if (Text != null) { if (Text.Inlines.Count == 0) { // Pipe trick. E.g. // [[abc (disambiguation)|]] var original = Target.ToPlainText(options); var match = PipeTrickTitleMatcher.Match(original); if (match.Success) { return(match.Value); } return(original); } else { return(Text.ToPlainText(options)); } } return(Target.ToPlainText(options)); }
public override string ToPlainText(NodePlainTextOptions options) { var sb = new StringBuilder(); if (Caption != null) { sb.AppendLine(_Caption.ToPlainText(options)); } var firstRow = true; foreach (var r in Rows) { if (firstRow) { firstRow = false; } else { sb.AppendLine(); } sb.Append(r.ToPlainText(options)); } return(sb.ToString()); }
/// <summary> /// Gets the plain text without the unprintable nodes (e.g. comments, templates). /// </summary> public abstract string ToPlainText(NodePlainTextOptions options);
/// <inheritdoc /> protected override string GetContentPlainText(NodePlainTextOptions options) => Content?.ToPlainText(options);
/// <inheritdoc /> public override string ToPlainText(NodePlainTextOptions options) { return(GetContentPlainText(options)); }
/// <summary> /// Gets the content inside the tags as plain text without the unprintable nodes /// (e.g. comments, templates). /// </summary> protected abstract string GetContentPlainText(NodePlainTextOptions options);
/// <inheritdoc /> public override string ToPlainText(NodePlainTextOptions options) { return(null); }
/// <inheritdoc /> public override string ToPlainText(NodePlainTextOptions options) { // Unescape HTML entities. return(WebUtility.HtmlDecode(Content)); }
/// <summary> /// Infrastructure. This function will always throw a <seealso cref="NotSupportedException"/>. /// </summary> public override string ToPlainText(NodePlainTextOptions options) { throw new NotSupportedException(); }
/// <inheritdoc /> public override string ToPlainText(NodePlainTextOptions options) => null;
public override string ToPlainText(NodePlainTextOptions options) { return(string.Join("\t", Cells.Select(c => c.ToPlainText(options)))); }
/// <inheritdoc /> public override string ToPlainText(NodePlainTextOptions options) { return(string.Join("\n", Lines.Select(l => l.ToPlainText(options)))); }
public override string ToPlainText(NodePlainTextOptions options) { return(string.Join(null, Inlines.Select(i => i.ToPlainText(options))).Trim()); }