From 02d432c2ef00abbed1bdf926707d01deecd32890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Nettingsmeier?= Date: Sun, 2 Feb 2014 22:37:04 +0100 Subject: [PATCH] add little ruby helper to convert uris to NMTOKEN, for XHTML compliant fragment identifiers. is there any browser that still relies on the attribute? if so, it can be added back. --- _plugins/manual.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_plugins/manual.rb b/_plugins/manual.rb index 2c5c4b8..b3d8dad 100644 --- a/_plugins/manual.rb +++ b/_plugins/manual.rb @@ -165,6 +165,10 @@ module Manual position ? [current, position, level + 1] : [current] end + def sanitize_NMTOKEN(s) + 'ID'+s.gsub(/[^0-9A-z:_.-]/, '_') + end + def render(context) @source = '_manual' #context.registers[:site].source @@ -201,7 +205,7 @@ module Manual erb = ::ERB.new <<-HTML
- <%= entry[:menu_title] %> + <%= entry[:menu_title] %>
<% if entry[:children].any? %> @@ -221,7 +225,7 @@ module Manual erb = ::ERB.new <<-HTML
- <%= entry[:menu_title] %> + <%= entry[:menu_title] %>