示例#1
0
 /// <inheritdoc />
 protected override string GetContentPlainText(NodePlainTextOptions options)
 {
     if ((options & NodePlainTextOptions.RemoveRefTags) == NodePlainTextOptions.RemoveRefTags &&
         string.Equals(Name, "ref", StringComparison.OrdinalIgnoreCase))
     {
         return(null);
     }
     return(Content);
 }
示例#2
0
        /// <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);
        }
示例#3
0
 /// <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));
 }
示例#4
0
        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());
        }
示例#5
0
 /// <summary>
 /// Gets the plain text without the unprintable nodes (e.g. comments, templates).
 /// </summary>
 public abstract string ToPlainText(NodePlainTextOptions options);
示例#6
0
 /// <inheritdoc />
 protected override string GetContentPlainText(NodePlainTextOptions options) => Content?.ToPlainText(options);
示例#7
0
 /// <inheritdoc />
 public override string ToPlainText(NodePlainTextOptions options)
 {
     return(GetContentPlainText(options));
 }
示例#8
0
 /// <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);
示例#9
0
 /// <inheritdoc />
 public override string ToPlainText(NodePlainTextOptions options)
 {
     return(null);
 }
示例#10
0
 /// <inheritdoc />
 public override string ToPlainText(NodePlainTextOptions options)
 {
     // Unescape HTML entities.
     return(WebUtility.HtmlDecode(Content));
 }
示例#11
0
 /// <summary>
 /// Infrastructure. This function will always throw a <seealso cref="NotSupportedException"/>.
 /// </summary>
 public override string ToPlainText(NodePlainTextOptions options)
 {
     throw new NotSupportedException();
 }
示例#12
0
 /// <inheritdoc />
 public override string ToPlainText(NodePlainTextOptions options) => null;
示例#13
0
 public override string ToPlainText(NodePlainTextOptions options)
 {
     return(string.Join("\t", Cells.Select(c => c.ToPlainText(options))));
 }
示例#14
0
 /// <inheritdoc />
 public override string ToPlainText(NodePlainTextOptions options)
 {
     return(string.Join("\n", Lines.Select(l => l.ToPlainText(options))));
 }
示例#15
0
 public override string ToPlainText(NodePlainTextOptions options)
 {
     return(string.Join(null, Inlines.Select(i => i.ToPlainText(options))).Trim());
 }