From 7ef0fd43275c935670098c01e4ee557d6632e9ea Mon Sep 17 00:00:00 2001 From: Robert Lord Date: Thu, 23 Nov 2017 10:14:03 -0800 Subject: [PATCH] Parameterize ToC titles, remove html tags from slug (thx seweil), fixes #904 --- lib/unique_head.rb | 2 +- source/layouts/layout.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/unique_head.rb b/lib/unique_head.rb index 9c26790..1dbf518 100644 --- a/lib/unique_head.rb +++ b/lib/unique_head.rb @@ -6,7 +6,7 @@ class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML @head_count = {} end def header(text, header_level) - friendly_text = text.parameterize + friendly_text = text.gsub(/<[^<]+>/,"").parameterize @head_count[friendly_text] ||= 0 @head_count[friendly_text] += 1 if @head_count[friendly_text] > 1 diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index bb0943e..9094db5 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -72,12 +72,12 @@ under the License.
<% toc_data(page_content).each do |h1| %>
  • - <%= h1[:content] %> + <%= h1[:content] %> <% if h1[:children].length > 0 %>