Skip to content

Inline Representation: Sections by function, not class #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 63 additions & 46 deletions 1.2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1525,19 +1525,13 @@ <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<li>
<a href="#inline-representation"><span class="secno">6</span> <span class="content">Inline Representations</span></a>
<ol class="toc">
<li>
<a href="#inline-classes"><span class="secno">6.1</span> <span class="content">Classes for Inline Representation</span></a>
<ol class="toc">
<li><a href="#ocr_glyph"><span class="secno">6.1.1</span> <span class="content"><span>ocr_glyph</span></span></a>
<li><a href="#ocr_glyphs"><span class="secno">6.1.2</span> <span class="content"><span>ocr_glyphs</span></span></a>
<li><a href="#ocr_dropcap"><span class="secno">6.1.3</span> <span class="content"><span>ocr_dropcap</span></span></a>
<li><a href="#ocr_chem"><span class="secno">6.1.4</span> <span class="content"><span>ocr_chem</span></span></a>
<li><a href="#ocr_math"><span class="secno">6.1.5</span> <span class="content"><span>ocr_math</span></span></a>
<li><a href="#superscript-and-subscript"><span class="secno">6.1.6</span> <span class="content">Superscript and Subscript</span></a>
<li><a href="#non-breaking-space"><span class="secno">6.1.7</span> <span class="content">Non-breaking space</span></a>
<li><a href="#non-default-spaces"><span class="secno">6.1.8</span> <span class="content">Non-default spaces</span></a>
<li><a href="#hyphenation"><span class="secno">6.1.9</span> <span class="content">Hyphenation</span></a>
</ol>
<li><a href="#unrecognized"><span class="secno">6.1</span> <span class="content">Unrecognized characters and words</span></a>
<li><a href="#dropcap"><span class="secno">6.2</span> <span class="content">Dropcap</span></a>
<li><a href="#formulas"><span class="secno">6.3</span> <span class="content">Mathematical and chemical formulas</span></a>
<li><a href="#sub-sup"><span class="secno">6.4</span> <span class="content">Superscript and Subscript</span></a>
<li><a href="#whitespace"><span class="secno">6.5</span> <span class="content">Whitespace</span></a>
<li><a href="#hyphenation"><span class="secno">6.6</span> <span class="content">Hyphenation</span></a>
<li><a href="#ruby"><span class="secno">6.7</span> <span class="content">Ruby characters</span></a>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also combine some of these sections under one new section, i.e.

HTML entities and Unicode

  • Non-breaking spaces must be represented using the HTML &nbsp; entity.
  • Different space widths should be indicated using HTML and &ensp;, &emsp;, &thinsp;, &zwnj;, &zwj;.
  • Soft hyphens must be represented using the HTML &shy; entity.
  • The HTML &lrm; and &rlm; entities (indicating writing direction) must not be used; all writing direction changes must be indicated with tags.
  • Furigana and similar constructs must be represented using their correct Unicode encoding.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these aspects are worth their own section. e.g. for Whitespace: explain whether repeated whitespace is meaningful, if non-tabular aligned text should use tabs. For hyphenation, whether that's the only encoding (e.g. altoxml/schema#41).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyphens are also mentioned in http://kba.github.io/hocr-spec/1.2/#hardbreak

Besides ruby also other special entities are mentioned in the article:

For example, HTML and CSS provide
support for representing fonts, styles, hyphenation,
flexible spacing, justification, kashida (flexible Arabic
characters), Urdu ligatures, Japanese ruby, mixed hor-
izontal/vertical layout, inline changes in writing direc-
tion, and many others.

However, I am also fine with more subsections.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the paragraph there before and probably will again once I get to the fonts/language section :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#60

</ol>
<li>
<a href="#character-information"><span class="secno">7</span> <span class="content">Character Information</span></a>
Expand Down Expand Up @@ -2092,41 +2086,64 @@ <h4 class="heading settled" data-level="5.4.10" id="ocr_pageno"><span class="sec
<h4 class="heading settled" data-level="5.4.11" id="ocr_table"><span class="secno">5.4.11. </span><span class="content"><dfn data-dfn-type="element" data-export="" id="elementdef-ocr_table">ocr_table<a class="self-link" href="#elementdef-ocr_table"></a></dfn></span><a class="self-link" href="#ocr_table"></a></h4>
<p><code>ocr_table</code></p>
<h2 class="heading settled" data-level="6" id="inline-representation"><span class="secno">6. </span><span class="content">Inline Representations</span><a class="self-link" href="#inline-representation"></a></h2>
<p class="issue" id="issue-d41d8cd9"><a class="self-link" href="#issue-d41d8cd9"></a> <a href="https://github.com/kba/hocr-spec/issues/51">&lt;https://github.com/kba/hocr-spec/issues/51></a></p>
<p>There is some content that should behave and flow like text</p>
<h3 class="heading settled" data-level="6.1" id="inline-classes"><span class="secno">6.1. </span><span class="content">Classes for Inline Representation</span><a class="self-link" href="#inline-classes"></a></h3>
<h4 class="heading settled" data-level="6.1.1" id="ocr_glyph"><span class="secno">6.1.1. </span><span class="content"><dfn data-dfn-type="element" data-export="" id="elementdef-ocr_glyph">ocr_glyph<a class="self-link" href="#elementdef-ocr_glyph"></a></dfn></span><a class="self-link" href="#ocr_glyph"></a></h4>
<p>An individual glyph represented as an image (e.g., an unrecognized character)</p>
<p>Must contain a single <code>&lt;img></code> tag, or be present on one</p>
<h4 class="heading settled" data-level="6.1.2" id="ocr_glyphs"><span class="secno">6.1.2. </span><span class="content"><dfn data-dfn-type="element" data-export="" id="elementdef-ocr_glyphs">ocr_glyphs<a class="self-link" href="#elementdef-ocr_glyphs"></a></dfn></span><a class="self-link" href="#ocr_glyphs"></a></h4>
<p>Multiple glyphs represented as an image (e.g., an unrecognized word)</p>
<p>Must contain a single <code>&lt;img></code> tag, or be present on one</p>
<h4 class="heading settled" data-level="6.1.3" id="ocr_dropcap"><span class="secno">6.1.3. </span><span class="content"><dfn data-dfn-type="element" data-export="" id="elementdef-ocr_dropcap">ocr_dropcap<a class="self-link" href="#elementdef-ocr_dropcap"></a></dfn></span><a class="self-link" href="#ocr_dropcap"></a></h4>
<p>An individual glyph representing a dropcap</p>
<p>May contain text or an <code>&lt;img></code> tag; the <code>alt</code> of the image tag should contain
<h3 class="heading settled" data-level="6.1" id="unrecognized"><span class="secno">6.1. </span><span class="content">Unrecognized characters and words</span><a class="self-link" href="#unrecognized"></a></h3>
<dl>
<dt data-md="">
<p><dfn data-dfn-type="element" data-export="" id="elementdef-ocr_glyph">ocr_glyph<a class="self-link" href="#elementdef-ocr_glyph"></a></dfn></p>
<dd data-md="">
<p>An individual glyph represented as an image (e.g., an unrecognized character)</p>
<dd data-md="">
<p>Must contain a single <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element">img</a></code> tag, or be present on one</p>
<dt data-md="">
<p><dfn data-dfn-type="element" data-export="" id="elementdef-ocr_glyphs">ocr_glyphs<a class="self-link" href="#elementdef-ocr_glyphs"></a></dfn></p>
<dd data-md="">
<p>Multiple glyphs represented as an image (e.g., an unrecognized word)</p>
<dd data-md="">
<p>Must contain a single <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element">img</a></code> tag, or be present on one</p>
</dl>
<h3 class="heading settled" data-level="6.2" id="dropcap"><span class="secno">6.2. </span><span class="content">Dropcap</span><a class="self-link" href="#dropcap"></a></h3>
<dl>
<dt data-md="">
<p><dfn data-dfn-type="element" data-export="" id="elementdef-ocr_dropcap">ocr_dropcap<a class="self-link" href="#elementdef-ocr_dropcap"></a></dfn></p>
<dd data-md="">
<p>An individual glyph representing a dropcap</p>
<dd data-md="">
<p>May contain text or an <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element">img</a></code> tag; the <code>alt=</code> of the image tag should contain
the corresponding text</p>
<h4 class="heading settled" data-level="6.1.4" id="ocr_chem"><span class="secno">6.1.4. </span><span class="content"><dfn class="dfn-paneled" data-dfn-type="element" data-export="" id="elementdef-ocr_chem">ocr_chem</dfn></span><a class="self-link" href="#ocr_chem"></a></h4>
<p>A chemical formula</p>
<p>Must contain either a single <code>&lt;img></code> tag or <a data-link-type="biblio" href="#biblio-cml">[CML]</a> markup, or be present on
one</p>
<h4 class="heading settled" data-level="6.1.5" id="ocr_math"><span class="secno">6.1.5. </span><span class="content"><dfn class="dfn-paneled" data-dfn-type="element" data-export="" id="elementdef-ocr_math">ocr_math</dfn></span><a class="self-link" href="#ocr_math"></a></h4>
<p>A mathematical formula</p>
<p>Must contain either a single <code>&lt;img></code> tag or <a data-link-type="biblio" href="#biblio-mathml">[MathML]</a> markup, or be present on
one</p>
</dl>
<h3 class="heading settled" data-level="6.3" id="formulas"><span class="secno">6.3. </span><span class="content">Mathematical and chemical formulas</span><a class="self-link" href="#formulas"></a></h3>
<p>Mathematical and chemical formulas that float must be put into an <code><a data-link-type="element" href="#elementdef-ocr_float" id="ref-for-elementdef-ocr_float-1">ocr_float</a></code> section.</p>
<p>Mathematical and chemical formulas that are “display” mode should be put into
an <code><a data-link-type="element" href="#elementdef-ocr_display" id="ref-for-elementdef-ocr_display-2">ocr_display</a></code> section.</p>
<h4 class="heading settled" data-level="6.1.6" id="superscript-and-subscript"><span class="secno">6.1.6. </span><span class="content">Superscript and Subscript</span><a class="self-link" href="#superscript-and-subscript"></a></h4>
<dl>
<dt data-md="">
<p><dfn class="dfn-paneled" data-dfn-type="element" data-export="" id="elementdef-ocr_chem">ocr_chem</dfn></p>
<dd data-md="">
<p>A chemical formula</p>
<dd data-md="">
<p>Must contain either a single <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element">img</a></code> tag or <a data-link-type="biblio" href="#biblio-cml">[CML]</a> markup, or be present on one</p>
<dt data-md="">
<p><dfn class="dfn-paneled" data-dfn-type="element" data-export="" id="elementdef-ocr_math">ocr_math</dfn></p>
<dd data-md="">
<p>A mathematical formula</p>
<dd data-md="">
<p>Must contain either a single <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element">img</a></code> tag or <a data-link-type="biblio" href="#biblio-mathml">[MathML]</a> markup, or be present on one</p>
</dl>
<h3 class="heading settled" data-level="6.4" id="sub-sup"><span class="secno">6.4. </span><span class="content">Superscript and Subscript</span><a class="self-link" href="#sub-sup"></a></h3>
<p>Superscripts and subscripts, when not in <code><a data-link-type="element" href="#elementdef-ocr_math" id="ref-for-elementdef-ocr_math-1">ocr_math</a></code> or <code><a data-link-type="element" href="#elementdef-ocr_chem" id="ref-for-elementdef-ocr_chem-1">ocr_chem</a></code> formulas,
must be represented using the HTML <code>&lt;sup></code> and <code>&lt;sub></code> tags, even if special
must be represented using the HTML <code><a data-link-type="element">sup</a></code> and <code><a data-link-type="element">sub</a></code> tags, even if special
Unicode characters are available.</p>
<h4 class="heading settled" data-level="6.1.7" id="non-breaking-space"><span class="secno">6.1.7. </span><span class="content">Non-breaking space</span><a class="self-link" href="#non-breaking-space"></a></h4>
<h3 class="heading settled" data-level="6.5" id="whitespace"><span class="secno">6.5. </span><span class="content">Whitespace</span><a class="self-link" href="#whitespace"></a></h3>
<p>Non-breaking spaces must be represented using the HTML <code>&amp;nbsp;</code> entity.</p>
<h4 class="heading settled" data-level="6.1.8" id="non-default-spaces"><span class="secno">6.1.8. </span><span class="content">Non-default spaces</span><a class="self-link" href="#non-default-spaces"></a></h4>
<p>Different space widths should be indicated using HTML and <code>&amp;ensp;</code>, <code>&amp;emsp</code>, <code>&amp;thinsp;</code>, <code>&amp;zwnj;</code>, <code>&amp;zwj;</code>.</p>
<h4 class="heading settled" data-level="6.1.9" id="hyphenation"><span class="secno">6.1.9. </span><span class="content">Hyphenation</span><a class="self-link" href="#hyphenation"></a></h4>
<h3 class="heading settled" data-level="6.6" id="hyphenation"><span class="secno">6.6. </span><span class="content">Hyphenation</span><a class="self-link" href="#hyphenation"></a></h3>
<p>Soft hyphens must be represented using the HTML <code>&amp;shy;</code> entity.</p>
<p>The HTML <a href="https://www.w3.org/TR/REC-html40/struct/dirlang.html#h-8.2.5"><code>&amp;lrm;</code> and <code>&amp;rlm;</code> entities</a> (indicating writing direction) must not be used; all
writing direction changes must be indicated with tags.</p>
<h3 class="heading settled" data-level="6.7" id="ruby"><span class="secno">6.7. </span><span class="content">Ruby characters</span><a class="self-link" href="#ruby"></a></h3>
<p><a href="https://en.wikipedia.org/wiki/Ruby_character">Furigana and similar constructs</a> must be represented using their correct Unicode encoding.</p>
<h2 class="heading settled" data-level="7" id="character-information"><span class="secno">7. </span><span class="content">Character Information</span><a class="self-link" href="#character-information"></a></h2>
<h3 class="heading settled" data-level="7.1" id="character-classes"><span class="secno">7.1. </span><span class="content">Classes for Character Information</span><a class="self-link" href="#character-classes"></a></h3>
<p>Character-level information may be put on any element that contains only a
Expand Down Expand Up @@ -2287,7 +2304,6 @@ <h2 class="heading settled" data-level="9" id="font-lang"><span class="secno">9.
<p>The CSS3 text layout attributes can be used when necessary. For example, CSS
supports writing-mode, direction, glyph-orientation <a data-link-type="biblio" href="#biblio-iso15924">[ISO15924]</a>-based
script (<a href="http://www.unicode.org/iso15924/codelists.html">list of codes</a>), text-indent, etc.</p>
<p><a href="https://en.wikipedia.org/wiki/Ruby_character">Furigana and similar constructs</a> must be represented using their correct Unicode encoding.</p>
<h2 class="heading settled" data-level="10" id="segmentation"><span class="secno">10. </span><span class="content">Alternative Segmentations / Readings</span><a class="self-link" href="#segmentation"></a></h2>
<p class="issue" id="issue-b35297dd"><a class="self-link" href="#issue-b35297dd"></a> <a href="https://github.com/kba/hocr-spec/issues/9">Delete x_cost</a></p>
<p>Alternative segmentations and readings are indicated by a <code>&lt;span></code> with <code>class="alternatives"</code>. It must contains <code>&lt;ins></code> and <code>&lt;del></code> elements. The first
Expand Down Expand Up @@ -2990,23 +3006,23 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
<li><a href="#elementdef-ocr_caption">ocr_caption</a><span>, in §4</span>
<li><a href="#elementdef-ocr_carea">ocr_carea</a><span>, in §5.1.3</span>
<li><a href="#elementdef-ocr_chapter">ocr_chapter</a><span>, in §4</span>
<li><a href="#elementdef-ocr_chem">ocr_chem</a><span>, in §6.1.4</span>
<li><a href="#elementdef-ocr_chem">ocr_chem</a><span>, in §6.3</span>
<li><a href="#elementdef-ocr_cinfo">ocr_cinfo</a><span>, in §7.1.1</span>
<li><a href="#elementdef-ocr_column">ocr_column</a><span>, in §5.1.2</span>
<li><a href="#elementdef-ocr_display">ocr_display</a><span>, in §4</span>
<li><a href="#elementdef-ocr_document">ocr_document</a><span>, in §4</span>
<li><a href="#elementdef-ocr_dropcap">ocr_dropcap</a><span>, in §6.1.3</span>
<li><a href="#elementdef-ocr_dropcap">ocr_dropcap</a><span>, in §6.2</span>
<li><a href="#elementdef-ocr_float">ocr_float</a><span>, in §5.4.1</span>
<li><a href="#elementdef-ocr_footer">ocr_footer</a><span>, in §5.4.9</span>
<li><a href="#elementdef-ocr_glyph">ocr_glyph</a><span>, in §6.1.1</span>
<li><a href="#elementdef-ocr_glyphs">ocr_glyphs</a><span>, in §6.1.2</span>
<li><a href="#elementdef-ocr_glyph">ocr_glyph</a><span>, in §6.1</span>
<li><a href="#elementdef-ocr_glyphs">ocr_glyphs</a><span>, in §6.1</span>
<li><a href="#elementdef-ocr_header">ocr_header</a><span>, in §5.4.8</span>
<li><a href="#elementdef-ocr_image">ocr_image</a><span>, in §5.4.5</span>
<li><a href="#propdef-ocr-langs">ocr-langs</a><span>, in §12</span>
<li><a href="#elementdef-ocr_line">ocr_line</a><span>, in §5.1.4</span>
<li><a href="#elementdef-ocr_linear">ocr_linear</a><span>, in §4</span>
<li><a href="#elementdef-ocr_linedrawing">ocr_linedrawing</a><span>, in §5.4.6</span>
<li><a href="#elementdef-ocr_math">ocr_math</a><span>, in §6.1.5</span>
<li><a href="#elementdef-ocr_math">ocr_math</a><span>, in §6.3</span>
<li><a href="#elementdef-ocr_noise">ocr_noise</a><span>, in §5.1.6</span>
<li><a href="#propdef-ocr-number-of-pages">ocr-number-of-pages</a><span>, in §12</span>
<li><a href="#elementdef-ocr_page">ocr_page</a><span>, in §5.1.1</span>
Expand Down Expand Up @@ -3119,6 +3135,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
<div class="issue"> <a href="https://github.com/kba/hocr-spec/issues/66">Logical Tags/classes</a><a href="#issue-2af02b43"> ↵ </a></div>
<div class="issue"> There is currently no way of indicating anchoring or flow-around
properties for floating elements; properties need to be defined for this.<a href="#issue-3f2f70ed"> ↵ </a></div>
<div class="issue"> <a href="https://github.com/kba/hocr-spec/issues/51">&lt;https://github.com/kba/hocr-spec/issues/51></a><a href="#issue-d41d8cd9"> ↵ </a></div>
<div class="issue"> <a href="https://github.com/kba/hocr-spec/issues/28">ocr_carea vs ocrx_block</a><a href="#issue-66c198d9"> ↵ </a></div>
<div class="issue"> <a href="https://github.com/kba/hocr-spec/issues/19">ocr_line vs ocrx_line</a><a href="#issue-8ef34561"> ↵ </a></div>
<div class="issue"> ocrx_cinfo?<a href="#issue-000a0ed5"> ↵ </a></div>
Expand Down Expand Up @@ -3202,7 +3219,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
<b><a href="#elementdef-ocr_display">#elementdef-ocr_display</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-elementdef-ocr_display-1">4. Logical Structuring Elements</a>
<li><a href="#ref-for-elementdef-ocr_display-2">6.1.5. ocr_math</a>
<li><a href="#ref-for-elementdef-ocr_display-2">6.3. Mathematical and chemical formulas</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="elementdef-ocr_blockquote">
Expand Down Expand Up @@ -3266,19 +3283,19 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
<aside class="dfn-panel" data-for="elementdef-ocr_float">
<b><a href="#elementdef-ocr_float">#elementdef-ocr_float</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-elementdef-ocr_float-1">6.1.5. ocr_math</a>
<li><a href="#ref-for-elementdef-ocr_float-1">6.3. Mathematical and chemical formulas</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="elementdef-ocr_chem">
<b><a href="#elementdef-ocr_chem">#elementdef-ocr_chem</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-elementdef-ocr_chem-1">6.1.6. Superscript and Subscript</a>
<li><a href="#ref-for-elementdef-ocr_chem-1">6.4. Superscript and Subscript</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="elementdef-ocr_math">
<b><a href="#elementdef-ocr_math">#elementdef-ocr_math</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-elementdef-ocr_math-1">6.1.6. Superscript and Subscript</a>
<li><a href="#ref-for-elementdef-ocr_math-1">6.4. Superscript and Subscript</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="elementdef-ocr_cinfo">
Expand Down
Loading