Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
InlineCode.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
5
7{
12 {
13 private readonly string code;
14
21 : base(Document)
22 {
23 if (Code.StartsWith(" "))
24 Code = Code.Substring(1);
25
26 if (Code.EndsWith(" "))
27 Code = Code.Substring(0, Code.Length - 1);
28
29 this.code = Code;
30 }
31
35 public string Code => this.code;
36
41 public override Task Render(IRenderer Output) => Output.Render(this);
42
46 public override bool InlineSpanElement => true;
47
53 public override bool Equals(object obj)
54 {
55 return obj is InlineCode x &&
56 this.code == x.code &&
57 base.Equals(obj);
58 }
59
64 public override int GetHashCode()
65 {
66 int h1 = base.GetHashCode();
67 int h2 = this.code?.GetHashCode() ?? 0;
68
69 h1 = ((h1 << 5) + h1) ^ h2;
70
71 return h1;
72 }
73
78 public IEnumerable<Atom> Atomize()
79 {
80 LinkedList<Atom> Result = new LinkedList<Atom>();
81
82 foreach (char ch in this.code)
83 Result.AddLast(new InlineCodeCharacter(this.Document, this, ch));
84
85 return Result;
86 }
87
95 {
96 return new InlineCode(Document, Text);
97 }
98
103 public override void IncrementStatistics(MarkdownStatistics Statistics)
104 {
105 Statistics.NrInlineCode++;
106 }
107
108 }
109}
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:103
IEnumerable< Atom > Atomize()
Return an enumeration of the editable code as atoms.
Definition: InlineCode.cs:78
override bool InlineSpanElement
If the element is an inline span element.
Definition: InlineCode.cs:46
InlineCode(MarkdownDocument Document, string Code)
Inline source code.
Definition: InlineCode.cs:20
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:53
override int GetHashCode()
Serves as the default hash function.
Definition: InlineCode.cs:64
MarkdownElement Assemble(MarkdownDocument Document, string Text)
Assembles a markdown element from a sequence of atoms.
Definition: InlineCode.cs:94
Interface for elements containing editable text.
Interface for Markdown renderers.
Definition: IRenderer.cs:12