Skip to content
Snippets Groups Projects
Commit 8ab351a5 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Strip extra HTML from guides TOC.

Some titles contain links, resulting in links-inside-links which is of
no good.
parent 274f7578
No related branches found
No related tags found
No related merge requests found
......@@ -111,8 +111,9 @@ module JsDuck
html.each_line do |line|
if line =~ /^<h2>(.*)<\/h2>$/
i += 1
toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{$1}</a></li>\n"
new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{$1}</h2>\n"
text = strip_tags($1)
toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{text}</a></li>\n"
new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{text}</h2>\n"
else
new_html << line
end
......@@ -151,6 +152,9 @@ module JsDuck
"guides/" + guide["name"] + "/icon.png"
end
def strip_tags(str)
str.gsub(/<.*?>/, "")
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment