chore(doc-gen): improve headings for events and examples

The "Events" heading now gets an id (which makes them show in
the table of contents, and their "Parameters" use a heading with
a lower priority (previously it was the same as "Events" itself).

The "@example" tag now generates the heading "Example" if there's
only one, or "Examples" if there are multiple.
This commit is contained in:
Martin Staffa
2017-10-05 12:17:18 +02:00
committed by Martin Staffa
parent 8166dd40e4
commit f05f548546
3 changed files with 5 additions and 5 deletions
@@ -52,7 +52,7 @@
{% block examples %}
{%- if doc.examples %}
<h2 id="example">Examples</h2>
<h2 id="examples">{$ "Examples" if doc.examples | length > 1 else "Example" $}</h2>
{%- for example in doc.examples -%}
{$ example | marked $}
{%- endfor -%}
@@ -2,11 +2,11 @@
{% import "lib/deprecated.html" as x -%}
{%- if doc.events %}
<h2>Events</h2>
<h2 id="events">Events</h2>
<ul class="events">
{%- for event in doc.events %}
<li id="{$ event.name $}">
<h3>{$ event.name $}</h3>
<h3 id="event-{$ event.name $}">{$ event.name $}</h3>
<div>{$ event.description | marked $}</div>
{$ x.deprecatedBlock(event) $}
@@ -27,7 +27,7 @@
{% endif -%}
{%- if event.params %}
<section class="api-section">
<h3>Parameters</h3>
<h4>Parameters</h4>
{$ lib.paramTable(event.params) $}
</section>
{%- endif -%}
@@ -27,7 +27,7 @@
{% endif %}
{%- if method.examples %}
<h4 id="{$ doc.name $}.{$ method.name $}-examples">Examples</h4>
<h4 id="{$ doc.name $}.{$ method.name $}-examples">{$ "Examples" if method.examples | length > 1 else "Example" $}</h4>
{%- for example in method.examples -%}
{$ example | marked $}
{%- endfor -%}