From 8ab351a5b546a128e5b49d9bc5509c74e72acce4 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Wed, 9 May 2012 12:01:46 +0300 Subject: [PATCH] Strip extra HTML from guides TOC. Some titles contain links, resulting in links-inside-links which is of no good. --- lib/jsduck/guides.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jsduck/guides.rb b/lib/jsduck/guides.rb index 57311d97..7d535897 100644 --- a/lib/jsduck/guides.rb +++ b/lib/jsduck/guides.rb @@ -111,8 +111,9 @@ module JsDuck html.each_line do |line| if line =~ /^

(.*)<\/h2>$/ i += 1 - toc << "
  • #{$1}
  • \n" - new_html << "

    #{$1}

    \n" + text = strip_tags($1) + toc << "
  • #{text}
  • \n" + new_html << "

    #{text}

    \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 -- GitLab