summaryrefslogtreecommitdiffstats
path: root/docs/templates/manual.liquid
blob: 59505a955cf3b93e3ff1ff8d3a577ad139ef211d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
{% include "shared/head" %}

  <body id="{{slug}}" data-spy="scroll" data-target="#navcolumn" data-offset="100">
{% include "shared/navbar" %}

    <div class="container">
      <div class="row">
        <div class="affix" id="navcolumn">
          <h4>Contents</h4>
          <ul class="nav nav-pills nav-stacked">
            {% for section in sections %}
              <li>
                <a href="#{{section.title | section_id}}">{{section.title}}</a>
              </li>
            {% endfor %}
          </ul>
          <form class="form-group">
            <input type="text"
                  class="form-control"
                  placeholder="Search"
                  autocomplete="off"
                  id="searchbox">
          </form>
        </div>

        <div id="manualcontent">
          <h1>{{headline}}</h1>
          {{ history | markdownify }}
          {{ body | markdownify }}
          {% for section in sections %}
            <section id="{{section.title | section_id}}">
              <h2>{{section.title}}</h2>
              {{section.body | markdownify}}
              {% for entry in section.entries %}
                <section id="{{entry.title | entry_id}}">
                  <h3>
                    {{entry.title | markdownify | no_paragraph}}
                    {% if entry.subtitle %}<small>{{entry.subtitle}}</small>{% endif %}
                  </h3>
                  {{entry.body | markdownify}}

                  {% if entry.examples %}
                    <div>
                      {% capture exampleID %}{{ "" | unique }}{% endcapture %}
                      <a data-toggle="collapse" href="#example{{exampleID}}">
                        <i class="glyphicon glyphicon-chevron-right"></i>
                        {% if entry.examples[1] %}Examples{%else%}Example{%endif%}
                      </a>
                      <div id="example{{exampleID}}" class="manual-example collapse">
                        {% for example in entry.examples %}
                          <table>
                            <tr><th></th><td class="jqprogram">jq '{{example.program | escape}}'</td></tr>
                            <tr><th>Input</th><td>{{example.input | escape}}</td></tr>
                            {% unless example.output[0] %}
                              <tr>
                                <th>Output</th>
                                <td><i>none</i></td>
                              </tr>
                            {% endunless %}
                            {% for output in example.output %}
                              <tr>
                                {% if forloop.index == 1 %}
                                  <th>Output</th>
                                {% else %}
                                  <th></th>
                                {% endif %}
                                <td>{{output | escape}}</td>
                              </tr>
                            {% endfor %}
                          </table>
                        {% endfor %}
                      </div>
                    </div>
                  {% endif %}
                </section>
              {% endfor %}
            </section>
          {% endfor %}
        </div>
      </div>
    </div>

{% include "shared/footer" %}
    <script>
      var section_map = {
        {% for section in sections %}
          {% for entry in section.entries %}
            {{entry.title | search_id | json}} : {{entry.title | entry_id | json}},
          {% endfor %}
          {{section.title | search_id | json}} : {{section.title | section_id | json}}
          {% unless forloop.last %},{% endunless %}
        {% endfor %}
      };
    </script>
    <script src="{{root}}/js/manual-search.js"></script>
  </body>
</html>