Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove index hash links. Closes #25

  • Loading branch information...
commit d40d79191870deb98652854979c2d72155230e0c 1 parent 628567a
Ben Schwarz authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 Rakefile
13 Rakefile
View
@@ -7,7 +7,7 @@ require "peach"
require "json"
namespace :postprocess do
- task :execute => [:credits, :references, :footer, :analytics, :search_index, :insert_search, :insert_stylesheets, :insert_javascripts, :insert_manifest, :insert_syncing, :insert_charset, :insert_ios, :insert_droid_serif, :add_next_up_links, :insert_whatwg_logo]
+ task :execute => [:credits, :references, :footer, :analytics, :search_index, :insert_search, :insert_stylesheets, :insert_javascripts, :insert_manifest, :insert_syncing, :insert_charset, :insert_ios, :insert_droid_serif, :add_next_up_links, :insert_whatwg_logo, :remove_index_hash_links]
def each_page(&block)
Dir.chdir("public") do
@@ -152,6 +152,17 @@ namespace :postprocess do
doc.at("header.head hgroup").before('<div class="logo">WHATWG</div>')
end
end
+
+ desc "Remove hash links from index toc"
+ task :remove_index_hash_links do
+ index = Nokogiri::HTML(File.open("public/index.html", "r"))
+
+ index.css("ol.toc a").each do |link|
+ link.attributes["href"].value = link.attributes["href"].to_s.gsub(/#(.*)+$/, "")
+ end
+
+ File.open("public/index.html", "w") {|buffer| buffer << index.to_html }
+ end
end
namespace :generate do
Please sign in to comment.
Something went wrong with that request. Please try again.