Loading lib/jsduck/guides.rb +5 −5 Original line number Diff line number Diff line Loading @@ -63,21 +63,21 @@ module JsDuck # Creates table of contents at the top of guide by looking for <h2> elements in HTML. def add_toc(guide, html) toc = [ "<p><strong>Contents</strong></p>", "<ul class='toc'>", "<p><strong>Contents</strong></p>\n", "<ul class='toc'>\n", ] new_html = [] i = 0 html.each_line do |line| if line =~ /^<h2>(.*)<\/h2>$/ i += 1 toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{$1}</a></li>" new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{$1}</h2>" toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{$1}</a></li>\n" new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{$1}</h2>\n" else new_html << line end end toc << "</ul>" toc << "</ul>\n" # Inject TOC at below first heading new_html.insert(1, toc) new_html.flatten.join Loading template/index.php +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ if (isset($_GET["_escaped_fragment_"]) || isset($_GET["print"])) { } elseif (preg_match('/^\/guide\/(.+?)(-section-[0-9]+)?$/', $fragment, $m)) { $json = decode_file("guides/".$m[1]."/README.js"); print_page($json["title"], '<div id="guide" style="padding: 1px">' . $json["guide"] . '</div>', $fragment); print_page($json["title"], '<div class="guide-container" style="padding: 1px">' . $json["guide"] . '</div>', $fragment); } elseif (preg_match('/^\/guide\/?$/', $fragment, $m)) { print_index_page(); Loading Loading
lib/jsduck/guides.rb +5 −5 Original line number Diff line number Diff line Loading @@ -63,21 +63,21 @@ module JsDuck # Creates table of contents at the top of guide by looking for <h2> elements in HTML. def add_toc(guide, html) toc = [ "<p><strong>Contents</strong></p>", "<ul class='toc'>", "<p><strong>Contents</strong></p>\n", "<ul class='toc'>\n", ] new_html = [] i = 0 html.each_line do |line| if line =~ /^<h2>(.*)<\/h2>$/ i += 1 toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{$1}</a></li>" new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{$1}</h2>" toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{$1}</a></li>\n" new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{$1}</h2>\n" else new_html << line end end toc << "</ul>" toc << "</ul>\n" # Inject TOC at below first heading new_html.insert(1, toc) new_html.flatten.join Loading
template/index.php +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ if (isset($_GET["_escaped_fragment_"]) || isset($_GET["print"])) { } elseif (preg_match('/^\/guide\/(.+?)(-section-[0-9]+)?$/', $fragment, $m)) { $json = decode_file("guides/".$m[1]."/README.js"); print_page($json["title"], '<div id="guide" style="padding: 1px">' . $json["guide"] . '</div>', $fragment); print_page($json["title"], '<div class="guide-container" style="padding: 1px">' . $json["guide"] . '</div>', $fragment); } elseif (preg_match('/^\/guide\/?$/', $fragment, $m)) { print_index_page(); Loading