Added support to split the topic description into sections.

We are using special markup to split the description into sections.

Each section is marked as:

    {{ section(type="example", id="foo") }}
    ...
    {{ end }}

This is the first-cut implementation and requires cleanup.
This commit is contained in:
Anand Chitipothu
2021-03-12 12:30:50 +00:00
parent ce7175040f
commit faf102bdec
5 changed files with 108 additions and 8 deletions

View File

@@ -30,7 +30,7 @@
<h1>{{ topic.title }}</h1>
{% for s in topic.sections %}
{% for s in topic.get_sections() %}
<div class="section section-{{ s.type }}">
{{ render_section(s) }}
</div>
@@ -43,8 +43,8 @@
{% macro render_section(s) %}
{% if s.type == "text" %}
{{ render_section_text(s) }}
{% elif s.type == "code" %}
{{ LiveCodeEditor(s.name, s.code) }}
{% elif s.type == "example" or s.type == "code" %}
{{ LiveCodeEditor(s.name, s.contents) }}
{% else %}
<div>Unknown section type: {{s.type}}</div>
{% endif %}