Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MetaReference.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
4using Waher.Script;
5
7{
12 {
13 private readonly string key;
14
21 : base(Document)
22 {
23 this.key = Key;
24 }
25
29 public string Key => this.key;
30
35 public override Task Render(IRenderer Output) => Output.Render(this);
36
42 public bool TryGetMetaData(out KeyValuePair<string, bool>[] Values)
43 {
44 if (this.Document?.TryGetMetaData(this.key, out Values) ?? false)
45 return true;
46
48 if (!(Variables is null) && Variables.TryGetVariable(this.key, out Variable Variable))
49 {
50 Values = new KeyValuePair<string, bool>[] { new KeyValuePair<string, bool>(Variable.ValueObject?.ToString() ?? string.Empty, false) };
51 return true;
52 }
53
54 Values = null;
55 return false;
56 }
57
59 public override string ToString()
60 {
61 return this.key;
62 }
63
67 public override bool InlineSpanElement => true;
68
74 public override bool Equals(object obj)
75 {
76 return obj is MetaReference x &&
77 this.key == x.key &&
78 base.Equals(obj);
79 }
80
85 public override int GetHashCode()
86 {
87 int h1 = base.GetHashCode();
88 int h2 = this.key?.GetHashCode() ?? 0;
89
90 h1 = ((h1 << 5) + h1) ^ h2;
91
92 return h1;
93 }
94
99 public override void IncrementStatistics(MarkdownStatistics Statistics)
100 {
101 Statistics.NrMetaReference++;
102 }
103
104 }
105}
Contains a markdown document. This markdown document class supports original markdown,...
MarkdownSettings Settings
Markdown settings.
Variables Variables
Collection of variables. Providing such a collection enables script execution inside markdown documen...
Contains some basic statistical information about a Markdown document.
int NrMetaReference
Number of meta references.
Abstract base class for all markdown elements.
MarkdownDocument Document
Markdown document.
MetaReference(MarkdownDocument Document, string Key)
Meta-data reference
override void IncrementStatistics(MarkdownStatistics Statistics)
Increments the property or properties in Statistics corresponding to the element.
override int GetHashCode()
Serves as the default hash function.
bool TryGetMetaData(out KeyValuePair< string, bool >[] Values)
Tries to get meta-data from the document.
override Task Render(IRenderer Output)
Renders the element.
override bool Equals(object obj)
Determines whether the specified object is equal to the current object.
override bool InlineSpanElement
If the element is an inline span element.
Contains information about a variable.
Definition: Variable.cs:10
object ValueObject
Object Value of variable.
Definition: Variable.cs:88
Collection of variables.
Definition: Variables.cs:25
virtual bool TryGetVariable(string Name, out Variable Variable)
Tries to get a variable object, given its name.
Definition: Variables.cs:52
Interface for Markdown renderers.
Definition: IRenderer.cs:12