isodoc 0.4.5 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rspec +18 -0
- data/isodoc.gemspec +1 -1
- data/lib/isodoc.rb +34 -5
- data/lib/isodoc/blocks.rb +62 -50
- data/lib/isodoc/cleanup.rb +34 -10
- data/lib/isodoc/html.rb +31 -16
- data/lib/isodoc/i18n-en.yaml +72 -0
- data/lib/isodoc/i18n-fr.yaml +65 -0
- data/lib/isodoc/i18n-zh-Hans.yaml +64 -0
- data/lib/isodoc/i18n.rb +90 -0
- data/lib/isodoc/inline.rb +25 -18
- data/lib/isodoc/iso2wordhtml.rb +30 -7
- data/lib/isodoc/lists.rb +29 -9
- data/lib/isodoc/metadata.rb +54 -38
- data/lib/isodoc/notes.rb +32 -32
- data/lib/isodoc/postprocessing.rb +65 -46
- data/lib/isodoc/references.rb +63 -29
- data/lib/isodoc/section.rb +94 -44
- data/lib/isodoc/table.rb +19 -19
- data/lib/isodoc/terms.rb +5 -6
- data/lib/isodoc/utils.rb +48 -5
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref_gen.rb +87 -75
- data/spec/isodoc/blocks_spec.rb +618 -0
- data/spec/isodoc/lists_spec.rb +227 -0
- data/spec/isodoc/section_spec.rb +419 -0
- data/spec/isodoc/table_spec.rb +135 -0
- data/spec/isodoc/xref_spec.rb +1073 -0
- data/spec/spec_helper.rb +26 -0
- metadata +17 -6
@@ -0,0 +1,72 @@
|
|
1
|
+
term_def_boilerplate: |
|
2
|
+
<p>ISO and IEC maintain terminological databases for use in
|
3
|
+
standardization at the following addresses:</p>
|
4
|
+
|
5
|
+
<ul>
|
6
|
+
<li> <p>ISO Online browsing platform: available at
|
7
|
+
<a href=http://www.iso.org/obp>http://www.iso.org/obp</a></p> </li>
|
8
|
+
<li> <p>IEC Electropedia: available at
|
9
|
+
<a href=http://www.electropedia.org>http://www.electropedia.org</a>
|
10
|
+
</p> </li> </ul>
|
11
|
+
scope: Scope
|
12
|
+
symbols: Symbols and Abbreviated Terms
|
13
|
+
introduction: Introduction
|
14
|
+
foreword: Foreword
|
15
|
+
termsdef: Terms and Definitions
|
16
|
+
termsdefsymbols: Terms, Definitions, Symbols and Abbreviated Terms
|
17
|
+
normref: Normative References
|
18
|
+
bibliography: Bibliography
|
19
|
+
clause: Clause
|
20
|
+
annex: Annex
|
21
|
+
no_terms_boilerplate: |
|
22
|
+
<p>No terms and definitions are listed in this document.</p>
|
23
|
+
internal_terms_boilerplate: |
|
24
|
+
<p>For the purposes of this document,
|
25
|
+
the following terms and definitions apply.</p>
|
26
|
+
norm_with_refs_pref:
|
27
|
+
The following documents are referred to in the text in such a way
|
28
|
+
that some or all of their content constitutes requirements of this
|
29
|
+
document. For dated references, only the edition cited applies.
|
30
|
+
For undated references, the latest edition of the referenced
|
31
|
+
document (including any amendments) applies.
|
32
|
+
norm_empty_pref:
|
33
|
+
There are no normative references in this document.
|
34
|
+
external_terms_boilerplate: |
|
35
|
+
<p>For the purposes of this document,
|
36
|
+
the terms and definitions given in % apply.</p>
|
37
|
+
internal_external_terms_boilerplate: |
|
38
|
+
<p>For the purposes of this document, the terms and definitions
|
39
|
+
given in % and the following apply.</p>
|
40
|
+
note: NOTE
|
41
|
+
note_xref: Note
|
42
|
+
termnote: Note % to entry
|
43
|
+
figure: Figure
|
44
|
+
formula: Formula
|
45
|
+
table: Table
|
46
|
+
key: Key
|
47
|
+
example: EXAMPLE
|
48
|
+
example_xref: Example
|
49
|
+
where: where
|
50
|
+
wholeoftext: Whole of text
|
51
|
+
draft: draft
|
52
|
+
inform_annex: informative
|
53
|
+
norm_annex: normative
|
54
|
+
modified: modified
|
55
|
+
deprecated: DEPRECATED
|
56
|
+
source: SOURCE
|
57
|
+
and: and
|
58
|
+
all_parts: All Parts
|
59
|
+
locality: {
|
60
|
+
section: Section,
|
61
|
+
clause: Clause,
|
62
|
+
part: Part,
|
63
|
+
paragraph: Paragraph,
|
64
|
+
chapter: Chapter,
|
65
|
+
page: Page,
|
66
|
+
table: Table,
|
67
|
+
annex: Annex,
|
68
|
+
figure: Figure,
|
69
|
+
example: Example,
|
70
|
+
note: Note,
|
71
|
+
formula: Formula
|
72
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
term_def_boilerplate: |
|
2
|
+
<p>L'ISO et l'IEC tiennent à jour des bases de données terminologiques
|
3
|
+
destinées à être utilisées en normalisation, consultables aux adresses
|
4
|
+
suivantes:</p>
|
5
|
+
<ul>
|
6
|
+
<li> <p>ISO Online browsing platform: disponible à l'adresse
|
7
|
+
<a href=http://www.iso.org/obp>http://www.iso.org/obp</a></p> </li>
|
8
|
+
<li> <p>IEC Electropedia: disponible à l'adresse
|
9
|
+
<a href=http://www.electropedia.org>http://www.electropedia.org</a>
|
10
|
+
</p> </li> </ul>
|
11
|
+
scope: Domaine d'application
|
12
|
+
symbols: Symboles et termes abrégés
|
13
|
+
introduction: Introduction
|
14
|
+
foreword: Avant-propos
|
15
|
+
termsdef: Terms et définitions
|
16
|
+
termsdefsymbols: Terms, définitions, symboles et termes abrégés
|
17
|
+
normref: Références normatives
|
18
|
+
bibliography: then Bibliographie
|
19
|
+
clause: then Article
|
20
|
+
annex: Annexe
|
21
|
+
no_terms_boilerplate: |
|
22
|
+
<p>Aucun terme n'est defini dans le présent document.</p>
|
23
|
+
internal_terms_boilerplate: |
|
24
|
+
<p>Pour les besoins du présent document, les termes et définitions suivants s'appliquent.</p>
|
25
|
+
norm_with_refs_pref:
|
26
|
+
Les documents suivants cités dans le texte constituent, pour tout ou partie de leur contenu, des exigences du présent document. Pour les références datées, seule l’édition citée s'applique. Pour les références non datées, la dernière édition du document de référence s'applique (y compris les éventuels amendements).
|
27
|
+
norm_empty_pref:
|
28
|
+
Le présent document ne contient aucune référence normative.
|
29
|
+
external_terms_boilerplate: |
|
30
|
+
<p>Pour les besoins du présent document, les termes et définitions de % s'appliquent.</p>
|
31
|
+
internal_external_terms_boilerplate: |
|
32
|
+
<p>Pour les besoins du présent document, les termes et définitions de % ainsi que les suivants, s'appliquent.</p>
|
33
|
+
note: NOTE
|
34
|
+
note_xref: Note
|
35
|
+
termnote: Note % à l'article
|
36
|
+
figure: Figure
|
37
|
+
formula: Formule
|
38
|
+
table: Tableau
|
39
|
+
key: Légende
|
40
|
+
example: EXEMPLE
|
41
|
+
example_xref: Exemple
|
42
|
+
where: où
|
43
|
+
wholeoftext: Ensemble du texte
|
44
|
+
draft: brouillon
|
45
|
+
inform_annex: informative
|
46
|
+
norm_annex: normative
|
47
|
+
modified: modifié
|
48
|
+
deprecated: DÉCONSEILLÉ
|
49
|
+
source: SOURCE
|
50
|
+
and: et
|
51
|
+
all_parts: toutes les parties
|
52
|
+
locality: {
|
53
|
+
section: Section,
|
54
|
+
clause: Article,
|
55
|
+
part: Partie,
|
56
|
+
paragraph: Alinéa,
|
57
|
+
chapter: Chapitre,
|
58
|
+
page: Page,
|
59
|
+
table: Tableau,
|
60
|
+
annex: Annexe,
|
61
|
+
figure: Figure,
|
62
|
+
example: Exemple,
|
63
|
+
note: Note,
|
64
|
+
formula: Formule
|
65
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
term_def_boilerplate: |
|
2
|
+
<p>ISO和IEC用于标准化的术语数据库地址如下:</p>
|
3
|
+
<ul>
|
4
|
+
<li> <p>ISO在线浏览平台:
|
5
|
+
位于<a href=http://www.iso.org/obp>http://www.iso.org/obp</a></p> </li>
|
6
|
+
<li> <p>IEC Electropedia:
|
7
|
+
位于<a href=http://www.electropedia.org>http://www.electropedia.org</a>
|
8
|
+
</p> </li> </ul>
|
9
|
+
scope: 范围
|
10
|
+
symbols: 符号、代号和缩略语
|
11
|
+
introduction: 引言
|
12
|
+
foreword: 前言
|
13
|
+
termsdef: 术语和定义
|
14
|
+
termsdefsymbols_lbl: 术语、定义、符号、代号和缩略语
|
15
|
+
normref: 规范性引用文件
|
16
|
+
bibliography: 参考文献
|
17
|
+
clause: 条
|
18
|
+
annex: 附录
|
19
|
+
no_terms_boilerplate: |
|
20
|
+
<p>本文件不提供术语和定义。</p>
|
21
|
+
internal_terms_boilerplate: |
|
22
|
+
<p>下列术语和定义适用于本文件。</p>
|
23
|
+
norm_with_refs_pref:
|
24
|
+
下列文件对于本文件的应用是必不可少的。
|
25
|
+
凡是注日期的引用文件,仅注日期的版本适用于本文件。
|
26
|
+
凡是不注日期的引用文件,其最新版本(包括所有的修改单)适用于本文件。
|
27
|
+
norm_empty_pref:
|
28
|
+
本文件并没有规范性引用文件。
|
29
|
+
external_terms_boilerplate: |
|
30
|
+
<p>% 界定的术语和定义适用于本文件。</p>
|
31
|
+
internal_external_terms_boilerplate: |
|
32
|
+
<p>% 界定的以及下列术语和定义适用于本文件。</p>
|
33
|
+
note: 注
|
34
|
+
note_xref: 注
|
35
|
+
termnote: 注%
|
36
|
+
figure: 图
|
37
|
+
formula: 公式
|
38
|
+
table: 表
|
39
|
+
key: 说明
|
40
|
+
example: 示例
|
41
|
+
example_xref: 示例
|
42
|
+
where: 式中
|
43
|
+
wholeoftext: 全部
|
44
|
+
draft: 稿
|
45
|
+
inform_annex: 资料性附录
|
46
|
+
norm_annex: 规范性附录
|
47
|
+
modified: 改写
|
48
|
+
deprecated: 被取代
|
49
|
+
source: 定义
|
50
|
+
and: 和
|
51
|
+
all_parts: 所有部分
|
52
|
+
locality: {
|
53
|
+
section: 条,
|
54
|
+
clause: 条,
|
55
|
+
part: 部分,
|
56
|
+
paragraph: 段,
|
57
|
+
chapter: 章,
|
58
|
+
page: 页,
|
59
|
+
table: 表,
|
60
|
+
annex: 附录,
|
61
|
+
figure: 图,
|
62
|
+
example: 示例,
|
63
|
+
note: 注
|
64
|
+
}
|
data/lib/isodoc/i18n.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module IsoDoc
|
4
|
+
class Convert
|
5
|
+
def i18n_init(lang, script)
|
6
|
+
@lang = lang
|
7
|
+
@script = script
|
8
|
+
y = if @i18nyaml
|
9
|
+
YAML.load_file(@i18nyaml)
|
10
|
+
elsif lang == "en"
|
11
|
+
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
12
|
+
elsif lang == "fr"
|
13
|
+
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-fr.yaml"))
|
14
|
+
elsif lang == "zh" && script == "Hans"
|
15
|
+
YAML.load_file(File.join(File.dirname(__FILE__),
|
16
|
+
"i18n-zh-Hans.yaml"))
|
17
|
+
else
|
18
|
+
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
19
|
+
end
|
20
|
+
@term_def_boilerplate = y["term_def_boilerplate"]
|
21
|
+
@scope_lbl = y["scope"]
|
22
|
+
@symbols_lbl = y["symbols"]
|
23
|
+
@introduction_lbl = y["introduction"]
|
24
|
+
@foreword_lbl = y["foreword"]
|
25
|
+
@termsdef_lbl = y["termsdef"]
|
26
|
+
@termsdefsymbols_lbl = y["termsdefsymbols"]
|
27
|
+
@normref_lbl = y["normref"]
|
28
|
+
@bibliography_lbl = y["bibliography"]
|
29
|
+
@clause_lbl = y["clause"]
|
30
|
+
@annex_lbl = y["annex"]
|
31
|
+
@no_terms_boilerplate = y["no_terms_boilerplate"]
|
32
|
+
@internal_terms_boilerplate = y["internal_terms_boilerplate"]
|
33
|
+
@norm_with_refs_pref = y["norm_with_refs_pref"]
|
34
|
+
@norm_empty_pref = y["norm_empty_pref"]
|
35
|
+
@external_terms_boilerplate = y["external_terms_boilerplate"]
|
36
|
+
@internal_external_terms_boilerplate =
|
37
|
+
y["internal_external_terms_boilerplate"]
|
38
|
+
@note_lbl = y["note"]
|
39
|
+
@note_xref_lbl = y["note_xref"]
|
40
|
+
@termnote_lbl = y["termnote"]
|
41
|
+
@figure_lbl = y["figure"]
|
42
|
+
@formula_lbl = y["formula"]
|
43
|
+
@table_lbl = y["table"]
|
44
|
+
@key_lbl = y["key"]
|
45
|
+
@example_lbl = y["example"]
|
46
|
+
@example_xref_lbl = y["example_xref"]
|
47
|
+
@where_lbl = y["where"]
|
48
|
+
@wholeoftext_lbl = y["wholeoftext"]
|
49
|
+
@draft_lbl = y["draft"]
|
50
|
+
@inform_annex_lbl = y["inform_annex"]
|
51
|
+
@norm_annex_lbl = y["norm_annex"]
|
52
|
+
@modified_lbl = y["modified"]
|
53
|
+
@deprecated_lbl = y["deprecated"]
|
54
|
+
@source_lbl = y["source"]
|
55
|
+
@and_lbl = y["and"]
|
56
|
+
@all_parts_lbl = y["all_parts"]
|
57
|
+
@locality = y["locality"]
|
58
|
+
end
|
59
|
+
|
60
|
+
def eref_localities1_zh(type, from, to)
|
61
|
+
ret = ", 第#{from.text}" if from
|
62
|
+
ret += "–#{to}" if to
|
63
|
+
ret += @locality[type]
|
64
|
+
ret
|
65
|
+
end
|
66
|
+
|
67
|
+
def eref_localities1(type, from, to, lang = "en")
|
68
|
+
subsection = from&.text&.match?(/\./)
|
69
|
+
return l10n(eref_localities1_zh(type, from, to)) if lang == "zh"
|
70
|
+
ret = ","
|
71
|
+
ret += " #{@locality[type]}" unless subsection && type == "clause"
|
72
|
+
ret += " #{from.text}" if from
|
73
|
+
ret += "–#{to.text}" if to
|
74
|
+
l10n(ret)
|
75
|
+
end
|
76
|
+
|
77
|
+
# function localising spaces and punctuation.
|
78
|
+
# Not clear if period needs to be localised for zh
|
79
|
+
def l10n(x, lang = @lang, script = @script)
|
80
|
+
if lang == "zh" && script == "Hans"
|
81
|
+
x.gsub(/ /, "").gsub(/:/, ":").gsub(/,/, "、").
|
82
|
+
gsub(/\(/, "(").gsub(/\)/, ")").
|
83
|
+
gsub(/\[/, "【").gsub(/\]/, "】").
|
84
|
+
gsub(/<b>/, "").gsub("</b>", "")
|
85
|
+
else
|
86
|
+
x
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/lib/isodoc/inline.rb
CHANGED
@@ -23,14 +23,21 @@ module IsoDoc
|
|
23
23
|
out << " <#{node.text}>"
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
def anchor_linkend(node, linkend)
|
27
|
+
if node["citeas"].nil? && get_anchors.has_key?(node["bibitemid"])
|
28
|
+
return get_anchors[node["bibitemid"]][:xref]
|
29
|
+
elsif get_anchors.has_key?(node["target"])
|
30
|
+
linkend = get_anchors[node["target"]][:xref]
|
31
|
+
container = get_anchors[node["target"]][:container]
|
32
|
+
(container && get_note_container_id(node) != container) &&
|
33
|
+
linkend = l10n(get_anchors[container][:xref] + ", " + linkend)
|
32
34
|
end
|
33
|
-
linkend
|
35
|
+
linkend
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_linkend(node)
|
39
|
+
linkend = anchor_linkend(node, node["target"] || node["citeas"])
|
40
|
+
linkend += eref_localities(node.xpath(ns("./locality")))
|
34
41
|
text = node.children.select { |c| c.text? && !c.text.empty? }
|
35
42
|
linkend = text.join(" ") unless text.nil? || text.empty?
|
36
43
|
# so not <origin bibitemid="ISO7301" citeas="ISO 7301">
|
@@ -43,16 +50,15 @@ module IsoDoc
|
|
43
50
|
out.a **{ "href": "#" + node["target"] } { |l| l << linkend }
|
44
51
|
end
|
45
52
|
|
46
|
-
def eref_localities(
|
53
|
+
def eref_localities(refs)
|
47
54
|
ret = ""
|
48
|
-
|
49
|
-
if r["type"] == "whole"
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
55
|
+
refs.each do |r|
|
56
|
+
ret += if r["type"] == "whole"
|
57
|
+
l10n(", #{@whole_of_text}")
|
58
|
+
else
|
59
|
+
eref_localities1(r["type"], r.at(ns("./referenceFrom")),
|
60
|
+
r.at(ns("./referenceTo")))
|
61
|
+
end
|
56
62
|
end
|
57
63
|
ret
|
58
64
|
end
|
@@ -69,7 +75,8 @@ module IsoDoc
|
|
69
75
|
end
|
70
76
|
|
71
77
|
def stem_parse(node, out)
|
72
|
-
ooml = if node["type"] == "AsciiMath"
|
78
|
+
ooml = if node["type"] == "AsciiMath"
|
79
|
+
"#{@openmathdelim}#{node.text}#{@closemathdelim}"
|
73
80
|
elsif node["type"] == "MathML" then node.first_element_child.to_s
|
74
81
|
else
|
75
82
|
node.text
|
@@ -79,7 +86,7 @@ module IsoDoc
|
|
79
86
|
end
|
80
87
|
end
|
81
88
|
|
82
|
-
def pagebreak_parse(
|
89
|
+
def pagebreak_parse(_node, out)
|
83
90
|
attrs = { clear: all, class: "pagebreak" }
|
84
91
|
out.br **attrs
|
85
92
|
end
|
data/lib/isodoc/iso2wordhtml.rb
CHANGED
@@ -2,12 +2,33 @@ require "pp"
|
|
2
2
|
|
3
3
|
module IsoDoc
|
4
4
|
class Convert
|
5
|
+
def set_termdomain(termdomain)
|
6
|
+
@termdomain = termdomain
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_termexample
|
10
|
+
@termexample
|
11
|
+
end
|
12
|
+
|
13
|
+
def set_termexample(value)
|
14
|
+
@termexample = value
|
15
|
+
end
|
5
16
|
|
6
|
-
def
|
17
|
+
def in_sourcecode
|
18
|
+
@sourcecode
|
19
|
+
end
|
20
|
+
|
21
|
+
def note?
|
22
|
+
@note
|
23
|
+
end
|
24
|
+
|
25
|
+
def init_file(filename, debug)
|
7
26
|
filename = filename.gsub(%r{\.[^/.]+$}, "")
|
8
27
|
dir = "#{filename}_files"
|
9
|
-
|
10
|
-
|
28
|
+
unless debug
|
29
|
+
Dir.mkdir(dir) unless File.exists?(dir)
|
30
|
+
system "rm -r #{dir}/*"
|
31
|
+
end
|
11
32
|
[filename, dir]
|
12
33
|
end
|
13
34
|
|
@@ -20,7 +41,7 @@ module IsoDoc
|
|
20
41
|
end
|
21
42
|
end
|
22
43
|
|
23
|
-
def make_body1(body,
|
44
|
+
def make_body1(body, _docxml)
|
24
45
|
body.div **{ class: "WordSection1" } do |div1|
|
25
46
|
div1.p { |p| p << " " } # placeholder
|
26
47
|
end
|
@@ -50,6 +71,7 @@ module IsoDoc
|
|
50
71
|
id isoxml, out
|
51
72
|
author isoxml, out
|
52
73
|
bibdate isoxml, out
|
74
|
+
relations isoxml, out
|
53
75
|
version isoxml, out
|
54
76
|
foreword isoxml, out
|
55
77
|
introduction isoxml, out
|
@@ -72,7 +94,7 @@ module IsoDoc
|
|
72
94
|
end
|
73
95
|
|
74
96
|
def smallcap_parse(node, xml)
|
75
|
-
xml.span **{style: "font-variant:small-caps;"} do |s|
|
97
|
+
xml.span **{ style: "font-variant:small-caps;" } do |s|
|
76
98
|
s << node.text
|
77
99
|
end
|
78
100
|
end
|
@@ -137,11 +159,12 @@ module IsoDoc
|
|
137
159
|
when "domain" then set_termdomain(node.text)
|
138
160
|
when "definition" then definition_parse(node, out)
|
139
161
|
when "termsource" then termref_parse(node, out)
|
140
|
-
when "isosection"
|
141
|
-
out << "[ISOSECTION] #{node.text}"
|
142
162
|
when "modification" then modification_parse(node, out)
|
143
163
|
when "termnote" then termnote_parse(node, out)
|
144
164
|
when "termexample" then termexample_parse(node, out)
|
165
|
+
when "terms" then terms_parse(node, out)
|
166
|
+
when "symbols-abbrevs" then symbols_parse(node, out)
|
167
|
+
when "references" then bibliography_parse(node, out)
|
145
168
|
else
|
146
169
|
error_parse(node, out)
|
147
170
|
end
|
data/lib/isodoc/lists.rb
CHANGED
@@ -15,12 +15,28 @@ module IsoDoc
|
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
def ol_style(type)
|
18
|
+
type = :alphabet unless type
|
18
19
|
OL_STYLE[type.to_sym]
|
19
20
|
end
|
20
21
|
|
22
|
+
# We don't really want users to specify type of ordered list;
|
23
|
+
# we will use a fixed hierarchy as practiced by ISO (though not
|
24
|
+
# fully spelled out): a) 1) i) A) I)
|
25
|
+
#
|
26
|
+
|
27
|
+
def ol_depth(node)
|
28
|
+
depth = node.ancestors("ul, ol").size + 1
|
29
|
+
type = :alphabet
|
30
|
+
type = :arabic if [2, 7].include? depth
|
31
|
+
type = :roman if [3, 8].include? depth
|
32
|
+
type = :alphabet_upper if [4, 9].include? depth
|
33
|
+
type = :roman_upper if [5, 10].include? depth
|
34
|
+
ol_style(type)
|
35
|
+
end
|
36
|
+
|
21
37
|
def ol_parse(node, out)
|
22
|
-
#
|
23
|
-
style =
|
38
|
+
# style = ol_style(node["type"])
|
39
|
+
style = ol_depth(node)
|
24
40
|
out.ol **attr_code(type: style) do |ol|
|
25
41
|
node.children.each { |n| parse(n, ol) }
|
26
42
|
end
|
@@ -32,17 +48,21 @@ module IsoDoc
|
|
32
48
|
end
|
33
49
|
end
|
34
50
|
|
51
|
+
def dt_parse(dt, term)
|
52
|
+
if dt.elements.empty?
|
53
|
+
term.p **attr_code(class: note? ? "Note" : nil) do |p|
|
54
|
+
p << dt.text
|
55
|
+
end
|
56
|
+
else
|
57
|
+
dt.children.each { |n| parse(n, term) }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
35
61
|
def dl_parse(node, out)
|
36
62
|
out.dl do |v|
|
37
63
|
node.elements.each_slice(2) do |dt, dd|
|
38
64
|
v.dt do |term|
|
39
|
-
|
40
|
-
term.p **attr_code(class: is_note ? "Note" : nil) do
|
41
|
-
|p| p << dt.text
|
42
|
-
end
|
43
|
-
else
|
44
|
-
dt.children.each { |n| parse(n, term) }
|
45
|
-
end
|
65
|
+
dt_parse(dt, term)
|
46
66
|
end
|
47
67
|
v.dd do |listitem|
|
48
68
|
dd.children.each { |n| parse(n, listitem) }
|