Maruku.new(input).to_html
end
- def sanitize(input)
- input.gsub(/[^a-zA-Z0-9_]/,"")
+ def section_id(input)
+ input.gsub(/[^a-zA-Z0-9_]/, '')
+ end
+
+ def entry_id(input)
+ input.gsub(' ', '')
end
def no_paragraph(input)
<ul class="nav nav-pills nav-stacked">
{% for section in sections %}
<li>
- <a href="#{{section.title | sanitize}}">{{section.title}}</a>
+ <a href="#{{section.title | section_id}}">{{section.title}}</a>
</li>
{% endfor %}
</ul>
{{ history | markdownify }}
{{ body | markdownify }}
{% for section in sections %}
- <section id="{{section.title | sanitize}}">
+ <section id="{{section.title | section_id}}">
<h2>{{section.title}}</h2>
{{section.body | markdownify}}
{% for entry in section.entries %}
- <section>
+ <section id="{{entry.title | entry_id}}">
<h3>
{{entry.title | markdownify | no_paragraph}}
{% if entry.subtitle %}<small>{{entry.subtitle}}</small>{% endif %}
var section_map = {
{% for section in sections %}
{% for entry in section.entries %}
- {{entry.title | json}} : {{entry.title | sanitize | json}},
+ {{entry.title | json}} : {{entry.title | entry_id | json}},
{% endfor %}
- {{section.title | json}} : {{section.title | sanitize | json}}
+ {{section.title | json}} : {{section.title | section_id | json}}
{% unless forloop.last %},{% endunless %}
{% endfor %}
};