Skip to content

Commit 74da8b8

Browse files
author
Sanders Kleinfeld
committed
Merge branch 'master' of github.com:oreillymedia/HTMLBook into xspec
2 parents ed83896 + 859486b commit 74da8b8

File tree

15 files changed

+1494
-276
lines changed

15 files changed

+1494
-276
lines changed

README.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
=== HTMLBook
22

3-
Let's write books in HTML! HTMLBook is an open, HTML5-based standard for the authoring and production of both print and digital books. HTMLBook is built on the following premises:
3+
Let's write books in HTML! HTMLBook is an open, XHTML5-based standard for the authoring and production of both print and digital books. HTMLBook is built on the following premises:
44

55
* Books are timeless. The basic "book" structure has persisted for hundreds of years and will continue to persist for our lifetimes, be it in digital or print form.
66
* HTML is the markup language of the world for the foreseeable future.
77
* Single-source document processing will remain valuable for the foreseeable future.
88
99
As such, HTMLBook can be characterized in the following ways:
1010

11-
* HTMLBook is a subset of XHTML5. All HTMLBook is HTML5, but not all HTML5 is HTMLBook.
12-
* HTMLBook contains no additional elements or attributes outside of the HTML5 specification.
11+
* HTMLBook is a subset of XHTML5. All HTMLBook is XHTML5, but not all XHTML5 is HTMLBook.
12+
* HTMLBook contains no additional elements or attributes outside of the XHTML5 specification.
1313
* HTMLBook is semantically tailored to the structure of a book, including more complex content used in technical and reference documents.
1414
* HTMLBook is defined with and can be validated against an XML schema.
1515
* HTMLBook stylesheets are written in CSS.

htmlbook-xsl/common.xsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,22 +292,22 @@
292292
<xsl:choose>
293293
<!-- I wish XSL allowed variables in @format attribute -->
294294
<xsl:when test="$calculated-numeration-format = '1'">
295-
<xsl:number count="*[@data-type = $data-type]" format="1"/>
295+
<xsl:number count="*[@data-type = $data-type]" format="1" level="any"/>
296296
</xsl:when>
297297
<xsl:when test="$calculated-numeration-format = '01'">
298-
<xsl:number count="*[@data-type = $data-type]" format="01"/>
298+
<xsl:number count="*[@data-type = $data-type]" format="01" level="any"/>
299299
</xsl:when>
300300
<xsl:when test="$calculated-numeration-format = 'a'">
301-
<xsl:number count="*[@data-type = $data-type]" format="a"/>
301+
<xsl:number count="*[@data-type = $data-type]" format="a" level="any"/>
302302
</xsl:when>
303303
<xsl:when test="$calculated-numeration-format = 'A'">
304-
<xsl:number count="*[@data-type = $data-type]" format="A"/>
304+
<xsl:number count="*[@data-type = $data-type]" format="A" level="any"/>
305305
</xsl:when>
306306
<xsl:when test="$calculated-numeration-format = 'i'">
307-
<xsl:number count="*[@data-type = $data-type]" format="i"/>
307+
<xsl:number count="*[@data-type = $data-type]" format="i" level="any"/>
308308
</xsl:when>
309309
<xsl:when test="$calculated-numeration-format = 'I'">
310-
<xsl:number count="*[@data-type = $data-type]" format="I"/>
310+
<xsl:number count="*[@data-type = $data-type]" format="I" level="any"/>
311311
</xsl:when>
312312
<xsl:when test="$calculated-numeration-format = 'none'"/>
313313
<xsl:otherwise>

htmlbook-xsl/localizations/en.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -477,18 +477,18 @@
477477
<l:template name="pageabbrev" text="(p. %p)"/>
478478
<l:template name="Page" text="Page %p"/>
479479
<l:template name="topic" text="%t"/>
480-
<l:template name="bridgehead" text="the section called “%t”"/>
481-
<l:template name="refsection" text="the section called “%t”"/>
482-
<l:template name="refsect1" text="the section called “%t”"/>
483-
<l:template name="refsect2" text="the section called “%t”"/>
484-
<l:template name="refsect3" text="the section called “%t”"/>
485-
<l:template name="sect1" text="the section called “%t”"/>
486-
<l:template name="sect2" text="the section called “%t”"/>
487-
<l:template name="sect3" text="the section called “%t”"/>
488-
<l:template name="sect4" text="the section called “%t”"/>
489-
<l:template name="sect5" text="the section called “%t”"/>
490-
<l:template name="section" text="the section called “%t”"/>
491-
<l:template name="simplesect" text="the section called “%t”"/>
480+
<l:template name="bridgehead" text="“%t”"/>
481+
<l:template name="refsection" text="“%t”"/>
482+
<l:template name="refsect1" text="“%t”"/>
483+
<l:template name="refsect2" text="“%t”"/>
484+
<l:template name="refsect3" text="“%t”"/>
485+
<l:template name="sect1" text="“%t”"/>
486+
<l:template name="sect2" text="“%t”"/>
487+
<l:template name="sect3" text="“%t”"/>
488+
<l:template name="sect4" text="“%t”"/>
489+
<l:template name="sect5" text="“%t”"/>
490+
<l:template name="section" text="“%t”"/>
491+
<l:template name="simplesect" text="“%t”"/>
492492
</l:context>
493493
<l:context name="xref-number"><l:template name="answer" text="A: %n"/>
494494
<l:template name="appendix" text="Appendix %n"/>
@@ -521,17 +521,17 @@
521521
<l:template name="procedure" text="Procedure %n, “%t”"/>
522522
<l:template name="productionset" text="Production %n, “%t”"/>
523523
<l:template name="qandadiv" text="Q &amp; A %n, “%t”"/>
524-
<l:template name="refsect1" text="the section called “%t”"/>
525-
<l:template name="refsect2" text="the section called “%t”"/>
526-
<l:template name="refsect3" text="the section called “%t”"/>
527-
<l:template name="refsection" text="the section called “%t”"/>
524+
<l:template name="refsect1" text="“%t”"/>
525+
<l:template name="refsect2" text="“%t”"/>
526+
<l:template name="refsect3" text="“%t”"/>
527+
<l:template name="refsection" text="“%t”"/>
528528
<l:template name="sect1" text="Section %n, “%t”"/>
529529
<l:template name="sect2" text="Section %n, “%t”"/>
530530
<l:template name="sect3" text="Section %n, “%t”"/>
531531
<l:template name="sect4" text="Section %n, “%t”"/>
532532
<l:template name="sect5" text="Section %n, “%t”"/>
533533
<l:template name="section" text="Section %n, “%t”"/>
534-
<l:template name="simplesect" text="the section called “%t”"/>
534+
<l:template name="simplesect" text="“%t”"/>
535535
<l:template name="table" text="Table %n, “%t”"/>
536536
</l:context>
537537
<l:context name="authorgroup"><l:template name="sep" text=", "/>

htmlbook-xsl/xspec/common.xspec

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
xmlns:h="http://www.w3.org/1999/xhtml"
77
stylesheet="../htmlbook.xsl">
88

9+
<x:param name="label.numeration.by.data-type">
10+
appendix:A
11+
chapter:1
12+
part:I
13+
sect1:a
14+
sect2:none
15+
sect3:none
16+
sect4:none
17+
sect5:none
18+
</x:param>
19+
920
<!-- Test suite for common.xsl -->
1021

1122
<!-- Title markup tests -->
@@ -32,6 +43,191 @@
3243
<x:expect label="Copy the child content of the first h1-h6 as is">XPath <em>is</em> <strong>the bestest</strong></x:expect>
3344
</x:scenario>
3445

46+
<!-- Label markup tests -->
47+
<!-- This section's tests based on values in label.numeration.by.data-type global param -->
48+
<x:scenario label="When generating a label for a section (chapter)">
49+
<x:context mode="label.markup" select="/h:body/h:section[@data-type='chapter'][2]">
50+
<body>
51+
<section data-type="chapter">
52+
<h1>First one!</h1>
53+
<p>Yup!</p>
54+
</section>
55+
<section data-type="chapter">
56+
<h1>Second one!</h1>
57+
<p>Yeah!</p>
58+
</section>
59+
<section data-type="appendix">
60+
<h1>Appendix, yo!</h1>
61+
<p>You betcha!</p>
62+
</section>
63+
</body>
64+
</x:context>
65+
<!-- check the result -->
66+
<x:expect label="The appropriate numeration value should be generated">2</x:expect>
67+
</x:scenario>
68+
69+
<x:scenario label="When generating a label for a part div">
70+
<x:context mode="label.markup" select="/h:body/h:div[@data-type='part'][3]">
71+
<body>
72+
<div data-type="part">
73+
<h1>Prefaces!</h1>
74+
<section data-type="preface">
75+
<h1>First one!</h1>
76+
<p>Yup!</p>
77+
</section>
78+
</div>
79+
<div data-type="part">
80+
<h1>Chapters!</h1>
81+
<section data-type="chapter">
82+
<h1>Love this sample markup!</h1>
83+
<p>Oh yeah!</p>
84+
</section>
85+
</div>
86+
<div data-type="part">
87+
<h1>Appendixes</h1>
88+
<section data-type="appendix">
89+
<h1>Why plural? There's only one here!</h1>
90+
<p>D'oh!</p>
91+
</section>
92+
</div>
93+
</body>
94+
</x:context>
95+
<!-- check the result -->
96+
<x:expect label="The appropriate numeration value should be generated">III</x:expect>
97+
</x:scenario>
98+
99+
<x:scenario label="When generating a label for a lower-level section">
100+
<x:context mode="label.markup" select="/h:section[@data-type='chapter']/h:section[@data-type='sect1'][1]">
101+
<section data-type="chapter">
102+
<h1>Lots of sect1s in this one</h1>
103+
<section data-type="sect1">
104+
<h1>First subheading</h1>
105+
<p>Un!</p>
106+
</section>
107+
<section data-type="sect1">
108+
<h1>Second subheading</h1>
109+
<p>Deux!</p>
110+
</section>
111+
<section data-type="sect1">
112+
<h1>Third subheading</h1>
113+
<p>Trois!</p>
114+
</section>
115+
</section>
116+
</x:context>
117+
<!-- check the result -->
118+
<x:expect label="The appropriate numeration value should be generated">a</x:expect>
119+
</x:scenario>
120+
121+
<x:scenario label="When generating a label for a section with no label specified in params">
122+
<x:context mode="label.markup" select="/h:section[@data-type='chapter']/h:section[@data-type='sect1'][2]/h:section[@data-type='sect2'][1]">
123+
<section data-type="chapter">
124+
<h1>Lots of sect1s in this one</h1>
125+
<section data-type="sect1">
126+
<h1>First subheading</h1>
127+
<p>Un!</p>
128+
</section>
129+
<section data-type="sect1">
130+
<h1>Second subheading</h1>
131+
<p>Deux!</p>
132+
<section data-type="sect2">
133+
<h2>Sub-subheading</h2>
134+
<p>Woohoo!</p>
135+
</section>
136+
</section>
137+
<section data-type="sect1">
138+
<h1>Third subheading</h1>
139+
<p>Trois!</p>
140+
</section>
141+
</section>
142+
</x:context>
143+
<!-- check the result -->
144+
<x:expect label="The appropriate numeration value should be generated" select="()"/>
145+
</x:scenario>
146+
147+
<x:scenario label="When generating a label for a section (chapter) in a part">
148+
<x:context mode="label.markup" select="/h:body/h:div[@data-type='part'][2]/h:section[@data-type='chapter'][1]">
149+
<body>
150+
<div data-type="part">
151+
<h1>First set o chapters!</h1>
152+
<section data-type="chapter">
153+
<h1>First one!</h1>
154+
<p>Yup!</p>
155+
</section>
156+
<section data-type="chapter">
157+
<h1>Second one!</h1>
158+
<p>Oh yeah!</p>
159+
</section>
160+
</div>
161+
<div data-type="part">
162+
<h1>Second set o chapters</h1>
163+
<section data-type="chapter">
164+
<h1>Third one!</h1>
165+
<p>Hooray!</p>
166+
</section>
167+
</div>
168+
</body>
169+
</x:context>
170+
<x:expect label="The appropriate numeration value should be generated (absolute, not relative to part)">3</x:expect>
171+
</x:scenario>
172+
173+
<x:pending>
174+
175+
<x:scenario label="When generating a label for a part div with label.section.with.ancestors enabled">
176+
<x:context>
177+
</x:context>
178+
<x:expect label="The appropriate numeration value should be generated"/>
179+
</x:scenario>
180+
181+
<x:scenario label="When generating a label for a section (chapter) with label.section.with.ancestors enabled">
182+
<x:context>
183+
</x:context>
184+
<x:expect label="The appropriate numeration value should be generated"/>
185+
</x:scenario>
186+
187+
<x:scenario label="When generating a label for a section (subsection) with label.section.with.ancestors enabled">
188+
<x:context>
189+
</x:context>
190+
<x:expect label="The appropriate numeration value should be generated"/>
191+
</x:scenario>
192+
193+
<x:scenario label="When generating a label for a figure">
194+
<x:context>
195+
</x:context>
196+
<x:expect label="The appropriate numeration value should be generated"/>
197+
</x:scenario>
198+
199+
<x:scenario label="When generating a label for a figure (label.formal.with.ancestor = false)">
200+
<x:context>
201+
</x:context>
202+
<x:expect label="The appropriate numeration value should be generated"/>
203+
</x:scenario>
204+
205+
<x:scenario label="When generating a label for a table">
206+
<x:context>
207+
</x:context>
208+
<x:expect label="The appropriate numeration value should be generated"/>
209+
</x:scenario>
210+
211+
<x:scenario label="When generating a label for a table (label.formal.with.ancestor = false)">
212+
<x:context>
213+
</x:context>
214+
<x:expect label="The appropriate numeration value should be generated"/>
215+
</x:scenario>
216+
217+
<x:scenario label="When generating a label for an example">
218+
<x:context>
219+
</x:context>
220+
<x:expect label="The appropriate numeration value should be generated"/>
221+
</x:scenario>
222+
223+
<x:scenario label="When generating a label for an example (label.formal.with.ancestor = false)">
224+
<x:context>
225+
</x:context>
226+
<x:expect label="The appropriate numeration value should be generated"/>
227+
</x:scenario>
228+
229+
</x:pending>
230+
35231
<!-- Heading processing templates -->
36232
<x:scenario label="When process-headings is run on a section heading with $autogenerate.labels turned off">
37233
<x:context mode="process-heading" select="/h:section/h:h1">

poster.png

-73.7 KB
Binary file not shown.

samples/htmlbook.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ <h3>Lists</h3>
199199
<h3>Images</h3>
200200
<p>Images use the <code>figure</code>, which can optionally have a caption.</p>
201201
<figure id="robot_unicorn">
202-
<figcaption><span data-type="label">Figure 1-1.</span> A robot unicorn</figcaption>
203-
<img src="images/robot-unicorn.jpg"
204-
alt="Illustration of a unicorn running. The unicorn has a metallic coat, with a flowing, rainbow-colored tail and mane."
205-
/>
202+
<figcaption>Penguin in Raincoat (by Moini:
203+
<a href="http://openclipart.org/detail/189837/penguin-in-the-rain-by-moini-189837">openclipart source</a>)</figcaption>
204+
<img src="images/rain_penguin.png"
205+
alt="Illustration of a penguin in a raincoat. The penguin is in a yellow raincoat, with matching yellow hat, and is wearing galoshes."/>
206206
</figure>
207207
</section>
208208
<section data-type="sect3" class="sect3" id="tables">

samples/images/rain_penguin.png

396 KB
Loading

samples/images/robot-unicorn.jpg

-69.5 KB
Binary file not shown.

samples/markdown/README

Lines changed: 0 additions & 1 deletion
This file was deleted.

samples/markdown/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This directory contains a sample Markdown document (`open_government_sample.md`)
2+
and how the corresponding content should be converted to HTMLBook (`open_government_sample.html`).
3+
4+
See https://github.com/oreillymedia/htmlbook.js for open source tooling for converting Markdown to HTMLBook.

0 commit comments

Comments
 (0)