Skip to content
Myr

Use entry title without whitespace as section id

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent e3e7cea · Browse files · 2 files+11 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−7 removed

  • other:+11 added−7 removed

2 files+11 added−7 removed

modified:docs/templates/manual.liquid+5 added-5 removed
10 unmodified lines
11 <h4>Contents</h4>12 <ul class="nav nav-pills nav-stacked">13 {% for section in sections %}14 <li>15 <a href="#{{section.title | sanitize}}">{{section.title}}</a>15 <a href="#{{section.title | section_id}}">{{section.title}}</a>16 </li>17 {% endfor %}18 </ul>19 <form class="form-group">
9 unmodified lines
29 <h1>{{headline}}</h1>30 {{ history | markdownify }}31 {{ body | markdownify }}32 {% for section in sections %}33 <section id="{{section.title | sanitize}}">33 <section id="{{section.title | section_id}}">34 <h2>{{section.title}}</h2>35 {{section.body | markdownify}}36 {% for entry in section.entries %}37 <section>37 <section id="{{entry.title | entry_id}}">38 <h3>39 {{entry.title | markdownify | no_paragraph}}40 {% if entry.subtitle %}<small>{{entry.subtitle}}</small>{% endif %}41 </h3>
44 unmodified lines
86 <script>87 var section_map = {88 {% for section in sections %}89 {% for entry in section.entries %}90 {{entry.title | json}} : {{entry.title | sanitize | json}},90 {{entry.title | json}} : {{entry.title | entry_id | json}},91 {% endfor %}92 {{section.title | json}} : {{section.title | sanitize | json}}92 {{section.title | json}} : {{section.title | section_id | json}}93 {% unless forloop.last %},{% endunless %}94 {% endfor %}95 };96 </script>
3 unmodified lines
modified:docs/Rakefile+6 added-2 removed
10 unmodified lines
11 def markdownify(input)12 Maruku.new(input).to_html13 end1415 def sanitize(input)16 input.gsub(/[^a-zA-Z0-9_]/,"")15 def section_id(input)16 input.gsub(/[^a-zA-Z0-9_]/, '')17 end1819 def entry_id(input)20 input.gsub(' ', '')21 end2223 def no_paragraph(input)24 input.gsub('<p>', '').gsub('</p>', '')25 end26
127 unmodified lines