mirror of
https://github.com/xoofx/markdig.git
synced 2026-10-08 06:38:39 +00:00
Cleanup code, remove unused code
This commit is contained in:
@@ -33,7 +33,6 @@ namespace Textamina.Markdig.Parsers
|
||||
if (parsers == null) throw new ArgumentNullException(nameof(parsers));
|
||||
StringBuilders = stringBuilders;
|
||||
Document = document;
|
||||
InlinesToClose = new List<Inline>();
|
||||
Parsers = parsers;
|
||||
lineOffsets = new List<int>();
|
||||
Parsers.Initialize(this);
|
||||
@@ -95,11 +94,6 @@ namespace Textamina.Markdig.Parsers
|
||||
/// </summary>
|
||||
public TextWriter DebugLog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of inlines to close.
|
||||
/// </summary>
|
||||
private List<Inline> InlinesToClose { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Processes the inline of the specified <see cref="LeafBlock"/>.
|
||||
/// </summary>
|
||||
@@ -171,18 +165,6 @@ namespace Textamina.Markdig.Parsers
|
||||
// Get deepest container
|
||||
FindLastContainer().AppendChild(nextInline);
|
||||
}
|
||||
|
||||
if (nextInline.IsClosable && !nextInline.IsClosed)
|
||||
{
|
||||
var inlinesToClose = InlinesToClose;
|
||||
var last = inlinesToClose.Count > 0
|
||||
? InlinesToClose[inlinesToClose.Count - 1]
|
||||
: null;
|
||||
if (last != nextInline)
|
||||
{
|
||||
InlinesToClose.Add(nextInline);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -203,14 +185,7 @@ namespace Textamina.Markdig.Parsers
|
||||
}
|
||||
}
|
||||
|
||||
// Close all inlines not closed
|
||||
Inline = null;
|
||||
foreach (var inline in InlinesToClose)
|
||||
{
|
||||
inline.CloseInternal(this);
|
||||
}
|
||||
InlinesToClose.Clear();
|
||||
|
||||
if (DebugLog != null)
|
||||
{
|
||||
DebugLog.WriteLine("** Dump before Emphasis:");
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
/// <summary>
|
||||
/// An autolink (Section 6.7 CommonMark specs)
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.LeafInline" />
|
||||
[DebuggerDisplay("<{Url}>")]
|
||||
public class AutolinkInline : LeafInline
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a code span (Section 6.3 CommonMark specs)
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.LeafInline" />
|
||||
[DebuggerDisplay("`{Content}`")]
|
||||
public class CodeInline : LeafInline
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Textamina.Markdig.Parsers;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
@@ -10,6 +11,7 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
/// Internal delimiter used by some parsers (e.g emphasis, tables).
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.ContainerInline" />
|
||||
[DebuggerDisplay("{ToLiteral()} {Type}")]
|
||||
public abstract class DelimiterInline : ContainerInline
|
||||
{
|
||||
protected DelimiterInline(InlineParser parser)
|
||||
@@ -39,10 +41,5 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
/// </summary>
|
||||
/// <returns>The string representation of this delimiter</returns>
|
||||
public abstract string ToLiteral();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{ToLiteral()} {Type}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
/// <summary>
|
||||
/// An emphasis and strong emphasis (Section 6.4 CommonMark specs).
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.ContainerInline" />
|
||||
[DebuggerDisplay("{DelimiterChar} Strong: {Strong}")]
|
||||
public class EmphasisInline : ContainerInline
|
||||
{
|
||||
/// <summary>
|
||||
@@ -19,10 +22,5 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
/// Gets or sets a value indicating whether this <see cref="EmphasisInline"/> is strong.
|
||||
/// </summary>
|
||||
public bool Strong { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Strong ? $"{DelimiterChar}{DelimiterChar}" : $"{DelimiterChar}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
// Copyright (c) Alexandre Mutel. All rights reserved.
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
/// <summary>
|
||||
/// A hard line break (Section 6.9 CommonMark specs).
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.LeafInline" />
|
||||
[DebuggerDisplay("<br >/")]
|
||||
public class HardlineBreakInline : LineBreakInline
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return "<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
// Copyright (c) Alexandre Mutel. All rights reserved.
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
/// <summary>
|
||||
/// A Raw HTML (Section 6.8 CommonMark specs).
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.LeafInline" />
|
||||
[DebuggerDisplay("{Tag}")]
|
||||
public class HtmlInline : LeafInline
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -34,11 +34,6 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
/// </summary>
|
||||
public bool IsClosed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is closable.
|
||||
/// </summary>
|
||||
public bool IsClosable { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Inserts the specified inline after this instance.
|
||||
/// </summary>
|
||||
@@ -243,19 +238,6 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
}
|
||||
|
||||
internal void CloseInternal(InlineParserState state)
|
||||
{
|
||||
if (!IsClosed)
|
||||
{
|
||||
Close(state);
|
||||
IsClosed = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Close(InlineParserState state)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dumps this instance to <see cref="TextWriter"/>.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
// Copyright (c) Alexandre Mutel. All rights reserved.
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
/// <summary>
|
||||
/// A Link inline (Section 6.5 CommonMark specs)
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.ContainerInline" />
|
||||
[DebuggerDisplay("Url: {Url} Title: {Title} Image: {IsImage}")]
|
||||
public class LinkInline : ContainerInline
|
||||
{
|
||||
/// <summary>
|
||||
@@ -41,10 +45,5 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
/// Gets or sets a value indicating whether this instance is an image link.
|
||||
/// </summary>
|
||||
public bool IsImage { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return (IsImage ? "<img src=\"" : "<a href=\"") + Url + "\" title=\"" + Title + "\">";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Textamina.Markdig.Helpers;
|
||||
using Textamina.Markdig.Parsers;
|
||||
|
||||
@@ -11,6 +12,7 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
/// A literal inline.
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.LeafInline" />
|
||||
[DebuggerDisplay("{Content}")]
|
||||
public class LiteralInline : LeafInline
|
||||
{
|
||||
/// <summary>
|
||||
@@ -36,14 +38,5 @@ namespace Textamina.Markdig.Syntax.Inlines
|
||||
/// The content as a <see cref="StringSlice"/>.
|
||||
/// </summary>
|
||||
public StringSlice Content;
|
||||
|
||||
protected override void Close(InlineParserState state)
|
||||
{
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Content.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
// Copyright (c) Alexandre Mutel. All rights reserved.
|
||||
// This file is licensed under the BSD-Clause 2 license.
|
||||
// See the license.txt file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Textamina.Markdig.Syntax.Inlines
|
||||
{
|
||||
/// <summary>
|
||||
/// A soft line break (Section 6.10 CommonMark specs)
|
||||
/// </summary>
|
||||
/// <seealso cref="Textamina.Markdig.Syntax.Inlines.LineBreakInline" />
|
||||
[DebuggerDisplay("\\n")]
|
||||
public class SoftlineBreakInline : LineBreakInline
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return "\\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user