Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
InlineCode.cs
2using System.Threading.Tasks;
6
8{
13 {
14 private readonly string code;
15
22 : base(Document)
23 {
24 if (Code.StartsWith(" "))
25 Code = Code.Substring(1);
26
27 if (Code.EndsWith(" "))
28 Code = Code.Substring(0, Code.Length - 1);
29
30 this.code = Code;
31 }
32
36 public string Code => this.code;
37
42 public override Task Render(IRenderer Output) => Output.Render(this);
43
47 public override bool InlineSpanElement => true;
48
54 public override bool Equals(object obj)
55 {
56 return obj is InlineCode x &&
57 this.code == x.code &&
58 base.Equals(obj);
59 }
60
65 public override int GetHashCode()
66 {
67 int h1 = base.GetHashCode();
68 int h2 = this.code?.GetHashCode() ?? 0;
69
70 h1 = ((h1 << 5) + h1) ^ h2;
71
72 return h1;
73 }
74
79 public IEnumerable<Atom> Atomize()
80 {
82
83 foreach (char ch in this.code)
84 Result.Add(new InlineCodeCharacter(this.Document, this, ch));
85
86 return Result;
87 }
88
96 {
97 return new InlineCode(Document, Text);
98 }
99
104 public override void IncrementStatistics(MarkdownStatistics Statistics)
105 {
106 Statistics.NrInlineCode++;
107 }
108
109 }
110}
Contains a markdown document. This markdown document class supports original markdown,...
Contains some basic statistical information about a Markdown document.
Abstract base class for all markdown elements.
MarkdownDocument Document
Markdown document.
override void IncrementStatistics(MarkdownStatistics Statistics)
Increments the property or properties in Statistics corresponding to the element.
Definition: InlineCode.cs:104
IEnumerable< Atom > Atomize()
Return an enumeration of the editable code as atoms.
Definition: InlineCode.cs:79
override bool InlineSpanElement
If the element is an inline span element.
Definition: InlineCode.cs:47
InlineCode(MarkdownDocument Document, string Code)
Inline source code.
Definition: InlineCode.cs:21
override Task Render(IRenderer Output)
Renders the element.
override bool Equals(object obj)
Determines whether the specified object is equal to the current object.
Definition: InlineCode.cs:54
override int GetHashCode()
Serves as the default hash function.
Definition: InlineCode.cs:65
MarkdownElement Assemble(MarkdownDocument Document, string Text)
Assembles a markdown element from a sequence of atoms.
Definition: InlineCode.cs:95
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
Interface for elements containing editable text.
Interface for Markdown renderers.
Definition: IRenderer.cs:12