mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Use entry title without whitespace as section id
This commit is contained in:
@@ -12,8 +12,12 @@ module ExtraFilters
|
|||||||
Maruku.new(input).to_html
|
Maruku.new(input).to_html
|
||||||
end
|
end
|
||||||
|
|
||||||
def sanitize(input)
|
def section_id(input)
|
||||||
input.gsub(/[^a-zA-Z0-9_]/,"")
|
input.gsub(/[^a-zA-Z0-9_]/, '')
|
||||||
|
end
|
||||||
|
|
||||||
|
def entry_id(input)
|
||||||
|
input.gsub(' ', '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def no_paragraph(input)
|
def no_paragraph(input)
|
||||||
|
10
docs/templates/manual.liquid
vendored
10
docs/templates/manual.liquid
vendored
@@ -12,7 +12,7 @@
|
|||||||
<ul class="nav nav-pills nav-stacked">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
{% for section in sections %}
|
{% for section in sections %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#{{section.title | sanitize}}">{{section.title}}</a>
|
<a href="#{{section.title | section_id}}">{{section.title}}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -30,11 +30,11 @@
|
|||||||
{{ history | markdownify }}
|
{{ history | markdownify }}
|
||||||
{{ body | markdownify }}
|
{{ body | markdownify }}
|
||||||
{% for section in sections %}
|
{% for section in sections %}
|
||||||
<section id="{{section.title | sanitize}}">
|
<section id="{{section.title | section_id}}">
|
||||||
<h2>{{section.title}}</h2>
|
<h2>{{section.title}}</h2>
|
||||||
{{section.body | markdownify}}
|
{{section.body | markdownify}}
|
||||||
{% for entry in section.entries %}
|
{% for entry in section.entries %}
|
||||||
<section>
|
<section id="{{entry.title | entry_id}}">
|
||||||
<h3>
|
<h3>
|
||||||
{{entry.title | markdownify | no_paragraph}}
|
{{entry.title | markdownify | no_paragraph}}
|
||||||
{% if entry.subtitle %}<small>{{entry.subtitle}}</small>{% endif %}
|
{% if entry.subtitle %}<small>{{entry.subtitle}}</small>{% endif %}
|
||||||
@@ -87,9 +87,9 @@
|
|||||||
var section_map = {
|
var section_map = {
|
||||||
{% for section in sections %}
|
{% for section in sections %}
|
||||||
{% for entry in section.entries %}
|
{% for entry in section.entries %}
|
||||||
{{entry.title | json}} : {{entry.title | sanitize | json}},
|
{{entry.title | json}} : {{entry.title | entry_id | json}},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{section.title | json}} : {{section.title | sanitize | json}}
|
{{section.title | json}} : {{section.title | section_id | json}}
|
||||||
{% unless forloop.last %},{% endunless %}
|
{% unless forloop.last %},{% endunless %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user