Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update suite to run against the latest #107

Merged
merged 19 commits into from Feb 14, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions Gemfile.lock
@@ -1,7 +1,7 @@
GEM
remote: http://rubygems.org/
remote: https://rubygems.org/
specs:
json (1.4.6)
json (1.8.3)
nokogiri (1.5.5)
peach (0.4)
rack (1.2.1)
Expand All @@ -20,3 +20,6 @@ DEPENDENCIES
rake
sass
yui-compressor

BUNDLED WITH
1.10.6
33 changes: 10 additions & 23 deletions Makefile
Expand Up @@ -4,42 +4,29 @@ CURL=curl
PYTHON=python
RUBY=ruby
PATCH=patch
SPLITTER=html5-tools/spec-splitter/spec-splitter.py
SPLITTERFLAGS=--html5lib-serialiser

postprocess: clean-output process_assets LOG
postprocess: clean-output process_assets tidy
bundle exec rake postprocess:execute

LOG: index.html $(SPLITTER)
$(PYTHON) $(SPLITTER) $(SPLITTERFLAGS) $< ./public > LOG
multipage-dev.zip:
$(CURL) --compressed https://html5.org/temp/multipage-dev.zip > $@

index.html: html5-full.html anolis/anolis
$(PYTHON) anolis/anolis \
--parser=lxml.html \
--filter=.impl \
--output-encoding="ascii" \
$< $@
multipage-dev: multipage-dev.zip
unzip -o multipage-dev.zip

html5-full.html:
$(CURL) --compressed http://www.whatwg.org/specs/web-apps/current-work/dev-index > $@
$(RUBY) tidy.rb $@
tidy: multipage-dev
$(RUBY) tidy.rb multipage-dev/index.html
cp -r multipage-dev/*.html public

process_assets:
$(RUBY) assets.rb

clean: clean-output
$(RM) html5-full.html
$(RM) -r multipage-dev
$(RM) multipage-dev.zip

clean-output:
$(RM) LOG
$(RM) -r public/**/*.html
$(RM) -r public/css/*.css
$(RM) -r public/javascript/*.js
$(RM) -r public/*.manifest

anolis/anolis:
$(HG) clone http://hg.hoppipolla.co.uk/anolis/
$(PATCH) -p1 -d anolis < patch.anolis

$(SPLITTER):
$(SVN) checkout http://html5.googlecode.com/svn/trunk/ html5-tools
34 changes: 14 additions & 20 deletions Rakefile
Expand Up @@ -36,16 +36,10 @@ namespace :postprocess do
end
end

# This will seem strange, we'll get the header, keep its contents, remove it from the DOM
# Then, we'll get everything within the body, wrap it within a <section role="main">
# Finally, we'll add back the header above the newly created <section>
# we'll get everything within the body, wrap it within a <section role="main">
task :add_main_section do
each_page do |doc, filename|
header = doc.at("header")
header.remove

doc.at("body").children = Nokogiri::HTML::fragment("<section role='main'>#{doc.at("body").to_html}</section>")
doc.at("section[role='main']").before(Nokogiri::HTML::fragment(header.to_html))
end
end

Expand All @@ -71,19 +65,19 @@ namespace :postprocess do
end

# Remove links that are the same page as their parent, remove them.
doc.css("ol.toc li a").each do |item|
item_href = item.attributes["href"].to_s.gsub(/#.*\Z/, "")
branch = item.parent.parent.parent
#doc.css("ol.toc li a").each do |item|
# item_href = item.attributes["href"].to_s.gsub(/#.*\Z/, "")
# branch = item.parent.parent.parent

if branch.node_name == "li"
a = branch.at("a")
a_href = a.attributes["href"].to_s.gsub(/#.*\Z/, "")
# if branch.node_name == "li"
# a = branch.at("a")
# a_href = a.attributes["href"].to_s.gsub(/#.*\Z/, "")

if a_href == item_href
item.remove
end
end
end
# if a_href == item_href
# item.remove
# end
# end
#end
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to get these disabled lines figured out? Any questions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it does this to the table of contents.

screen shot 2015-12-31 at 4 14 09 pm

Need to investigate more.


desc "Add document footer"
Expand Down Expand Up @@ -142,7 +136,7 @@ namespace :postprocess do

desc "Add search to each html file"
task :insert_search do
insert("html/search.html", "header.head")
#insert("html/search.html", "header.head")
end

desc "Insert javascripts"
Expand Down Expand Up @@ -190,7 +184,7 @@ namespace :postprocess do
desc "Insert WHATWG logo"
task :insert_whatwg_logo do
each_page do |doc, filename|
doc.at("header.head hgroup").before('<div class="logo">WHATWG</div>')
#doc.at("header.head hgroup").before('<div class="logo">WHATWG</div>')
end
end

Expand Down