Skip to content

Commit

Permalink
Preserve heading structure in zedai-to-html
Browse files Browse the repository at this point in the history
Also has an effect on dtbook-to-html and dtbook-to-epub3 (which use
zedai-to-html).

Fixes daisy/pipeline#678 and
daisy/pipeline#680.
  • Loading branch information
bertfrees committed Jun 15, 2023
1 parent 3741d86 commit 21294fb
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 47 deletions.
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
<dependency>
<groupId>org.daisy.pipeline.modules</groupId>
<artifactId>zedai-to-html</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<x:expect label="the book-1.smil file" type="compare">
<x:document type="inline">
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0">
<body epub:type="frontmatter">
<body epub:textref="../book-1.xhtml#id_4" epub:type="frontmatter">
<seq epub:textref="../book-1.xhtml#id_1">
<seq epub:textref="../book-1.xhtml#forsmil-d1386e16" epub:type="title">
<par>
Expand All @@ -106,7 +106,7 @@
<x:expect label="the book-2.smil file" type="compare">
<x:document type="inline">
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0">
<body epub:type="bodymatter">
<body epub:textref="../book-2.xhtml#id_5" epub:type="bodymatter">
<seq epub:textref="../book-2.xhtml#id_2">
<par epub:type="pagebreak">
<text src="../book-2.xhtml#page_1"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@
</x:document>
</x:expect>
<x:context label="the content file">
<x:document type="file" base-uri="temp-dir" href="issue-94/output-dir/test_dtbook-to-epub3.script.epub!/EPUB/test_dtbook-to-epub3.script-2.xhtml" select="//html:h1[1]"/>
<x:document type="file" base-uri="temp-dir" href="issue-94/output-dir/test_dtbook-to-epub3.script.epub!/EPUB/test_dtbook-to-epub3.script-2.xhtml" select="//(html:h1|html:h2|html:h3|html:h4|html:h5|html:h6)[1]"/>
</x:context>
<x:expect label="the white space in between the 'em' elements should be preserved" type="compare" normalize-space="false">
<x:document type="inline">
<h1 xmlns="http://www.w3.org/1999/xhtml" id="chapter_1">
<h3 xmlns="http://www.w3.org/1999/xhtml" id="chapter_1">
<em>CHAPTER 1</em> <em>THE LAST JUDGEMENT (MICHAEL ANGELO)</em>
</h1>
</h3>
</x:document>
</x:expect>
</x:scenario>
Expand All @@ -182,17 +182,16 @@
<x:context label="the result HTML file">
<x:document type="file" base-uri="temp-dir" href="dtbook110/output-dir/dtbook110.epub!/EPUB/dtbook110-1.xhtml"/>
</x:context>
<x:expect label="the result HTML file"
type="custom" href="http://www.daisy.org/xprocspec/custom-assertion-steps.xpl" step="x:compare-except-ids">
<x:expect label="the result HTML file" type="compare">
<x:document type="inline">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta charset="UTF-8"/>
<title>Title</title>
</head>
<body id="a" epub:type="frontmatter">
<section id="b">
<h1 id="c" epub:type="title">Title</h1>
<body id="id_3" epub:type="frontmatter">
<section id="id_4">
<h3 id="id_5" epub:type="title">Title</h3>
</section>
</body>
</html>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@
<x:document type="inline">
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0"
xmlns:epub="http://www.idpf.org/2007/ops">
<body epub:textref="../minimal-1.xhtml#id_2" epub:type="frontmatter">
<body epub:textref="../minimal-1.xhtml#id_4" epub:type="frontmatter">
<seq epub:textref="../minimal-1.xhtml#id_1">
<seq epub:textref="../minimal-1.xhtml#id_3" epub:type="title">
<seq epub:textref="../minimal-1.xhtml#id_5" epub:type="title">
<par>
<text src="../minimal-1.xhtml#st1-1"/>
<audio src="../audio/part0000_00_000.wav" clipBegin="0:00:00.000" clipEnd="0:00:00.578"/>
Expand All @@ -185,9 +185,9 @@
<x:document type="inline">
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0"
xmlns:epub="http://www.idpf.org/2007/ops">
<body epub:textref="../minimal-2.xhtml#id_1" epub:type="bodymatter">
<body epub:textref="../minimal-2.xhtml#id_6" epub:type="bodymatter">
<seq epub:textref="../minimal-2.xhtml#id_2">
<seq epub:textref="../minimal-2.xhtml#id_3">
<seq epub:textref="../minimal-2.xhtml#id_7">
<par>
<text src="../minimal-2.xhtml#st2-1"/>
<audio src="../audio/part0001_00_000.wav" clipBegin="0:00:00.000" clipEnd="0:00:00.565"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
<meta charset="UTF-8"/>
<title>Minimal DTBook</title>
</head>
<body>
<section xmlns:epub="http://www.idpf.org/2007/ops" epub:type="frontmatter">
<section id="a">
<h1 epub:type="title">Minimal DTBook</h1>
<body id="id_3">
<section id="id_4" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="frontmatter">
<section id="id_1">
<h3 id="id_5" epub:type="title">Minimal DTBook</h3>
<p>Bert</p>
</section>
</section>
<section xmlns:epub="http://www.idpf.org/2007/ops" epub:type="bodymatter">
<section id="b">
<section id="id_6" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="bodymatter">
<section id="id_2">
<span epub:type="pagebreak" title="1" id="page_1"/>
<h1>Chapter</h1>
<h3 id="id_7">Chapter</h3>
<p>Paragraph</p>
<span epub:type="pagebreak" title="2" id="page_2"/>
<p>Another paragraph</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,24 @@
<x:context label="the result HTML">
<x:document type="port" port="result.in-memory" select="/*[base-uri()=resolve-uri('result/minimal.xhtml')]"/>
</x:context>
<x:expect label="the output HTML"
type="custom" href="http://www.daisy.org/xprocspec/custom-assertion-steps.xpl" step="x:compare-except-ids">
<x:expect label="the output HTML" type="compare">
<x:document type="inline">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta charset="UTF-8"/>
<title>Minimal DTBook</title>
</head>
<body>
<section xmlns:epub="http://www.idpf.org/2007/ops" epub:type="frontmatter">
<section id="a">
<h1 epub:type="title">Minimal DTBook</h1>
<body id="id_3">
<section id="id_4" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="frontmatter">
<section id="id_1">
<h3 id="id_5" epub:type="title">Minimal DTBook</h3>
<p>Bert</p>
</section>
</section>
<section xmlns:epub="http://www.idpf.org/2007/ops" epub:type="bodymatter">
<section id="b">
<section id="id_6" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="bodymatter">
<section id="id_2">
<span epub:type="pagebreak" title="1" id="page_1"/>
<h1>Chapter</h1>
<h3 id="id_7">Chapter</h3>
<p>Paragraph</p>
<span epub:type="pagebreak" title="2" id="page_2"/>
<p>Another paragraph</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@
</x:document>
</x:expect>
<x:context label="the content file">
<x:document type="file" base-uri="temp-dir" href="issue-94/output-dir/test_zedai-to-epub3.script.epub!/EPUB/test_zedai-to-epub3.script.xhtml" select="//html:h1[1]"/>
<x:document type="file" base-uri="temp-dir" href="issue-94/output-dir/test_zedai-to-epub3.script.epub!/EPUB/test_zedai-to-epub3.script.xhtml" select="//(html:h1|html:h2|html:h3|html:h4|html:h5|html:h6)[1]"/>
</x:context>
<x:expect label="the white space in between the 'em' elements should be preserved" type="compare" normalize-space="false">
<x:document type="inline">
<h1 xmlns="http://www.w3.org/1999/xhtml" id="chapter_1">
<h3 xmlns="http://www.w3.org/1999/xhtml" id="chapter_1">
<em>CHAPTER 1</em> <em>THE LAST JUDGEMENT (MICHAEL ANGELO)</em>
</h1>
</h3>
</x:document>
</x:expect>
</x:scenario>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
</x:context>
<x:expect label="the toc in the alice-1.xhtml file" type="compare">
<x:document type="inline">
<nav xmlns="http://www.w3.org/1999/xhtml" epub:type="toc">
<h1>Contents</h1>
<nav xmlns="http://www.w3.org/1999/xhtml" id="id_17" epub:type="toc">
<h3 id="id_18">Contents</h3>
<ul>
<li>
I. Down the Rabbit-Hole <a href="alice-2.xhtml#p1">1</a>
Expand Down
2 changes: 1 addition & 1 deletion scripts/zedai-to-html/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>

<artifactId>zedai-to-html</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<packaging>bundle</packaging>

<name>DAISY Pipeline 2 module :: ZedAI to HTML</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<p:import href="http://www.daisy.org/pipeline/modules/html-utils/library.xpl">
<p:documentation>
px:html-chunker
px:html-outline
</p:documentation>
</p:import>

Expand Down Expand Up @@ -116,6 +117,8 @@
<p:empty/>
</p:input>
</p:xslt>
<!-- zedai-to-html.xsl only uses h1 -->
<px:html-outline fix-heading-ranks="outline-depth"/>
<px:set-base-uri name="result">
<p:with-option name="base-uri" select="$result-basename"/>
</px:set-base-uri>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@
<x:option name="output-dir" select="resolve-uri('issue-94/output-dir/',$temp-dir)"/>
</x:call>
<x:context label="the html file">
<x:document type="file" base-uri="temp-dir" href="issue-94/output-dir/test_zedai-to-html.script.xhtml" select="//html:h1[1]"/>
<x:document type="file" base-uri="temp-dir" href="issue-94/output-dir/test_zedai-to-html.script.xhtml"
select="//(html:h1|html:h2|html:h3|html:h4|html:h5|html:h6)[1]"/>
</x:context>
<x:expect label="the white space in between the 'em' elements should be preserved" type="compare" normalize-space="false">
<x:document type="inline">
<h1 xmlns="http://www.w3.org/1999/xhtml" id="chapter_1">
<h3 xmlns="http://www.w3.org/1999/xhtml" id="chapter_1">
<em>CHAPTER 1</em> <em>THE LAST JUDGEMENT (MICHAEL ANGELO)</em>
</h1>
</h3>
</x:document>
</x:expect>
</x:scenario>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,49 @@
<x:document type="inline">
<d:fileset xmlns:d="http://www.daisy.org/ns/pipeline/data">
<d:file href="output-dir/alice-1.xhtml" original-href="../resources/resources/alice.xml">
<d:anchor id="id_5"/>
<d:anchor id="id_4"/>
<d:anchor id="id_7"/>
<d:anchor id="id_6"/>
<d:anchor id="id_9"/>
<d:anchor id="id_8"/>
<d:anchor id="id_13"/>
<d:anchor id="id_14"/>
<d:anchor id="id_11"/>
<d:anchor id="id_12"/>
<d:anchor id="id_10"/>
<d:anchor id="id_17"/>
<d:anchor id="id_18"/>
<d:anchor id="id_3"/>
<d:anchor id="id_15"/>
<d:anchor id="id_2"/>
<d:anchor id="id_16"/>
<d:anchor id="img_1"/>
</d:file>
<d:file href="output-dir/alice-2.xhtml" original-href="../resources/resources/alice.xml">
<d:anchor id="id_24"/>
<d:anchor id="id_25"/>
<d:anchor id="id_22"/>
<d:anchor id="p14"/>
<d:anchor id="id_23"/>
<d:anchor id="p13"/>
<d:anchor id="id_20"/>
<d:anchor id="id_21"/>
<d:anchor id="id_28"/>
<d:anchor id="id_29"/>
<d:anchor id="id_26"/>
<d:anchor id="id_27"/>
<d:anchor id="p1"/>
<d:anchor id="img_4"/>
<d:anchor id="img_2"/>
<d:anchor id="img_3"/>
<d:anchor id="p14"/>
<d:anchor id="p13"/>
<d:anchor id="id_33"/>
<d:anchor id="id_34"/>
<d:anchor id="id_31"/>
<d:anchor id="id_32"/>
<d:anchor id="id_30"/>
</d:file>
<d:file href="output-dir/alice-3.xhtml" original-href="../resources/resources/alice.xml">
<d:anchor id="img_6"/>
<d:anchor id="img_7"/>
<d:anchor id="img_5"/>
<d:anchor id="img_8"/>
<d:anchor id="p16"/>
<d:anchor id="p15"/>
<d:anchor id="p18"/>
Expand All @@ -109,8 +137,18 @@
<d:anchor id="p24"/>
<d:anchor id="p27"/>
<d:anchor id="p26"/>
<d:anchor id="img_6"/>
<d:anchor id="img_7"/>
<d:anchor id="img_5"/>
<d:anchor id="img_8"/>
<d:anchor id="id_35"/>
<d:anchor id="id_36"/>
<d:anchor id="id_37"/>
</d:file>
<d:file href="output-dir/alice-4.xhtml" original-href="../resources/resources/alice.xml">
<d:anchor id="p29"/>
<d:anchor id="id_19"/>
<d:anchor id="id_1"/>
<d:anchor id="img_10"/>
<d:anchor id="img_9"/>
<d:anchor id="p32"/>
Expand All @@ -121,9 +159,11 @@
<d:anchor id="p35"/>
<d:anchor id="p38"/>
<d:anchor id="p37"/>
<d:anchor id="id_40"/>
<d:anchor id="p39"/>
<d:anchor id="p40"/>
<d:anchor id="p29"/>
<d:anchor id="id_39"/>
<d:anchor id="id_38"/>
</d:file>
</d:fileset>
</x:document>
Expand Down

0 comments on commit 21294fb

Please sign in to comment.