Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed Nokogiri's void tag conversion.

When using Nokogiri's inner_html, void tags (<br/>), will be
converted without the inner slash. This is invalid HTML4/XHTML,
which will give warnings when reading on iDevices.
  • Loading branch information...
commit 18ba16bf835a10da48885b8f7467a7b445c9679c 1 parent d7c54a5
@fnando authored
View
9 Gemfile.lock
@@ -20,6 +20,7 @@ GEM
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
+ awesome_print (1.0.2)
builder (3.0.0)
coderay (1.0.7)
diff-lcs (1.1.3)
@@ -27,9 +28,14 @@ GEM
builder
rubyzip
i18n (0.6.0)
+ method_source (0.8)
multi_json (1.3.6)
nokogiri (1.5.5)
notifier (0.2.1)
+ pry (0.9.10)
+ coderay (~> 1.0.5)
+ method_source (~> 0.8)
+ slop (~> 3.3.1)
rake (0.9.2.2)
rdiscount (1.6.8)
rspec (2.11.0)
@@ -41,6 +47,7 @@ GEM
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.2)
rubyzip (0.9.9)
+ slop (3.3.2)
test_notifier (1.0.0)
notifier
thor (0.16.0)
@@ -50,7 +57,9 @@ PLATFORMS
ruby
DEPENDENCIES
+ awesome_print
kitabu!
+ pry
rake
rspec
test_notifier
View
2  kitabu.gemspec
@@ -33,4 +33,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec"
s.add_development_dependency "test_notifier"
s.add_development_dependency "rake"
+ s.add_development_dependency "pry"
+ s.add_development_dependency "awesome_print"
end
View
2  lib/kitabu/toc/html.rb
@@ -28,7 +28,7 @@ def self.normalize(content)
tag.set_attribute("id", permalink)
end
- html.css("body").inner_html
+ html.css("body").to_xhtml.gsub(/<body>(.*?)<\/body>/m, "\\1")
end
# Traverse every title normalizing its content as a permalink.
View
80 spec/support/mybook/output/mybook.pdf.html
@@ -1,80 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Testing Kitabu</title>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" type="text/css" href="../templates/html/layout.css" />
- <link rel="stylesheet" type="text/css" href="../templates/html/syntax.css" />
- <link rel="stylesheet" type="text/css" href="../templates/html/user.css" />
- <meta name="author" content="John Doe, Mary Doe" />
- <meta name="subject" content="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
- <meta name="keywords" content="demo, book, pdf, epub, kitabu, textile, html, markdown" />
- <meta name="date" content="2010-12-19" />
- </head>
- <body>
- <div class="frontcover container">
- <div>
- <h1>Testing Kitabu</h1>
- <p class="description">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
- <p class="authors">John Doe and Mary Doe</p>
- </div>
- </div>
-
- <div class="table-of-contents">
- <h2 class="no-toc">Content</h2>
- <div id="toc">
- <div class="level2 markdown"><a href="#markdown"><span>Markdown</span></a></div><div class="level2 textile"><a href="#textile"><span>Textile</span></a></div><div class="level2 html"><a href="#html"><span>HTML</span></a></div><div class="level2 some-chapter"><a href="#some-chapter"><span>Some Chapter</span></a></div>
- </div>
- </div>
-
- <div id="chapters">
- <div class="chapter">
-<h2 id="markdown">Markdown</h2>
-
-<p>This chapter was written with <a href="http://daringfireball.net/projects/markdown/">Markdown</a>.</p>
-
-<div class="CodeRay">
- <div class="code"><pre>nice to hear that!</pre></div>
-</div>
-
-
-</div>
-<div class="chapter">
-<h2 id="textile">Textile</h2>
-<p>This chapter was written with <a href="http://www.textism.com/tools/textile/">Textile</a>.</p>
-
-</div>
-<div class="chapter">
-<h2 id="html">HTML</h2>
-
-<p>This chapter was written with HTML.</p>
-
-
-</div>
-<div class="chapter">
-<h2 id="some-chapter">Some Chapter</h2>
-
-<p>Some chapter organized in a directory.</p>
-
-
-</div>
- </div>
-
- <div class="imprint container">
- <div>
- <h2>Testing Kitabu</h2>
- <p>John Doe and Mary Doe</p>
- <p>Copyright (C) 2010 John Doe.</p>
- </div>
- </div>
-
-
- <div class="container changelog">
- <h2>Revisions</h2>
-<h3>Version 1</h3>
-<ul><li>Some text fixes</li>
- <li>Added chapter about something</li>
-</ul></div>
-
- </body>
-</html>
Please sign in to comment.
Something went wrong with that request. Please try again.