XHTML, XHTML 1.1 (and therefore EPUB) outputs by changing html2xhtml.xsl.
Fixes bug #
2873153: No <b> and <i> tags in XHTML/EPUB
Added regression to EPUB specs:
opf_lns.to_s.should =~ /<itemref idref="#{before_refentry_id}"[^>]*[^<]*<itemref idref="#{re01_id}"[^>]*>[^<]*<itemref idref="#{re02_id}"/m
end
+ it "should not include font style elements like <b> or <i>" do
+ begin
+ tmpdir = File.join(Dir::tmpdir(), "epubbtest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
+
+ epub = DocBook::Epub.new(File.join(@testdocsdir, "book.002.xml"), @tmpdir)
+ epubfile = File.join(tmpdir, "bcount.epub")
+ epub.render_to_file(epubfile, $DEBUG)
+ FileUtils.copy(epubfile, ".b.epub") if $DEBUG
+
+ success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}")
+ raise "Could not unzip #{epubfile}" unless success
+ glob = Dir.glob(File.join(tmpdir, "**", "*.html"))
+ glob.each {|html_file|
+ bs = File.open(html_file).readlines.to_s.scan(/<b>/)
+ bs.should be_empty
+ is = File.open(html_file).readlines.to_s.scan(/<i>/)
+ is.should be_empty
+ }
+ rescue => e
+ raise e
+ ensure
+ FileUtils.rm_r(tmpdir, :force => true)
+ end
+ end
+
after(:all) do
FileUtils.rm_r(@tmpdir, :force => true)
end
<xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]">
<xsl:if test="$show.comments != 0">
- <p class="remark"><i><xsl:call-template name="inline.charseq"/></i></p>
+ <p class="remark"><em><xsl:call-template name="inline.charseq"/></em></p>
</xsl:if>
</xsl:template>
<xsl:call-template name="anchor"/>
<xsl:choose>
<xsl:when test="$presentation = 'bold'">
- <b>
+ <strong>
<xsl:apply-templates select="term"/>
<xsl:value-of select="$separator"/>
- </b>
+ </strong>
</xsl:when>
<xsl:when test="$presentation = 'italic'">
- <i>
+ <em>
<xsl:apply-templates select="term"/>
<xsl:value-of select="$separator"/>
- </i>
+ </em>
</xsl:when>
<xsl:when test="$presentation = 'bold-italic'">
- <b>
- <i>
+ <strong>
+ <em>
<xsl:apply-templates select="term"/>
<xsl:value-of select="$separator"/>
- </i>
- </b>
+ </em>
+ </strong>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="term"/>
</xsl:copy>
</xsl:template>
+<!-- "The following HTML elements specify font information.
+ Although they are not all deprecated, their use is discouraged in
+ favor of style sheets." -->
+<xsl:template match="b|i"/>
+
<!-- this only occurs in docbook.xsl to identify errors -->
<xsl:template match="font">
<span class="ERROR" xmlns="http://www.w3.org/1999/xhtml">
</span>
</xsl:template>
+<!-- "The following HTML elements specify font information.
+ Although they are not all deprecated, their use is discouraged in
+ favor of style sheets." -->
+<xsl:template match="b|i"/>
+
<!-- this only occurs in docbook.xsl to identify errors -->
<xsl:template match="a[@name]">
<xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">