diff --git a/lib/nesting_unique_head.rb b/lib/nesting_unique_head.rb index 0acd7ebe417..01278371c17 100644 --- a/lib/nesting_unique_head.rb +++ b/lib/nesting_unique_head.rb @@ -8,7 +8,7 @@ def initialize end def header(text, header_level) - friendly_text = text.parameterize + friendly_text = text.gsub(/<[^>]*>/,"").parameterize @@headers_history[header_level] = text.parameterize if header_level > 1 diff --git a/lib/toc_data.rb b/lib/toc_data.rb index f4663cd2655..4a04efee26f 100644 --- a/lib/toc_data.rb +++ b/lib/toc_data.rb @@ -9,6 +9,7 @@ def toc_data(page_content) headers.push({ id: header.attribute('id').to_s, content: header.children, + title: header.children.to_s.gsub(/<[^>]*>/, ''), level: header.name[1].to_i, children: [] }) @@ -27,4 +28,4 @@ def toc_data(page_content) end end headers -end \ No newline at end of file +end diff --git a/lib/unique_head.rb b/lib/unique_head.rb index e422217309e..d42bab2aa9d 100644 --- a/lib/unique_head.rb +++ b/lib/unique_head.rb @@ -7,7 +7,7 @@ def initialize @head_count = {} end def header(text, header_level) - friendly_text = text.gsub(/<[^<]+>/,"").parameterize + friendly_text = text.gsub(/<[^>]*>/,"").parameterize if friendly_text.strip.length == 0 # Looks like parameterize removed the whole thing! It removes many unicode # characters like Chinese and Russian. To get a unique URL, let's just diff --git a/source/javascripts/app/_toc.js b/source/javascripts/app/_toc.js index b298dc3fe97..eb20fef93f2 100644 --- a/source/javascripts/app/_toc.js +++ b/source/javascripts/app/_toc.js @@ -3,7 +3,7 @@ ;(function () { 'use strict'; - var htmlPattern = /<[^>]*>/g; + var htmlPattern = /<[^>]*>/g; var loaded = false; var debounce = function(func, waitTime) { @@ -67,7 +67,6 @@ } var $best = $toc.find("[href='" + best + "']").first(); - var joinedTitle = $best.data("title") + " – " + originalTitle; if (!$best.hasClass("active")) { // .active is applied to the ToC link we're currently on, and its parent