From b1083ab367a1bfde80ea27cd4fa09474c60de880 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 14 Aug 2015 00:22:55 -0700 Subject: [PATCH] Use entry title without whitespace as section id --- docs/Rakefile | 8 ++++++-- docs/templates/manual.liquid | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/Rakefile b/docs/Rakefile index b204dfa9..8de64a7e 100644 --- a/docs/Rakefile +++ b/docs/Rakefile @@ -12,8 +12,12 @@ module ExtraFilters 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) diff --git a/docs/templates/manual.liquid b/docs/templates/manual.liquid index d464b801..6aa08571 100644 --- a/docs/templates/manual.liquid +++ b/docs/templates/manual.liquid @@ -12,7 +12,7 @@ @@ -30,11 +30,11 @@ {{ history | markdownify }} {{ body | markdownify }} {% for section in sections %} -
+

{{section.title}}

{{section.body | markdownify}} {% for entry in section.entries %} -
+

{{entry.title | markdownify | no_paragraph}} {% if entry.subtitle %}{{entry.subtitle}}{% endif %} @@ -87,9 +87,9 @@ 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 %} };