isodoc 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/function/cleanup.rb +1 -1
- data/lib/isodoc/function/section.rb +13 -1
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/html_function/html.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +1 -0
- data/spec/isodoc/cleanup_spec.rb +3 -1
- data/spec/isodoc/section_spec.rb +125 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04b4a5b6d5f00722c0939f1b75ffaeaeb4fc4e7a6f36ebec40e19b93df9f38f1
|
4
|
+
data.tar.gz: 41baee0c2174ce3de7c02afdb1179e6445d37e10233f22b396089e1eb60c1a22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz: '
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0823e689e87baac6d76bd7b7622a34976418e1da41be9bdeb4a308456ba36a4ec009dc72b59e7b1da0c416c0dbb95f1e6425f436f496540803ac3e4e48baa5f1'
|
7
|
+
data.tar.gz: f48233075744aa6ccc52e743870a5cf8952fe248b67527e913ac0c343a868f19eafe0a3dc3aaeb056dc1f58c12c7b849748f91c548755e586e4f55bcdad84bca
|
@@ -6,9 +6,9 @@ module IsoDoc::Function
|
|
6
6
|
|
7
7
|
def termref_cleanup(docxml)
|
8
8
|
docxml.
|
9
|
+
gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/, l10n(", #{@i18n.modified} [/TERMREF]")).
|
9
10
|
gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ").
|
10
11
|
gsub(/\[TERMREF\]\s*/, l10n("[#{@i18n.source}: ")).
|
11
|
-
gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/, l10n(", #{@i18n.modified} [/TERMREF]")).
|
12
12
|
gsub(%r{\s*\[\/TERMREF\]\s*}, l10n("]")).
|
13
13
|
gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} — "))
|
14
14
|
end
|
@@ -182,7 +182,6 @@ module IsoDoc::Function
|
|
182
182
|
page_break(out)
|
183
183
|
out.div **attr_code(id: f["id"]) do |s|
|
184
184
|
clause_name(nil, f.at(ns("./title")), s, { class: "AbstractTitle" })
|
185
|
-
#s.h1(**{ class: "AbstractTitle" }) { |h1| h1 << @i18n.abstract }
|
186
185
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
187
186
|
end
|
188
187
|
end
|
@@ -201,6 +200,19 @@ module IsoDoc::Function
|
|
201
200
|
end
|
202
201
|
end
|
203
202
|
|
203
|
+
def is_clause?(name)
|
204
|
+
%w(clause references definitions terms foreword introduction abstract
|
205
|
+
acknowledgements).include? name
|
206
|
+
end
|
207
|
+
|
208
|
+
def preface_block(isoxml, out)
|
209
|
+
p = isoxml.at(ns("//preface")) or return
|
210
|
+
p.elements.each do |e|
|
211
|
+
next if is_clause?(e.name)
|
212
|
+
parse(e, out)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
204
216
|
def copyright_parse(node, out)
|
205
217
|
out.div **{class: "boilerplate-copyright"} do |div|
|
206
218
|
node.children.each { |n| parse(n, div) }
|
data/lib/isodoc/version.rb
CHANGED
data/spec/isodoc/cleanup_spec.rb
CHANGED
@@ -1084,6 +1084,7 @@ INPUT
|
|
1084
1084
|
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
1085
1085
|
[/TERMREF]</p>
|
1086
1086
|
<p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
|
1087
|
+
<p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION] [/TERMREF]</p>
|
1087
1088
|
<p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
|
1088
1089
|
<p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
|
1089
1090
|
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
@@ -1140,7 +1141,8 @@ INPUT
|
|
1140
1141
|
<a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
|
1141
1142
|
, modified — The term "cargo rice" is shown as deprecated, and
|
1142
1143
|
Note 1 to entry is not included here; Termbase IEV, term ID xyz;
|
1143
|
-
Termbase IEV, term ID xyz, modified
|
1144
|
+
Termbase IEV, term ID xyz, modified; Termbase IEV, term ID xyz,
|
1145
|
+
modified — with adjustments]
|
1144
1146
|
</p>
|
1145
1147
|
<p class='TermNum' id='paddy'>1.2.</p>
|
1146
1148
|
<p class='Terms' style='text-align:left;'>paddy</p>
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -1,6 +1,131 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
|
+
it "processes prefatory blocks" do
|
5
|
+
input = <<~INPUT
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<preface>
|
8
|
+
<abstract id="A"><title>abstract</title></abstract>
|
9
|
+
<introduction id="B"><title>introduction</title></introduction>
|
10
|
+
<note id="C">note</note>
|
11
|
+
</preface>
|
12
|
+
<sections>
|
13
|
+
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
14
|
+
<title>Introduction</title>
|
15
|
+
</clause>
|
16
|
+
<clause id="O" inline-header="true" obligation="normative">
|
17
|
+
<title>Clause 4.2</title>
|
18
|
+
</clause></clause>
|
19
|
+
<admonition id="L" type="caution"><p>admonition</p></admonition>
|
20
|
+
</sections>
|
21
|
+
</iso-standard>
|
22
|
+
INPUT
|
23
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
24
|
+
<html lang='en'>
|
25
|
+
<head/>
|
26
|
+
<body lang='en'>
|
27
|
+
<div class='title-section'>
|
28
|
+
<p> </p>
|
29
|
+
</div>
|
30
|
+
<br/>
|
31
|
+
<div class='prefatory-section'>
|
32
|
+
<p> </p>
|
33
|
+
</div>
|
34
|
+
<br/>
|
35
|
+
<div class='main-section'>
|
36
|
+
<div id='C' class='Note'>note</div>
|
37
|
+
<br/>
|
38
|
+
<div id='A'>
|
39
|
+
<h1 class='AbstractTitle'>abstract</h1>
|
40
|
+
</div>
|
41
|
+
<br/>
|
42
|
+
<div class='Section3' id='B'>
|
43
|
+
<h1 class='IntroTitle'>introduction</h1>
|
44
|
+
</div>
|
45
|
+
<p class='zzSTDTitle1'/>
|
46
|
+
<div id='L' class='Admonition'>
|
47
|
+
<p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
|
48
|
+
<p>admonition</p>
|
49
|
+
</div>
|
50
|
+
<div id='M'>
|
51
|
+
<h1>Clause 4</h1>
|
52
|
+
<div id='N'>
|
53
|
+
<h2>Introduction</h2>
|
54
|
+
</div>
|
55
|
+
<div id='O'>
|
56
|
+
<span class='zzMoveToFollowing'>
|
57
|
+
<b>Clause 4.2  </b>
|
58
|
+
</span>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</body>
|
63
|
+
</html>
|
64
|
+
OUTPUT
|
65
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
66
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
67
|
+
<head>
|
68
|
+
<style>
|
69
|
+
</style>
|
70
|
+
</head>
|
71
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
72
|
+
<div class='WordSection1'>
|
73
|
+
<p> </p>
|
74
|
+
</div>
|
75
|
+
<p>
|
76
|
+
<br clear='all' class='section'/>
|
77
|
+
</p>
|
78
|
+
<div class='WordSection2'>
|
79
|
+
<div id='C' class='Note'>
|
80
|
+
<p class='Note'>
|
81
|
+
<span class='note_label'/>
|
82
|
+
<span style='mso-tab-count:1'>  </span>
|
83
|
+
</p>
|
84
|
+
note
|
85
|
+
</div>
|
86
|
+
<p>
|
87
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
88
|
+
</p>
|
89
|
+
<div id='A'>
|
90
|
+
<h1 class='AbstractTitle'>abstract</h1>
|
91
|
+
</div>
|
92
|
+
<p>
|
93
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
94
|
+
</p>
|
95
|
+
<div class='Section3' id='B'>
|
96
|
+
<h1 class='IntroTitle'>introduction</h1>
|
97
|
+
</div>
|
98
|
+
<p> </p>
|
99
|
+
</div>
|
100
|
+
<p>
|
101
|
+
<br clear='all' class='section'/>
|
102
|
+
</p>
|
103
|
+
<div class='WordSection3'>
|
104
|
+
<p class='zzSTDTitle1'/>
|
105
|
+
<div id='L' class='Admonition'>
|
106
|
+
<p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
|
107
|
+
<p>admonition</p>
|
108
|
+
</div>
|
109
|
+
<div id='M'>
|
110
|
+
<h1>Clause 4</h1>
|
111
|
+
<div id='N'>
|
112
|
+
<h2>Introduction</h2>
|
113
|
+
</div>
|
114
|
+
<div id='O'>
|
115
|
+
<span class='zzMoveToFollowing'>
|
116
|
+
<b>
|
117
|
+
Clause 4.2
|
118
|
+
<span style='mso-tab-count:1'>  </span>
|
119
|
+
</b>
|
120
|
+
</span>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
</body>
|
125
|
+
</html>
|
126
|
+
OUTPUT
|
127
|
+
end
|
128
|
+
|
4
129
|
it "processes document with no content" do
|
5
130
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
131
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -989,5 +1114,4 @@ OUTPUT
|
|
989
1114
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
990
1115
|
end
|
991
1116
|
|
992
|
-
|
993
1117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|