mirror of
https://github.com/standardebooks/web.git
synced 2025-07-05 22:30:30 -04:00
116 lines
28 KiB
PHP
116 lines
28 KiB
PHP
<?
|
||
require_once('Core.php');
|
||
?><?= Template::Header(['title' => '4. Semantics - The Standard Ebooks Manual', 'highlight' => 'contribute', 'manual' => true]) ?>
|
||
<main class="manual"><nav><p><a href="/manual/1.0.0">The Standard Ebooks Manual of Style</a></p><ol><li><p><a href="/manual/1.0.0/1-code-style">1. XHTML, CSS, and SVG Code Style</a></p><ol><li><p><a href="/manual/1.0.0/1-code-style#1.1">1.1 XHTML formatting</a></p></li><li><p><a href="/manual/1.0.0/1-code-style#1.2">1.2 CSS formatting</a></p></li><li><p><a href="/manual/1.0.0/1-code-style#1.3">1.3 SVG Formatting</a></p></li><li><p><a href="/manual/1.0.0/1-code-style#1.4">1.4 Commits and Commit Messages</a></p></li></ol></li><li><p><a href="/manual/1.0.0/2-filesystem">2. Filesystem Layout and File Naming Conventions</a></p><ol><li><p><a href="/manual/1.0.0/2-filesystem#2.1">2.1 File locations</a></p></li><li><p><a href="/manual/1.0.0/2-filesystem#2.2">2.2 XHTML file naming conventions</a></p></li><li><p><a href="/manual/1.0.0/2-filesystem#2.3">2.3 The se-lint-ignore.xml file</a></p></li></ol></li><li><p><a href="/manual/1.0.0/3-the-structure-of-an-ebook">3. The Structure of an Ebook</a></p><ol><li><p><a href="/manual/1.0.0/3-the-structure-of-an-ebook#3.1">3.1 Front matter</a></p></li><li><p><a href="/manual/1.0.0/3-the-structure-of-an-ebook#3.2">3.2 Body matter</a></p></li><li><p><a href="/manual/1.0.0/3-the-structure-of-an-ebook#3.3">3.3 Back matter</a></p></li></ol></li><li><p><a href="/manual/1.0.0/4-semantics">4. Semantics</a></p><ol><li><p><a href="/manual/1.0.0/4-semantics#4.1">4.1 Semantic Elements</a></p></li><li><p><a href="/manual/1.0.0/4-semantics#4.2">4.2 Semantic Inflection</a></p></li></ol></li><li><p><a href="/manual/1.0.0/5-general-xhtml-patterns">5. General XHTML Patterns</a></p><ol><li><p><a href="/manual/1.0.0/5-general-xhtml-patterns#5.1">5.1 id attributes</a></p></li><li><p><a href="/manual/1.0.0/5-general-xhtml-patterns#5.2">5.2 class attributes</a></p></li><li><p><a href="/manual/1.0.0/5-general-xhtml-patterns#5.3">5.3 xml:lang attributes</a></p></li><li><p><a href="/manual/1.0.0/5-general-xhtml-patterns#5.4">5.4 The <title> element</a></p></li><li><p><a href="/manual/1.0.0/5-general-xhtml-patterns#5.5">5.5 Ordered/numbered and unordered lists</a></p></li><li><p><a href="/manual/1.0.0/5-general-xhtml-patterns#5.6">5.6 Tables</a></p></li></ol></li><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns">6. Standard Ebooks Section Patterns</a></p><ol><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns#6.1">6.1 The title string</a></p></li><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns#6.2">6.2 The table of contents</a></p></li><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns#6.3">6.3 The titlepage</a></p></li><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns#6.4">6.4 The imprint</a></p></li><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns#6.5">6.5 The half title page</a></p></li><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns#6.6">6.6 The colophon</a></p></li><li><p><a href="/manual/1.0.0/6-standard-ebooks-section-patterns#6.7">6.7 The Uncopyright</a></p></li></ol></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns">7. High Level Structural Patterns</a></p><ol><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.1">7.1 Sectioning</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.2">7.2 Headers</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.3">7.3 Dedications</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.4">7.4 Epigraphs</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.5">7.5 Poetry, verse, and songs</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.6">7.6 Plays and drama</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.7">7.7 Letters</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.8">7.8 Images</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.9">7.9 List of Illustrations (the LoI)</a></p></li><li><p><a href="/manual/1.0.0/7-high-level-structural-patterns#7.10">7.10 Endnotes</a></p></li></ol></li><li><p><a href="/manual/1.0.0/8-typography">8. Typography</a></p><ol><li><p><a href="/manual/1.0.0/8-typography#8.1">8.1 Section titles and ordinals</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.2">8.2 Italics</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.3">8.3 Capitalization</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.4">8.4 Indentation</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.5">8.5 Chapter headers</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.6">8.6 Ligatures</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.7">8.7 Punctuation and spacing</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.8">8.8 Numbers, measurements, and math</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.9">8.9 Latinisms</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.10">8.10 Initials and abbreviations</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.11">8.11 Times</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.12">8.12 Chemicals and compounds</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.13">8.13 Temperatures</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.14">8.14 Scansion</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.15">8.15 Legal cases and terms</a></p></li><li><p><a href="/manual/1.0.0/8-typography#8.16">8.16 Morse code</a></p></li></ol></li><li><p><a href="/manual/1.0.0/9-metadata">9. Metadata</a></p><ol><li><p><a href="/manual/1.0.0/9-metadata#9.1">9.1 General URL rules</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.2">9.2 The ebook identifier</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.3">9.3 Publication date and release identifiers</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.4">9.4 Book titles</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.5">9.5 Book subjects</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.6">9.6 Book descriptions</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.7">9.7 Book language</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.8">9.8 Book transcription and page scan sources</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.9">9.9 Additional book metadata</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.10">9.10 General contributor rules</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.11">9.11 The author metadata block</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.12">9.12 The translator metadata block</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.13">9.13 The illustrator metadata block</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.14">9.14 The cover artist metadata block</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.15">9.15 Metadata for additional contributors</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.16">9.16 Transcriber metadata</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.17">9.17 Producer metadata</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.18">9.18 The ebook manifest</a></p></li><li><p><a href="/manual/1.0.0/9-metadata#9.19">9.19 The ebook spine</a></p></li></ol></li><li><p><a href="/manual/1.0.0/10-art-and-images">10. Art and Images</a></p><ol><li><p><a href="/manual/1.0.0/10-art-and-images#10.1">10.1 Complete list of files</a></p></li><li><p><a href="/manual/1.0.0/10-art-and-images#10.2">10.2 SVG patterns</a></p></li><li><p><a href="/manual/1.0.0/10-art-and-images#10.3">10.3 The cover image</a></p></li><li><p><a href="/manual/1.0.0/10-art-and-images#10.4">10.4 The titlepage image</a></p></li></ol></li></ol></nav>
|
||
<article>
|
||
|
||
<section id="4"><aside class="number">4</aside>
|
||
<h1>Semantics</h1>
|
||
<p>Semantics convey what an element or section <em>mean</em> or <em>are</em>, instead of merely conveying <em>how they are visually presented</em>.</p>
|
||
<p>For example, the following snippet visually presents a paragraph, followed by a quotation from a poem:</p>
|
||
<figure><code class="html full"><span class="p"><</span><span class="nt">div</span><span class="p">></span>“All done in the tying of a cravat,” Sir Percy had declared to his clique of admirers.<span class="p"></</span><span class="nt">div</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">div</span> <span class="na">style</span><span class="o">=</span><span class="s">"margin: 1em;"</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">div</span><span class="p">></span>“We seek him here, we seek him there,<span class="p"><</span><span class="nt">br</span><span class="p">/></span>
|
||
Those Frenchies seek him everywhere.<span class="p"><</span><span class="nt">br</span><span class="p">/></span>
|
||
Is he in heaven?—Is he in hell,<span class="p"><</span><span class="nt">br</span><span class="p">/></span>
|
||
That demmed, elusive Pimpernel?”<span class="p"></</span><span class="nt">div</span><span class="p">></span>
|
||
<span class="p"></</span><span class="nt">div</span><span class="p">></span></code></figure>
|
||
<p>While that snippet might <em>visually</em> present the text as a paragraph followed by a quotation of verse, the actual HTML tells us nothing about <em>what these lines of text actually are</em>.</p>
|
||
<p>Compare the above snippet to this next snippet, which renders almost identically but uses semantically-correct elements and epub’s semantic inflection to tell us <em>what the text is</em>:</p>
|
||
<figure><code class="html full"><span class="p"><</span><span class="nt">p</span><span class="p">></span>“All done in the tying of a cravat,” Sir Percy had declared to his clique of admirers.<span class="p"></</span><span class="nt">p</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">blockquote</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"z3998:poem"</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">p</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">span</span><span class="p">></span>“We seek him here, we seek him there,<span class="p"></</span><span class="nt">span</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">br</span><span class="p">/></span>
|
||
<span class="p"><</span><span class="nt">span</span><span class="p">></span>Those Frenchies seek him everywhere.<span class="p"></</span><span class="nt">span</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">br</span><span class="p">/></span>
|
||
<span class="p"><</span><span class="nt">span</span><span class="p">></span>Is he in heaven?—Is he in hell,<span class="p"></</span><span class="nt">span</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">br</span><span class="p">/></span>
|
||
<span class="p"><</span><span class="nt">span</span><span class="p">></span>That demmed, elusive Pimpernel?”<span class="p"></</span><span class="nt">span</span><span class="p">></span>
|
||
<span class="p"></</span><span class="nt">p</span><span class="p">></span>
|
||
<span class="p"></</span><span class="nt">blockquote</span><span class="p">></span></code></figure>
|
||
<p>By inspecting the elements above, we can see that the first line is a semantic paragraph (<code class="html"><span class="p"><</span><span class="nt">p</span><span class="p">></span></code> stands for <strong>p</strong>aragraph, of course); the paragraph is followed by a semantic block quotation, which browsers automatically render with a margin; the quotation is a poem; the poem has one stanza; and there are four lines in the poem. (By SE convention, <code class="html"><span class="p"><</span><span class="nt">p</span><span class="p">></span></code> elements in verse are stanzas and <code class="html"><span class="p"><</span><span class="nt">span</span><span class="p">></span></code> elements are lines.)</p>
|
||
<section id="4.1"><aside class="number">4.1</aside>
|
||
<h2>Semantic Elements</h2>
|
||
<p>Epub allows for the use of the full range of elements in the HTML5 spec. Each element has a semantic meaning, and each element in a Standard Ebook is carefully considered before use.</p>
|
||
<p>Below is an incomplete list of HTML5 elements and their semantic meanings. These are some of the most common elements encountered in an ebook.</p>
|
||
<section id="4.1.1"><aside class="number">4.1.1</aside>
|
||
<h3>Block-level elements</h3>
|
||
<p>Block-level elements are by default rendered with <code class="css"><span class="p">{</span> <span class="k">display</span><span class="p">:</span> <span class="kc">block</span><span class="p">;</span> <span class="p">}</span></code>. See the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements">complete list of block-level elements</a>.</p>
|
||
<ol type="1">
|
||
<li id="4.1.1.1"><aside class="number">4.1.1.1</aside><p>Sectioning block-level elements denote major structural divisions in a work.
|
||
</p><ol type="1">
|
||
<li id="4.1.1.1.1"><aside class="number">4.1.1.1.1</aside><p><code class="html"><span class="p"><</span><span class="nt">body</span><span class="p">></span></code>: The top-level element in any XHTML file. Must contain a direct child that is either a <code class="html"><span class="p"><</span><span class="nt">section</span><span class="p">></span></code> or <code class="html"><span class="p"><</span><span class="nt">article</span><span class="p">></span></code>.</p></li>
|
||
<li id="4.1.1.1.2"><aside class="number">4.1.1.1.2</aside><p><code class="html"><span class="p"><</span><span class="nt">section</span><span class="p">></span></code>: A major structural division in a work. Typically a part, volume, chapter, or subchapter. Semantically a <code class="html"><span class="p"><</span><span class="nt">section</span><span class="p">></span></code> cannot stand alone, but is part of a larger work.</p></li>
|
||
<li id="4.1.1.1.3"><aside class="number">4.1.1.1.3</aside><p><code class="html"><span class="p"><</span><span class="nt">article</span><span class="p">></span></code>: An item in a larger work that could be pulled out of the work and serialized or syndicated separately. For example, a single poem in a poetry collection, or a single short story in a short story collection; but <em>not</em> a single poem in a larger novel.</p></li>
|
||
</ol>
|
||
</li>
|
||
<li id="4.1.1.2"><aside class="number">4.1.1.2</aside><p>Other block-level elements have well-defined semantic meanings.
|
||
</p><ol type="1">
|
||
<li id="4.1.1.2.1"><aside class="number">4.1.1.2.1</aside><p><code class="html"><span class="p"><</span><span class="nt">p</span><span class="p">></span></code>: A paragraph of text.</p></li>
|
||
<li id="4.1.1.2.2"><aside class="number">4.1.1.2.2</aside><p><code class="html"><span class="p"><</span><span class="nt">blockquote</span><span class="p">></span></code>: A quotation displayed on the block level. This may include non-speech “quotations” like business cards, headstones, telegrams, letters, and so on.</p></li>
|
||
<li id="4.1.1.2.3"><aside class="number">4.1.1.2.3</aside><p><code class="html"><span class="p"><</span><span class="nt">figure</span><span class="p">></span></code>: Encloses a photograph, chart, or illustration, represented with an <cite><img></cite> element. Optionally includes a <code class="html"><span class="p"><</span><span class="nt">figcaption</span><span class="p">></span></code> element for a context-appropriate caption.</p></li>
|
||
<li id="4.1.1.2.4"><aside class="number">4.1.1.2.4</aside><p><code class="html"><span class="p"><</span><span class="nt">figcaption</span><span class="p">></span></code>: Only appears as a child of <code class="html"><span class="p"><</span><span class="nt">figure</span><span class="p">></span></code>. Represents a context-appropriate caption for the sibling <code class="html"><span class="p"><</span><span class="nt">img</span><span class="p">></span></code>. A caption <em>is not the same</em> as an <code class="html"><span class="p"><</span><span class="nt">img</span><span class="p">></span></code> element’s <code class="html"><span class="na">alt</span></code> text. <code class="html"><span class="na">alt</span></code> text is strictly a textual description of the image used for screen readers, whereas <code class="html"><span class="p"><</span><span class="nt">figcaption</span><span class="p">></span></code> has more freedom in its contents, depending on its context.</p></li>
|
||
<li id="4.1.1.2.5"><aside class="number">4.1.1.2.5</aside><p><code class="html"><span class="p"><</span><span class="nt">header</span><span class="p">></span></code>: Denotes a header section applying to its direct parent. <code class="html"><span class="p"><</span><span class="nt">header</span><span class="p">></span></code> is typically found in sections where there is additional header content besides the section title, but can also be used in <code class="html"><span class="p"><</span><span class="nt">blockquote</span><span class="p">></span></code>s or other block-level elements that require header styling.</p></li>
|
||
<li id="4.1.1.2.6"><aside class="number">4.1.1.2.6</aside><p><code class="html"><span class="p"><</span><span class="nt">footer</span><span class="p">></span></code>: Denotes a footer section applying to its direct parent. Typically used to denote signatures in sections like prefaces, forewords, letters, telegrams, and so on.</p></li>
|
||
<li id="4.1.1.2.7"><aside class="number">4.1.1.2.7</aside><p><code class="html"><span class="p"><</span><span class="nt">hr</span><span class="p">></span></code>: Denotes a thematic break. <code class="html"><span class="p"><</span><span class="nt">hr</span><span class="p">></span></code> <em>is not used</em> any place a black border is desired; it <em>strictly denotes</em> a thematic break.</p></li>
|
||
<li id="4.1.1.2.8"><aside class="number">4.1.1.2.8</aside><p><code class="html"><span class="p"><</span><span class="nt">ol</span><span class="p">></span></code>: Denotes an ordered list. Ordered lists are automatically numbered by the renderer.</p></li>
|
||
<li id="4.1.1.2.9"><aside class="number">4.1.1.2.9</aside><p><code class="html"><span class="p"><</span><span class="nt">ul</span><span class="p">></span></code>: Denotes an unordered list. Ordered lists are bulleted by the renderer.</p></li>
|
||
<li id="4.1.1.2.10"><aside class="number">4.1.1.2.10</aside><p><code class="html"><span class="p"><</span><span class="nt">li</span><span class="p">></span></code>: Denotes an list item in a parent <code class="html"><span class="p"><</span><span class="nt">ol</span><span class="p">></span></code> or <code class="html"><span class="p"><</span><span class="nt">ul</span><span class="p">></span></code>.</p></li>
|
||
<li id="4.1.1.2.11"><aside class="number">4.1.1.2.11</aside><p><code class="html"><span class="p"><</span><span class="nt">table</span><span class="p">></span></code>: Denotes a tabular section, for example when displaying tabular data, or reports or charts where a tabular appearance is desired.</p></li>
|
||
</ol>
|
||
</li>
|
||
<li id="4.1.1.3"><aside class="number">4.1.1.3</aside><p><code class="html"><span class="p"><</span><span class="nt">div</span><span class="p">></span></code> elements are almost never appropriate, as they have no semantic meaning. However, they may in rare occasions be used to group related elements in a situation where no other semantic element is appropriate.</p></li>
|
||
</ol>
|
||
</section>
|
||
<section id="4.1.2"><aside class="number">4.1.2</aside>
|
||
<h3>Inline elements</h3>
|
||
<p>Inline elements are by default rendered with <code class="css"><span class="p">{</span> <span class="k">display</span><span class="p">:</span> <span class="kc">inline</span><span class="p">;</span> <span class="p">}</span></code>. See the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements">complete list of inline elements</a>.</p>
|
||
<ol type="1">
|
||
<li id="4.1.2.1"><aside class="number">4.1.2.1</aside><p><code class="html"><span class="p"><</span><span class="nt">em</span><span class="p">></span></code>: Text rendered in italics, with the semantic meaning of emphasized speech, or speech spoken in a different tone of voice; for example, a person shouting, or putting stress on a particular word.</p></li>
|
||
<li id="4.1.2.2"><aside class="number">4.1.2.2</aside><p><code class="html"><span class="p"><</span><span class="nt">i</span><span class="p">></span></code>: Text rendered in italics, without any explicit semantic meaning. Because <code class="html"><span class="p"><</span><span class="nt">i</span><span class="p">></span></code> lacks semantic meaning, the <code class="html"><span class="na">epub:type</span></code> attribute is added with appropriate semantic inflection to describe the contents of the element.
|
||
</p><figure class="corrected"><code class="html full"><span class="p"><</span><span class="nt">p</span><span class="p">></span>The <span class="p"><</span><span class="nt">abbr</span> <span class="na">class</span><span class="o">=</span><span class="s">"initialism"</span><span class="p">></span>HMS<span class="p"></</span><span class="nt">abbr</span><span class="p">></span> <span class="p"><</span><span class="nt">i</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"se:name.vessel.ship"</span><span class="p">></span>Bounty<span class="p"></</span><span class="nt">i</span><span class="p">></span>.<span class="p"></</span><span class="nt">p</span><span class="p">></span></code></figure>
|
||
</li>
|
||
<li id="4.1.2.3"><aside class="number">4.1.2.3</aside><p><code class="html"><span class="p"><</span><span class="nt">b</span><span class="p">></span></code>: Text rendered in small caps, without any explicit semantic meaning. Because <code class="html"><span class="p"><</span><span class="nt">b</span><span class="p">></span></code> lacks semantic meaning, the <code class="html"><span class="na">epub:type</span></code> attribute can be added with appropriate semantic inflection to describe the contents of the element; however, unlike <code class="html"><span class="p"><</span><span class="nt">i</span><span class="p">></span></code>, it’s rare for <code class="html"><span class="p"><</span><span class="nt">b</span><span class="p">></span></code> to require semantic meaning, as it is generally used only for visual styling.</p></li>
|
||
<li id="4.1.2.4"><aside class="number">4.1.2.4</aside><p><code class="html"><span class="p"><</span><span class="nt">span</span><span class="p">></span></code>: Plain inline text that requires specific styling or semantic meaning that cannot be achieved with any other semantically meaningful inline element. Typically used in conjunction with a <code class="html"><span class="na">class</span></code> or <code class="html"><span class="na">epub:type</span></code> attribute.</p></li>
|
||
</ol>
|
||
</section>
|
||
</section>
|
||
<section id="4.2"><aside class="number">4.2</aside>
|
||
<h2>Semantic Inflection</h2>
|
||
<p>The epub spec allows for <a href="https://idpf.github.io/epub-vocabs/structure/">semantic inflection</a>, which is a way of adding semantic metadata to elements in the ebook document.</p>
|
||
<p>For example, an ebook producer may want to convey that the contents of a certain <code class="html"><span class="p"><</span><span class="nt">section</span><span class="p">></span></code> are part of a chapter. They would do that by using the <code class="html"><span class="na">epub:type</span></code> attribute:</p>
|
||
<figure><code class="html full"><span class="p"><</span><span class="nt">section</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"chapter"</span><span class="p">></span>...<span class="p"></</span><span class="nt">section</span><span class="p">></span></code></figure>
|
||
<ol type="1">
|
||
<li id="4.2.1"><aside class="number">4.2.1</aside><p>The epub spec includes a <a href="https://idpf.github.io/epub-vocabs/structure/">vocabulary</a> that can be used in the <code class="html"><span class="na">epub:type</span></code> attribute. This vocabulary has priority when selecting a semantic keyword, even if other vocabularies contain the same one.</p></li>
|
||
<li id="4.2.2"><aside class="number">4.2.2</aside><p>The epub spec might not contain a keyword necessary to describe the semantics of a particular element. In that case, the <a href="http://www.daisy.org/z3998/2012/vocab/structure/">z3998 vocabulary</a> is consulted next.
|
||
</p><p>Keywords using this vocabulary are preceded by the <code class="bash"><span class="s">z3998</span></code> namespace.</p>
|
||
<figure><code class="html full"><span class="p"><</span><span class="nt">blockquote</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"z3998:letter"</span><span class="p">></span>...<span class="p"></</span><span class="nt">blockquote</span><span class="p">></span></code></figure>
|
||
</li>
|
||
<li id="4.2.3"><aside class="number">4.2.3</aside><p>If the z3998 vocabulary doesn’t have an appropriate keyword, the <a href="/vocab/1.0">Standard Ebooks vocabulary</a> is consulted next.
|
||
</p><p>Keywords using this vocabulary are preceded by the <code class="bash"><span class="s">se</span></code> namespace.</p>
|
||
<p>Unlike other vocabularies, the Standard Ebooks vocabulary is organized hierarchically. A complete vocabulary entry begins with the root vocabulary entry, with subsequent children separated by <code class="bash"><span class="s">.</span></code>.</p>
|
||
<figure><code class="html full">The <span class="p"><</span><span class="nt">abbr</span> <span class="na">class</span><span class="o">=</span><span class="s">"initialism"</span><span class="p">></span>HMS<span class="p"></</span><span class="nt">abbr</span><span class="p">></span> <span class="p"><</span><span class="nt">i</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"se:name.vessel.ship"</span><span class="p">></span>Bounty<span class="p"></</span><span class="nt">i</span><span class="p">></span>.</code></figure>
|
||
</li>
|
||
<li id="4.2.4"><aside class="number">4.2.4</aside><p>The <code class="html"><span class="na">epub:type</span></code> attribute can have multiple keywords separated by spaces, even if the vocabularies are different.
|
||
</p><figure><code class="html full"><span class="p"><</span><span class="nt">section</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"chapter z3998:letter"</span><span class="p">></span>...<span class="p"></</span><span class="nt">section</span><span class="p">></span></code></figure>
|
||
</li>
|
||
<li id="4.2.5"><aside class="number">4.2.5</aside><p>Child elements inherit the semantics of their parent element.
|
||
</p><p>In this example, both chapters are considered to be “non-fiction,” because they inherit it from the <code class="html"><span class="p"><</span><span class="nt">body</span><span class="p">></span></code> element:</p>
|
||
<figure><code class="html full"><span class="p"><</span><span class="nt">body</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"z3998:non-fiction"</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">section</span> <span class="na">id</span><span class="o">=</span><span class="s">"chapter-1"</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"chapter"</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">h2</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"title z3998:roman"</span><span class="p">></span>I<span class="p"></</span><span class="nt">h2</span><span class="p">></span>
|
||
...
|
||
<span class="p"></</span><span class="nt">section</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">section</span> <span class="na">id</span><span class="o">=</span><span class="s">"chapter-2"</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"chapter"</span><span class="p">></span>
|
||
<span class="p"><</span><span class="nt">h2</span> <span class="na">epub:type</span><span class="o">=</span><span class="s">"title z3998:roman"</span><span class="p">></span>II<span class="p"></</span><span class="nt">h2</span><span class="p">></span>
|
||
...
|
||
<span class="p"></</span><span class="nt">section</span><span class="p">></span>
|
||
<span class="p"></</span><span class="nt">body</span><span class="p">></span></code></figure>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
</section>
|
||
</article>
|
||
</main>
|
||
<?= Template::Footer() ?>
|