Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
LinkReference.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
4
6{
11 {
12 private readonly string label;
13
20 public LinkReference(MarkdownDocument Document, IEnumerable<MarkdownElement> ChildElements, string Label)
21 : base(Document, ChildElements)
22 {
23 this.label = Label;
24 }
25
29 public string Label => this.label;
30
35 public override Task Render(IRenderer Output) => Output.Render(this);
36
38 public override string ToString()
39 {
40 return this.label;
41 }
42
46 public override bool InlineSpanElement => true;
47
55 public override MarkdownElementChildren Create(IEnumerable<MarkdownElement> Children, MarkdownDocument Document)
56 {
57 return new LinkReference(Document, Children, this.label);
58 }
59
66 public override bool SameMetaData(MarkdownElement E)
67 {
68 return E is LinkReference x &&
69 x.label == this.label &&
70 base.SameMetaData(E);
71 }
72
78 public override bool Equals(object obj)
79 {
80 return obj is LinkReference x &&
81 this.label == x.label &&
82 base.Equals(obj);
83 }
84
89 public override int GetHashCode()
90 {
91 int h1 = base.GetHashCode();
92 int h2 = this.label?.GetHashCode() ?? 0;
93
94 h1 = ((h1 << 5) + h1) ^ h2;
95
96 return h1;
97 }
98
103 public override void IncrementStatistics(MarkdownStatistics Statistics)
104 {
105 Multimedia Multimedia = this.Document.GetReference(this.label);
106
107 if (!(Multimedia is null))
108 {
109 if (Statistics.IntUrlHyperlinks is null)
110 Statistics.IntUrlHyperlinks = new List<string>();
111
112 string Url = Multimedia.Items[0].Url;
113
114 if (!Statistics.IntUrlHyperlinks.Contains(Url))
115 Statistics.IntUrlHyperlinks.Add(Url);
116 }
117
118 Statistics.NrHyperLinks++;
119 Statistics.NrUrlHyperLinks++;
120 }
121
122 }
123}
Contains a markdown document. This markdown document class supports original markdown,...
Multimedia GetReference(string Label)
Gets the multimedia information referenced by a label.
Contains some basic statistical information about a Markdown document.
int NrUrlHyperLinks
Number of URL hyperlinks.
int NrHyperLinks
Number of hyperlinks (total).
Abstract base class for all markdown elements with a variable number of child elements.
override IEnumerable< MarkdownElement > Children
Any children of the element.
Abstract base class for all markdown elements.
MarkdownDocument Document
Markdown document.
MultimediaItem[] Items
Multimedia items.
Definition: Multimedia.cs:40
Interface for Markdown renderers.
Definition: IRenderer.cs:12