false values honored for references

This commit is contained in:
Heydon Pickering 2017-10-06 17:06:33 +01:00
parent b7d0f50487
commit a3cfd63839
6 changed files with 35 additions and 9 deletions

View File

@ -46,6 +46,10 @@ Here's the more verbose output:
{{% wcag include="2.1.1, 4.1.2" descriptions="true" %}}
{{% note %}}
Both omitting the `descriptions` attribute and including it with a "false" value will omit descriptions. If it is included it _must_ have a value. A boolean attribute will break the output.
{{% /note %}}
## Inclusive Design Principle references
Some inclusive design concepts are not reducible to success or fail criteria. This is why The Paciello Group wrote the [Inclusive Design Principles](http://inclusivedesignprinciples.org/). These can be listed by name.

View File

@ -786,14 +786,25 @@ I can reference the {{% pattern "Notes & warnings" %}} pattern here.
</ul>
<aside aria-label="note" class="note">
<div>
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
<use xlink:href="#info"></use>
</svg>
<p>Both omitting the <code>descriptions</code> attribute and including it with a &ldquo;false&rdquo; value will omit descriptions. If it is included it <em>must</em> have a value. A boolean attribute will break the output.</p>
</div>
</aside>
<h2 id="inclusive-design-principle-references">Inclusive Design Principle references</h2>
<p>Some inclusive design concepts are not reducible to success or fail criteria. This is why The Paciello Group wrote the <a href="http://inclusivedesignprinciples.org/">Inclusive Design Principles</a>. These can be listed by name.</p>
<p><pre class=""><code data-codeblock-shortcode>
<pre class=""><code data-codeblock-shortcode>
&#x7b;{% principles include="Add value, Be consistent" descriptions="true" %}}
</code></pre>
</p>
<p>Here&rsquo;s the output with <code>descriptions=&quot;true&quot;</code>:</p>

View File

@ -1402,14 +1402,25 @@ I can reference the &#x7b;{% pattern "Notes & warnings" %}} pattern here.
</ul>
<aside aria-label="note" class="note">
<div>
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
<use xlink:href="#info"></use>
</svg>
<p>Both omitting the <code>descriptions</code> attribute and including it with a &ldquo;false&rdquo; value will omit descriptions. If it is included it <em>must</em> have a value. A boolean attribute will break the output.</p>
</div>
</aside>
<h2 id="inclusive-design-principle-references">Inclusive Design Principle references</h2>
<p>Some inclusive design concepts are not reducible to success or fail criteria. This is why The Paciello Group wrote the <a href="http://inclusivedesignprinciples.org/">Inclusive Design Principles</a>. These can be listed by name.</p>
<p><pre class=""><code data-codeblock-shortcode>
<pre class=""><code data-codeblock-shortcode>
&#x7b;{% principles include="Add value, Be consistent" descriptions="true" %}}
</code></pre>
</p>
<p>Here&rsquo;s the output with <code>descriptions=&quot;true&quot;</code>:</p>

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
{{ $included := replace (.Get "include") ", " "," }}
{{ $included := apply (split $included ",") "lower" "." }}
{{ $descriptions := .Get "descriptions" }}
<ul class="principles {{ if $descriptions }}with-desc{{ end }}">
<ul class="principles {{ if and ($descriptions) (ne $descriptions "false") }}with-desc{{ end }}">
{{ range $JSON.principles }}
{{ if in $included (lower .title) }}
<li>
@ -15,7 +15,7 @@
</a>:
</strong>
<em>{{ .strapline }}</em>
{{ if $descriptions }}
{{ if and ($descriptions) (ne $descriptions "false") }}
<p>{{ .description }}</p>
{{ end }}
</li>

View File

@ -2,7 +2,7 @@
{{ $included := replace (.Get "include") ", " "," }}
{{ $included := split $included "," }}
{{ $descriptions := .Get "descriptions" }}
<ul class="wcag {{ if $descriptions }}with-desc{{ end }}">
<ul class="wcag {{ if and ($descriptions) (ne $descriptions "false") }}with-desc{{ end }}">
{{ range $JSON }}
{{ if in $included .ref_id }}
<li>
@ -12,7 +12,7 @@
</svg>
{{ .ref_id }} {{ .title }}</a> (level {{ .level }}){{ if $descriptions }}:{{ end }}
</strong>
{{ if $descriptions }}
{{ if and ($descriptions) (ne $descriptions "false") }}
{{ .description }}
{{ if .special_cases }}
<ul>