Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 4 additions & 31 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -979,38 +979,11 @@ <h2>Algorithms</h2>
<h5>Render (TemplateRenderMethod)</h5>

<p>
The following algorithm is used to transform the SVG image template into the
final SVG image that is displayed. The inputs to the algorithm are the
[=verifiable credential=] (`verifiableCredential`) and the SVG image
source code (`svgImage`). The output is a SVG image.
The <a href="https://mustache.github.io/">Mustache</a> templating language is used
to produce a visual representation of the [=verifiable credential=].
See the <a href="https://mustache.github.io/mustache.5.html">Mustache 5.0
Specification</a> for details.
</p>

<ol class="algorithm">
<li>
Generate a map, `replacementMap`, by finding all strings in `svgImage` that
start with `{{` (double open braces) and end with `}}`
(double close braces). For each string, `templateKey`, that is found:
<ol class="algorithm">
<li>
Generate another string, `templateValue`, by evaluating the value of
`templateKey` (without the opening or closing braces) using the JSON
Pointer [[RFC6901]] algorithm with the `verifiableCredential` as input to the
algorithm. If the evaluation is `null`, set `templateValue` to the empty string.
</li>
<li>
Set a key in `replacementMap` by using `templateKey` and associate it with
`templateValue`.
</li>
</ol>
</li>
<li>
For every key in `replacementMap`, replace each corresponding
string in `svgImage` that matches the key with the associated value in the
`replacementMap`.
</li>
</ol>
</section>

</section>

<section>
Expand Down