isodoc 1.0.24 → 1.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +2 -2
- data/.github/workflows/ubuntu.yml +4 -2
- data/.github/workflows/windows.yml +2 -2
- data/lib/isodoc-yaml/i18n-en.yaml +3 -1
- data/lib/isodoc-yaml/i18n-fr.yaml +3 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +3 -1
- data/lib/isodoc/convert.rb +1 -0
- data/lib/isodoc/function/cleanup.rb +2 -0
- data/lib/isodoc/function/inline.rb +8 -0
- data/lib/isodoc/function/section.rb +16 -7
- data/lib/isodoc/function/to_word_html.rb +1 -1
- data/lib/isodoc/function/utils.rb +4 -3
- data/lib/isodoc/function/xref_sect_gen.rb +1 -1
- data/lib/isodoc/html_function/footnotes.rb +2 -2
- data/lib/isodoc/html_function/postprocess.rb +1 -1
- data/lib/isodoc/metadata.rb +4 -3
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +0 -4
- data/lib/isodoc/word_function/footnotes.rb +2 -2
- data/lib/isodoc/word_function/postprocess.rb +13 -2
- data/spec/isodoc/blocks_spec.rb +3 -3
- data/spec/isodoc/cleanup_spec.rb +180 -10
- data/spec/isodoc/i18n_spec.rb +4 -4
- data/spec/isodoc/metadata_spec.rb +5 -3
- data/spec/isodoc/postproc_spec.rb +29 -7
- data/spec/isodoc/section_spec.rb +10 -5
- data/spec/isodoc/terms_spec.rb +50 -6
- data/spec/isodoc/xref_spec.rb +12 -12
- 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: b0256be2230e0c8757987eb82dee6f8ced68e1cc8794964fabbc446e78d53195
|
4
|
+
data.tar.gz: a8bc10c2952aacf1542b3a4a1edae6c363bee78604dea3c541f9fd769031ea13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54f7daa32cc4e7e80a560dfd660f76bf4acae581cda2c3b7f89012ab368da2d0951dec308982bea80e07b1e9d59eed1d170aecae686f42b82f31843a9fff4e9
|
7
|
+
data.tar.gz: 75bceea7c655e1bf34de59ed6eb185596966c70b09f4da3c786c80fb57394a8e28c7f87cd47b1a795bee0b5e72d08f372981c587f27e3fb31240a96668cebeaf
|
data/.github/workflows/macos.yml
CHANGED
@@ -29,10 +29,10 @@ jobs:
|
|
29
29
|
- name: Use Node
|
30
30
|
uses: actions/setup-node@v1
|
31
31
|
with:
|
32
|
-
node-version: '
|
32
|
+
node-version: '12'
|
33
33
|
- name: Install Puppeteer
|
34
34
|
run: |
|
35
|
-
npm install -g puppeteer
|
35
|
+
npm install -g puppeteer@3.0.1
|
36
36
|
- name: Run specs
|
37
37
|
run: |
|
38
38
|
bundle exec rake
|
@@ -29,10 +29,12 @@ jobs:
|
|
29
29
|
- name: Use Node
|
30
30
|
uses: actions/setup-node@v1
|
31
31
|
with:
|
32
|
-
node-version: '
|
32
|
+
node-version: '12'
|
33
33
|
- name: Install Puppeteer
|
34
34
|
run: |
|
35
|
-
|
35
|
+
sudo apt-get update
|
36
|
+
sudo apt-get install libgbm1
|
37
|
+
npm install -g puppeteer@3.0.1
|
36
38
|
- name: Run specs
|
37
39
|
run: |
|
38
40
|
bundle exec rake
|
@@ -31,10 +31,10 @@ jobs:
|
|
31
31
|
- name: Use Node
|
32
32
|
uses: actions/setup-node@v1
|
33
33
|
with:
|
34
|
-
node-version: '
|
34
|
+
node-version: '12'
|
35
35
|
- name: Install Puppeteer
|
36
36
|
run: |
|
37
|
-
npm install -g puppeteer
|
37
|
+
npm install -g puppeteer@3.0.1
|
38
38
|
- name: Run specs
|
39
39
|
run: |
|
40
40
|
bundle exec rake
|
@@ -6,7 +6,9 @@ introduction: Introduction
|
|
6
6
|
foreword: Foreword
|
7
7
|
abstract: Abstract
|
8
8
|
termsdef: Terms and definitions
|
9
|
-
|
9
|
+
termsdefsymbolsabbrev: Terms, definitions, symbols and abbreviated terms
|
10
|
+
termsdefsymbols: Terms, definitions and symbols
|
11
|
+
termsdefabbrev: Terms, definitions and abbreviated terms
|
10
12
|
normref: Normative references
|
11
13
|
bibliography: Bibliography
|
12
14
|
clause: Clause
|
@@ -6,7 +6,9 @@ introduction: Introduction
|
|
6
6
|
foreword: Avant-propos
|
7
7
|
abstract: Résumé
|
8
8
|
termsdef: Terms et définitions
|
9
|
-
|
9
|
+
termsdefsymbolsabbrev: Terms, définitions, symboles et termes abrégés
|
10
|
+
termsdefsymbols: Terms, définitions et symboles
|
11
|
+
termsdefabbrev: Terms, définitions et termes abrégés
|
10
12
|
normref: Références normatives
|
11
13
|
bibliography: Bibliographie
|
12
14
|
clause: Article
|
data/lib/isodoc/convert.rb
CHANGED
@@ -48,6 +48,7 @@ module IsoDoc
|
|
48
48
|
@olstyle = options[:olstyle]
|
49
49
|
@datauriimage = options[:datauriimage]
|
50
50
|
@suppressheadingnumbers = options[:suppressheadingnumbers]
|
51
|
+
@break_up_urls_in_tables = options[:break_up_urls_in_tables] == "true"
|
51
52
|
@termdomain = ""
|
52
53
|
@termexample = false
|
53
54
|
@note = false
|
@@ -20,6 +20,7 @@ module IsoDoc::Function
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def table_long_strings_cleanup(docxml)
|
23
|
+
return unless @break_up_urls_in_tables == true
|
23
24
|
docxml.xpath("//td | //th").each do |d|
|
24
25
|
d.traverse do |n|
|
25
26
|
next unless n.text?
|
@@ -30,6 +31,7 @@ module IsoDoc::Function
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def break_up_long_strings(t)
|
34
|
+
return t if t.match(/^\s*$/)
|
33
35
|
t.split(/(?=\s)/).map do |w|
|
34
36
|
(/^\s*$/.match(t) or w.size < 30) ? w :
|
35
37
|
w.scan(/.{,30}/).map do |w1|
|
@@ -107,6 +107,14 @@ module IsoDoc::Function
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
+
def origin_parse(node, out)
|
111
|
+
if t = node.at(ns("./termref"))
|
112
|
+
termrefelem_parse(t, out)
|
113
|
+
else
|
114
|
+
eref_parse(node, out)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
110
118
|
def termrefelem_parse(node, out)
|
111
119
|
out << "Termbase #{node['base']}, term ID #{node['target']}"
|
112
120
|
end
|
@@ -109,20 +109,29 @@ module IsoDoc::Function
|
|
109
109
|
num
|
110
110
|
end
|
111
111
|
|
112
|
-
def terms_defs_title(f)
|
113
|
-
symbols = f.at(ns(".//definitions"))
|
114
|
-
return @termsdefsymbols_lbl if symbols
|
115
|
-
@termsdef_lbl
|
116
|
-
end
|
117
|
-
|
118
112
|
TERM_CLAUSE = "//sections/terms | "\
|
119
113
|
"//sections/clause[descendant::terms]".freeze
|
120
114
|
|
115
|
+
def term_def_title(title)
|
116
|
+
case title&.text
|
117
|
+
when "Terms, definitions, symbols and abbreviated terms"
|
118
|
+
@labels["termsdefsymbolsabbrev"]
|
119
|
+
when "Terms, definitions and symbols"
|
120
|
+
@labels["termsdefsymbols"]
|
121
|
+
when "Terms, definitions and abbreviated terms"
|
122
|
+
@labels["termsdefabbrev"]
|
123
|
+
when "Terms and definitions"
|
124
|
+
@labels["termsdef"]
|
125
|
+
else
|
126
|
+
title
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
121
130
|
def terms_defs(isoxml, out, num)
|
122
131
|
f = isoxml.at(ns(TERM_CLAUSE)) or return num
|
123
132
|
out.div **attr_code(id: f["id"]) do |div|
|
124
133
|
num = num + 1
|
125
|
-
clause_name(num,
|
134
|
+
clause_name(num, term_def_title(f&.at(ns("./title"))), div, nil)
|
126
135
|
f.elements.each do |e|
|
127
136
|
parse(e, div) unless %w{title source}.include? e.name
|
128
137
|
end
|
@@ -157,7 +157,7 @@ module IsoDoc::Function
|
|
157
157
|
when "clause" then clause_parse(node, out)
|
158
158
|
when "xref" then xref_parse(node, out)
|
159
159
|
when "eref" then eref_parse(node, out)
|
160
|
-
when "origin" then
|
160
|
+
when "origin" then origin_parse(node, out)
|
161
161
|
when "link" then link_parse(node, out)
|
162
162
|
when "ul" then ul_parse(node, out)
|
163
163
|
when "ol" then ol_parse(node, out)
|
@@ -64,7 +64,7 @@ module IsoDoc::Function
|
|
64
64
|
|
65
65
|
CLAUSE_ANCESTOR =
|
66
66
|
".//ancestor::*[local-name() = 'annex' or "\
|
67
|
-
"local-name() = 'acknowledgements' or "\
|
67
|
+
"local-name() = 'acknowledgements' or local-name() = 'term' or "\
|
68
68
|
"local-name() = 'appendix' or local-name() = 'foreword' or "\
|
69
69
|
"local-name() = 'introduction' or local-name() = 'terms' or "\
|
70
70
|
"local-name() = 'clause' or local-name() = 'references']/@id".freeze
|
@@ -78,7 +78,7 @@ module IsoDoc::Function
|
|
78
78
|
".//ancestor::*[local-name() = 'annex' or "\
|
79
79
|
"local-name() = 'foreword' or local-name() = 'appendix' or "\
|
80
80
|
"local-name() = 'introduction' or local-name() = 'terms' or "\
|
81
|
-
"local-name() = 'acknowledgements' or "\
|
81
|
+
"local-name() = 'acknowledgements' or local-name() = 'term' or "\
|
82
82
|
"local-name() = 'clause' or local-name() = 'references' or "\
|
83
83
|
"local-name() = 'figure' or local-name() = 'formula' or "\
|
84
84
|
"local-name() = 'table' or local-name() = 'example']/@id".freeze
|
@@ -110,7 +110,8 @@ module IsoDoc::Function
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def header_strip(h)
|
113
|
-
h = h.to_s.gsub(%r{<br
|
113
|
+
h = h.to_s.gsub(%r{<br\s*/>}, " ").gsub(/<\/?h[123456][^>]*>/, "").
|
114
|
+
gsub(/<\/?b[^>]*>/, "")
|
114
115
|
h1 = to_xhtml_fragment(h.dup)
|
115
116
|
h1.traverse do |x|
|
116
117
|
x.replace(" ") if x.name == "span" && /mso-tab-count/.match(x["style"])
|
@@ -79,7 +79,7 @@ module IsoDoc::Function
|
|
79
79
|
"//references[title = 'Normative References' or title = "\
|
80
80
|
"'Normative references'] | "\
|
81
81
|
"//sections/terms | //preface/abstract | //foreword | "\
|
82
|
-
"//introduction | //preface/clause | //acknowledgements "\
|
82
|
+
"//introduction | //preface/clause | //acknowledgements | "\
|
83
83
|
"//sections/definitions | //clause[parent::sections]"
|
84
84
|
sequential_asset_names(d.xpath(ns(middle_sections)))
|
85
85
|
end
|
@@ -48,7 +48,7 @@ module IsoDoc::HtmlFunction
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def table_footnote_parse(node, out)
|
51
|
-
fn = node["reference"]
|
51
|
+
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
52
52
|
tid = get_table_ancestor_id(node)
|
53
53
|
make_table_footnote_link(out, tid + fn, fn)
|
54
54
|
# do not output footnote text if we have already seen it for this table
|
@@ -64,7 +64,7 @@ module IsoDoc::HtmlFunction
|
|
64
64
|
def footnote_parse(node, out)
|
65
65
|
return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
|
66
66
|
!node.ancestors.map {|m| m.name }.include?("name")
|
67
|
-
fn = node["reference"]
|
67
|
+
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
68
68
|
attrs = { "epub:type": "footnote", rel: "footnote", href: "#fn:#{fn}" }
|
69
69
|
out.a **attrs do |a|
|
70
70
|
a.sup { |sup| sup << fn }
|
@@ -108,7 +108,7 @@ module IsoDoc::HtmlFunction
|
|
108
108
|
idx = docxml.at("//div[@id = 'toc']") or return docxml
|
109
109
|
toc = "<ul>"
|
110
110
|
path = toclevel_classes.map do |l|
|
111
|
-
"//main//#{l}[not(@class = 'TermNum')][not(@class = 'noTOC')][
|
111
|
+
"//main//#{l}[not(@class = 'TermNum')][not(@class = 'noTOC')][text()]"
|
112
112
|
end
|
113
113
|
docxml.xpath(path.join(" | ")).each_with_index do |h, tocidx|
|
114
114
|
h["id"] ||= "toc#{tocidx}"
|
data/lib/isodoc/metadata.rb
CHANGED
@@ -3,7 +3,8 @@ require_relative "./metadata_date"
|
|
3
3
|
module IsoDoc
|
4
4
|
class Metadata
|
5
5
|
DATETYPES = %w{published accessed created implemented obsoleted confirmed
|
6
|
-
updated issued received transmitted copied unchanged circulated
|
6
|
+
updated issued received transmitted copied unchanged circulated vote-started
|
7
|
+
vote-ended}.freeze
|
7
8
|
|
8
9
|
def ns(xpath)
|
9
10
|
Common::ns(xpath)
|
@@ -15,7 +16,7 @@ module IsoDoc
|
|
15
16
|
|
16
17
|
def initialize(lang, script, labels)
|
17
18
|
@metadata = {}
|
18
|
-
DATETYPES.each { |w| @metadata["#{w}date".to_sym] = "XXX" }
|
19
|
+
DATETYPES.each { |w| @metadata["#{w.gsub(/-/, "_")}date".to_sym] = "XXX" }
|
19
20
|
@lang = lang
|
20
21
|
@script = script
|
21
22
|
@c = HTMLEntities.new
|
@@ -84,7 +85,7 @@ module IsoDoc
|
|
84
85
|
|
85
86
|
def bibdate(isoxml, _out)
|
86
87
|
isoxml.xpath(ns("//bibdata/date")).each do |d|
|
87
|
-
set("#{d['type']}date".to_sym, Common::date_range(d))
|
88
|
+
set("#{d['type'].gsub(/-/, "_")}date".to_sym, Common::date_range(d))
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
data/lib/isodoc/version.rb
CHANGED
@@ -204,10 +204,6 @@ module IsoDoc::WordFunction
|
|
204
204
|
alt: node["alt"],
|
205
205
|
title: node["title"],
|
206
206
|
width: node["width"] }
|
207
|
-
if node["height"] == "auto" || node["width"] == "auto"
|
208
|
-
attrs[:height] = nil
|
209
|
-
attrs[:width] = nil
|
210
|
-
end
|
211
207
|
out.img **attr_code(attrs)
|
212
208
|
image_title_parse(out, caption)
|
213
209
|
end
|
@@ -56,7 +56,7 @@ module IsoDoc::WordFunction
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def table_footnote_parse(node, out)
|
59
|
-
fn = node["reference"]
|
59
|
+
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
60
60
|
tid = get_table_ancestor_id(node)
|
61
61
|
make_table_footnote_link(out, tid + fn, fn)
|
62
62
|
# do not output footnote text if we have already seen it for this table
|
@@ -80,7 +80,7 @@ module IsoDoc::WordFunction
|
|
80
80
|
def footnote_parse(node, out)
|
81
81
|
return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
|
82
82
|
!node.ancestors.map {|m| m.name }.include?("name")
|
83
|
-
fn = node["reference"]
|
83
|
+
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
84
84
|
return seen_footnote_parse(node, out, fn) if @seen_footnote.include?(fn)
|
85
85
|
@fn_bookmarks[fn] = bookmarkid
|
86
86
|
out.span **{style: "mso-bookmark:_Ref#{@fn_bookmarks[fn]}"} do |s|
|
@@ -39,7 +39,6 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def toWord(result, filename, dir, header)
|
42
|
-
#result = populate_template(result, :word)
|
43
42
|
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
44
43
|
unless @landscapestyle.empty?
|
45
44
|
@wordstylesheet&.open
|
@@ -196,6 +195,8 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
196
195
|
@landscapestyle = ""
|
197
196
|
word_section_breaks1(docxml, "WordSection2")
|
198
197
|
word_section_breaks1(docxml, "WordSection3")
|
198
|
+
word_remove_pb_before_annex(docxml)
|
199
|
+
docxml.xpath("//br[@orientation]").each { |br| br.delete("orientation") }
|
199
200
|
end
|
200
201
|
|
201
202
|
def word_section_breaks1(docxml, sect)
|
@@ -203,7 +204,6 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
203
204
|
each_with_index do |br, i|
|
204
205
|
@landscapestyle += "\ndiv.#{sect}_#{i} {page:#{sect}"\
|
205
206
|
"#{br["orientation"] == "landscape" ? "L" : "P"};}\n"
|
206
|
-
br.delete("orientation")
|
207
207
|
split_at_section_break(docxml, sect, br, i)
|
208
208
|
end
|
209
209
|
end
|
@@ -219,6 +219,17 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
|
+
# applies for <div class="WordSectionN_M"><p><pagebreak/></p>...
|
223
|
+
def word_remove_pb_before_annex(docxml)
|
224
|
+
docxml.xpath("//div[p/br]").each do |d|
|
225
|
+
/^WordSection\d+_\d+$/.match(d["class"]) or next
|
226
|
+
d.elements[0].name == "p" && !d.elements[0].elements.empty? or next
|
227
|
+
d.elements[0].elements[0].name == "br" && d.elements[0].elements[0]["style"] ==
|
228
|
+
"mso-special-character:line-break;page-break-before:always" or next
|
229
|
+
d.elements[0].remove
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
222
233
|
def word_footnote_format(docxml)
|
223
234
|
# the content is in a[@epub:type = 'footnote']//sup, but in Word,
|
224
235
|
# we need to inject content around the autonumbered footnote reference
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -417,8 +417,8 @@ B</pre>
|
|
417
417
|
<div id="figureA-1" class="figure">
|
418
418
|
|
419
419
|
<img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletext"/>
|
420
|
-
<img src="rice_images/rice_image1.png"/>
|
421
|
-
<img src=
|
420
|
+
<img src="rice_images/rice_image1.png" height='20' width='auto'/>
|
421
|
+
<img src='_.gif' height='20' width='auto'/>
|
422
422
|
<a href="#_" class="TableFootnoteRef">a</a><aside><div id="ftn_"><span><span id="_" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">  </span></span>
|
423
423
|
<p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p>
|
424
424
|
</div></aside>
|
@@ -969,7 +969,7 @@ World</p>
|
|
969
969
|
INPUT
|
970
970
|
#{HTML_HDR}
|
971
971
|
<p class="zzSTDTitle1"/>
|
972
|
-
<div><h1>1. 
|
972
|
+
<div><h1>1.  </h1>
|
973
973
|
<p class="TermNum" id="_extraneous_matter">1.1.</p><p class="Terms" style="text-align:left;">extraneous matter</p><p class="AltTerms" style="text-align:left;">EM</p>
|
974
974
|
|
975
975
|
<p id="_318b3939-be09-46c4-a284-93f9826b981e"><rice> organic and inorganic components other than whole or broken kernels</p>
|
data/spec/isodoc/cleanup_spec.rb
CHANGED
@@ -715,7 +715,7 @@ INPUT
|
|
715
715
|
OUTPUT
|
716
716
|
end
|
717
717
|
|
718
|
-
it "
|
718
|
+
it "does not break up very long strings in tables by default" do
|
719
719
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
720
720
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
721
721
|
<head>
|
@@ -739,6 +739,7 @@ INPUT
|
|
739
739
|
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
|
740
740
|
<td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
|
741
741
|
</tr>
|
742
|
+
</thead>
|
742
743
|
<tbody>
|
743
744
|
<tr>
|
744
745
|
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
|
@@ -775,6 +776,90 @@ INPUT
|
|
775
776
|
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
|
776
777
|
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
|
777
778
|
</tr>
|
779
|
+
</thead>
|
780
|
+
<tbody>
|
781
|
+
<tr>
|
782
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
783
|
+
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
784
|
+
</td>
|
785
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
786
|
+
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB </td>
|
787
|
+
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
|
788
|
+
www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
789
|
+
</td>
|
790
|
+
</tr>
|
791
|
+
</tbody>
|
792
|
+
</table>
|
793
|
+
</div>
|
794
|
+
</div>
|
795
|
+
</body>
|
796
|
+
</head>
|
797
|
+
</html>
|
798
|
+
OUTPUT
|
799
|
+
end
|
800
|
+
|
801
|
+
it "breaks up very long strings in tables on request" do
|
802
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
803
|
+
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
804
|
+
<head>
|
805
|
+
<title>test</title>
|
806
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
807
|
+
<div class="WordSection1">
|
808
|
+
<p> </p>
|
809
|
+
</div>
|
810
|
+
<br clear="all" class="section"/>
|
811
|
+
<div class="WordSection2">
|
812
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
813
|
+
<div>
|
814
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
815
|
+
<p class="TableTitle" align="center">
|
816
|
+
<b>Table 1 — Repeatability and reproducibility of husked rice yield</b>
|
817
|
+
</p>
|
818
|
+
<table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
|
819
|
+
<thead>
|
820
|
+
<tr>
|
821
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
|
822
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
|
823
|
+
<td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
|
824
|
+
</tr>
|
825
|
+
</thead>
|
826
|
+
<tbody>
|
827
|
+
<tr>
|
828
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
|
829
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
|
830
|
+
<td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
|
831
|
+
</tr>
|
832
|
+
</tbody>
|
833
|
+
</table>
|
834
|
+
</div>
|
835
|
+
</div>
|
836
|
+
</body>
|
837
|
+
</html>
|
838
|
+
INPUT
|
839
|
+
<?xml version='1.0'?>
|
840
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops'>
|
841
|
+
<head>
|
842
|
+
<title>test</title>
|
843
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
844
|
+
<div class='WordSection1'>
|
845
|
+
<p> </p>
|
846
|
+
</div>
|
847
|
+
<br clear='all' class='section'/>
|
848
|
+
<div class='WordSection2'>
|
849
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
850
|
+
<div>
|
851
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
852
|
+
<p class='TableTitle' align='center'>
|
853
|
+
<b>Table 1 — Repeatability and reproducibility of husked rice yield</b>
|
854
|
+
</p>
|
855
|
+
<table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
|
856
|
+
<thead>
|
857
|
+
<tr>
|
858
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
|
859
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
|
860
|
+
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
|
861
|
+
</tr>
|
862
|
+
</thead>
|
778
863
|
<tbody>
|
779
864
|
<tr>
|
780
865
|
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
@@ -794,7 +879,6 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
794
879
|
</td>
|
795
880
|
</tr>
|
796
881
|
</tbody>
|
797
|
-
</thead>
|
798
882
|
</table>
|
799
883
|
</div>
|
800
884
|
</div>
|
@@ -804,7 +888,8 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
804
888
|
OUTPUT
|
805
889
|
end
|
806
890
|
|
807
|
-
|
891
|
+
|
892
|
+
it "does not break up very long strings in tables by default (Word)" do
|
808
893
|
expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
809
894
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
810
895
|
<head>
|
@@ -828,16 +913,17 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
828
913
|
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
|
829
914
|
<td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
|
830
915
|
</tr>
|
916
|
+
</thead>
|
831
917
|
<tbody>
|
832
918
|
<tr>
|
833
919
|
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
834
|
-
http://www.example.com
|
920
|
+
http://www.example.com/&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
835
921
|
</td>
|
836
922
|
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
837
|
-
http://www.example.com/
|
923
|
+
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
838
924
|
</td>
|
839
925
|
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
|
840
|
-
www.example.com/
|
926
|
+
www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
841
927
|
</td>
|
842
928
|
</tr>
|
843
929
|
</tbody>
|
@@ -870,20 +956,104 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
870
956
|
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
|
871
957
|
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
|
872
958
|
</tr>
|
959
|
+
</thead>
|
873
960
|
<tbody>
|
874
961
|
<tr>
|
875
962
|
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
876
|
-
http://www.example.com
|
963
|
+
http://www.example.com/&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
877
964
|
</td>
|
878
965
|
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
879
|
-
http://www.example.com/
|
966
|
+
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
880
967
|
</td>
|
881
968
|
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
|
882
|
-
www.example.com/
|
969
|
+
www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
970
|
+
</td>
|
971
|
+
</tr>
|
972
|
+
</tbody>
|
973
|
+
</table>
|
974
|
+
</div>
|
975
|
+
</div>
|
976
|
+
</body>
|
977
|
+
</head>
|
978
|
+
</html>
|
979
|
+
OUTPUT
|
980
|
+
end
|
981
|
+
|
982
|
+
it "breaks up very long strings in tables on request (Word)" do
|
983
|
+
expect(xmlpp(IsoDoc::WordConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
984
|
+
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
985
|
+
<head>
|
986
|
+
<title>test</title>
|
987
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
988
|
+
<div class="WordSection1">
|
989
|
+
<p> </p>
|
990
|
+
</div>
|
991
|
+
<br clear="all" class="section"/>
|
992
|
+
<div class="WordSection2">
|
993
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
994
|
+
<div>
|
995
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
996
|
+
<p class="TableTitle" align="center">
|
997
|
+
<b>Table 1 — Repeatability and reproducibility of husked rice yield</b>
|
998
|
+
</p>
|
999
|
+
<table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
|
1000
|
+
<thead>
|
1001
|
+
<tr>
|
1002
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
|
1003
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
|
1004
|
+
<td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
|
1005
|
+
</tr>
|
1006
|
+
</thead>
|
1007
|
+
<tbody>
|
1008
|
+
<tr>
|
1009
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
|
1010
|
+
<td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
|
1011
|
+
<td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
|
1012
|
+
</tr>
|
1013
|
+
</tbody>
|
1014
|
+
</table>
|
1015
|
+
</div>
|
1016
|
+
</div>
|
1017
|
+
</body>
|
1018
|
+
</html>
|
1019
|
+
INPUT
|
1020
|
+
<?xml version='1.0'?>
|
1021
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops'>
|
1022
|
+
<head>
|
1023
|
+
<title>test</title>
|
1024
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
1025
|
+
<div class='WordSection1'>
|
1026
|
+
<p> </p>
|
1027
|
+
</div>
|
1028
|
+
<br clear='all' class='section'/>
|
1029
|
+
<div class='WordSection2'>
|
1030
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1031
|
+
<div>
|
1032
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1033
|
+
<p class='TableTitle' align='center'>
|
1034
|
+
<b>Table 1 — Repeatability and reproducibility of husked rice yield</b>
|
1035
|
+
</p>
|
1036
|
+
<table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
|
1037
|
+
<thead>
|
1038
|
+
<tr>
|
1039
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
|
1040
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
|
1041
|
+
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
|
1042
|
+
</tr>
|
1043
|
+
</thead>
|
1044
|
+
<tbody>
|
1045
|
+
<tr>
|
1046
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
1047
|
+
http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
1048
|
+
</td>
|
1049
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
|
1050
|
+
http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
|
1051
|
+
</td>
|
1052
|
+
<td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
|
1053
|
+
www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
883
1054
|
</td>
|
884
1055
|
</tr>
|
885
1056
|
</tbody>
|
886
|
-
</thead>
|
887
1057
|
</table>
|
888
1058
|
</div>
|
889
1059
|
</div>
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -21,7 +21,7 @@ RSpec.describe IsoDoc do
|
|
21
21
|
<p id="E">Text</p>
|
22
22
|
</clause>
|
23
23
|
|
24
|
-
<clause id="H" obligation="normative"><title>Terms,
|
24
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
25
25
|
<title>Normal Terms</title>
|
26
26
|
<term id="J">
|
27
27
|
<preferred>Term2</preferred>
|
@@ -157,7 +157,7 @@ RSpec.describe IsoDoc do
|
|
157
157
|
<p id="E">Text</p>
|
158
158
|
</clause>
|
159
159
|
|
160
|
-
<clause id="H" obligation="normative"><title>Terms,
|
160
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
161
161
|
<title>Normal Terms</title>
|
162
162
|
<term id="J">
|
163
163
|
<preferred>Term2</preferred>
|
@@ -293,7 +293,7 @@ RSpec.describe IsoDoc do
|
|
293
293
|
<p id="E">Text</p>
|
294
294
|
</clause>
|
295
295
|
|
296
|
-
<clause id="H" obligation="normative"><title>Terms,
|
296
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
297
297
|
<title>Normal Terms</title>
|
298
298
|
<term id="J">
|
299
299
|
<preferred>Term2</preferred>
|
@@ -430,7 +430,7 @@ RSpec.describe IsoDoc do
|
|
430
430
|
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
|
431
431
|
</clause>
|
432
432
|
|
433
|
-
<clause id="H" obligation="normative"><title>Terms,
|
433
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
434
434
|
<title>Normal Terms</title>
|
435
435
|
<term id="J">
|
436
436
|
<preferred>Term2</preferred>
|
@@ -30,6 +30,8 @@ RSpec.describe IsoDoc do
|
|
30
30
|
<date type="updated"><on>2018</on></date>
|
31
31
|
<date type="unchanged"><on>2019</on></date>
|
32
32
|
<date type="transmitted"><on>2020</on></date>
|
33
|
+
<date type="vote-started"><on>2021</on></date>
|
34
|
+
<date type="vote-ended"><on>2022</on></date>
|
33
35
|
<edition>2</edition>
|
34
36
|
<version>
|
35
37
|
<revision-date>2016-05-01</revision-date>
|
@@ -92,7 +94,7 @@ RSpec.describe IsoDoc do
|
|
92
94
|
</bibdata>
|
93
95
|
</iso-standard>
|
94
96
|
INPUT
|
95
|
-
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>["Barney Rubble", "Fred Flintstone"], :authors_affiliations=>{"Slate Inc., Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]}, :circulateddate=>"2015", :confirmeddate=>"2017", :copieddate=>"2016", :createddate=>"2010–2011", :doc=>"URL E", :docnumber=>"17301-1", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :html=>"URL B", :implementeddate=>"XXX", :issueddate=>"XXX", :iteration=>"2", :obsoleteddate=>"2014", :pdf=>"URL D", :publisheddate=>"2011", :publisher=>"", :receiveddate=>"XXX", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :stage=>"Committee draft", :stageabbr=>"CD", :substage=>"Withdrawn", :transmitteddate=>"2020", :unchangeddate=>"2019", :unpublished=>true, :updateddate=>"2018", :url=>"URL A", :xml=>"URL C"}
|
97
|
+
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>["Barney Rubble", "Fred Flintstone"], :authors_affiliations=>{"Slate Inc., Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]}, :circulateddate=>"2015", :confirmeddate=>"2017", :copieddate=>"2016", :createddate=>"2010–2011", :doc=>"URL E", :docnumber=>"17301-1", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :html=>"URL B", :implementeddate=>"XXX", :issueddate=>"XXX", :iteration=>"2", :obsoleteddate=>"2014", :pdf=>"URL D", :publisheddate=>"2011", :publisher=>"", :receiveddate=>"XXX", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :stage=>"Committee draft", :stageabbr=>"CD", :substage=>"Withdrawn", :transmitteddate=>"2020", :unchangeddate=>"2019", :unpublished=>true, :updateddate=>"2018", :url=>"URL A", :vote_endeddate=>"2022", :vote_starteddate=>"2021", :xml=>"URL C"}
|
96
98
|
OUTPUT
|
97
99
|
end
|
98
100
|
|
@@ -166,7 +168,7 @@ OUTPUT
|
|
166
168
|
</version>
|
167
169
|
</iso-standard>
|
168
170
|
INPUT
|
169
|
-
{:accesseddate=>"XXX", :agency=>"ISO/IEC/IEEE", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05)", :edition=>nil, :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :partof=>"IEC 8122", :publisheddate=>"2011-01", :publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers", :receiveddate=>"XXX", :revdate=>"2016-05", :revdate_monthyear=>"May 2016", :stage=>"Published", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX"}
|
171
|
+
{:accesseddate=>"XXX", :agency=>"ISO/IEC/IEEE", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05)", :edition=>nil, :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :partof=>"IEC 8122", :publisheddate=>"2011-01", :publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers", :receiveddate=>"XXX", :revdate=>"2016-05", :revdate_monthyear=>"May 2016", :stage=>"Published", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX", :vote_endeddate=>"XXX", :vote_starteddate=>"XXX"}
|
170
172
|
OUTPUT
|
171
173
|
end
|
172
174
|
|
@@ -225,7 +227,7 @@ OUTPUT
|
|
225
227
|
</bibdata>
|
226
228
|
</iso-standard>
|
227
229
|
INPUT
|
228
|
-
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :publisheddate=>"2011-01", :publisher=>"International Organization for Standardization et International Electrotechnical Commission", :receiveddate=>"XXX", :revdate=>"2016-05", :revdate_monthyear=>"Mai 2016", :stage=>"Published", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX"}
|
230
|
+
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :publisheddate=>"2011-01", :publisher=>"International Organization for Standardization et International Electrotechnical Commission", :receiveddate=>"XXX", :revdate=>"2016-05", :revdate_monthyear=>"Mai 2016", :stage=>"Published", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX", :vote_endeddate=>"XXX", :vote_starteddate=>"XXX"}
|
229
231
|
OUTPUT
|
230
232
|
end
|
231
233
|
|
@@ -299,7 +299,7 @@ expect(File.exist?("test.doc")).to be true
|
|
299
299
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
300
300
|
<div class="WordSection3">
|
301
301
|
<p class="zzSTDTitle1"></p>
|
302
|
-
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and
|
302
|
+
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and Definitions</h1>
|
303
303
|
<p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
|
304
304
|
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
305
305
|
<p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
|
@@ -1316,7 +1316,11 @@ OUTPUT
|
|
1316
1316
|
<pagebreak orientation="portrait"/>
|
1317
1317
|
<p>And up</p>
|
1318
1318
|
</note>
|
1319
|
+
<pagebreak orientation="portrait"/>
|
1319
1320
|
</clause></sections>
|
1321
|
+
<annex id="_level_1" inline-header="false" obligation="normative">
|
1322
|
+
<title>Annex 1</title>
|
1323
|
+
</annex>
|
1320
1324
|
</standard-document>
|
1321
1325
|
INPUT
|
1322
1326
|
expect(File.exist?("test.doc")).to be true
|
@@ -1324,7 +1328,9 @@ OUTPUT
|
|
1324
1328
|
expect(html).to include "div.WordSection2_0 {page:WordSection2P;}"
|
1325
1329
|
expect(html).to include "div.WordSection2_1 {page:WordSection2L;}"
|
1326
1330
|
expect(html).to include "div.WordSection3_0 {page:WordSection3P;}"
|
1327
|
-
expect(html).to include "div.WordSection3_1 {page:
|
1331
|
+
expect(html).to include "div.WordSection3_1 {page:WordSection3P;}"
|
1332
|
+
expect(html).to include "div.WordSection3_2 {page:WordSection3L;}"
|
1333
|
+
|
1328
1334
|
|
1329
1335
|
expect(xmlpp(html.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1330
1336
|
<body lang='EN-US' xml:lang='EN-US' link='blue' vlink='#954F72'>
|
@@ -1335,9 +1341,9 @@ expect(xmlpp(html.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).
|
|
1335
1341
|
<br clear='all' class='section'/>
|
1336
1342
|
</p>
|
1337
1343
|
<div class='WordSection2'>
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1344
|
+
<p class='MsoNormal'>
|
1345
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1346
|
+
</p>
|
1341
1347
|
<div class='Section3' id=''>
|
1342
1348
|
<h1 class='IntroTitle'>Introduction</h1>
|
1343
1349
|
<p align='center' style='text-align:center' class='MsoNormal'>
|
@@ -1396,7 +1402,7 @@ expect(xmlpp(html.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).
|
|
1396
1402
|
</div>
|
1397
1403
|
</div>
|
1398
1404
|
</div>
|
1399
|
-
<div class='
|
1405
|
+
<div class='WordSection3_2'>
|
1400
1406
|
<p class='TableTitle' style='text-align:center;'>Table 1</p>
|
1401
1407
|
<div align='center' class='table_container'>
|
1402
1408
|
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
@@ -1433,8 +1439,24 @@ expect(xmlpp(html.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).
|
|
1433
1439
|
<br clear='all' class='section'/>
|
1434
1440
|
</p>
|
1435
1441
|
</div>
|
1436
|
-
<div class='
|
1442
|
+
<div class='WordSection3_1'>
|
1437
1443
|
<p class='Note'>And up</p>
|
1444
|
+
<p class='MsoNormal'>
|
1445
|
+
<br clear='all' class='section'/>
|
1446
|
+
</p>
|
1447
|
+
</div>
|
1448
|
+
<div class='WordSection3_0'>
|
1449
|
+
<div class='Section3'>
|
1450
|
+
<a name='_level_1' id='_level_1'/>
|
1451
|
+
<h1 class='Annex'>
|
1452
|
+
<b>Annex A</b>
|
1453
|
+
<br/>
|
1454
|
+
(normative)
|
1455
|
+
<br/>
|
1456
|
+
<br/>
|
1457
|
+
<b>Annex 1</b>
|
1458
|
+
</h1>
|
1459
|
+
</div>
|
1438
1460
|
</div>
|
1439
1461
|
<div style='mso-element:footnote-list'/>
|
1440
1462
|
</body>
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -188,7 +188,7 @@ RSpec.describe IsoDoc do
|
|
188
188
|
<div>
|
189
189
|
<h1>2.  Normative references</h1>
|
190
190
|
</div>
|
191
|
-
<div id="H"><h1>3.  Terms,
|
191
|
+
<div id="H"><h1>3.  Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
192
192
|
<div id="I">
|
193
193
|
<h2>3.1.  Normal Terms</h2>
|
194
194
|
<p class="TermNum" id="J">3.1.1.</p>
|
@@ -429,7 +429,7 @@ OUTPUT
|
|
429
429
|
<div>
|
430
430
|
<h1>2.<span style="mso-tab-count:1">  </span>Normative references</h1>
|
431
431
|
</div>
|
432
|
-
<div id="H"><h1>3.<span style="mso-tab-count:1">  </span>Terms,
|
432
|
+
<div id="H"><h1>3.<span style="mso-tab-count:1">  </span>Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
433
433
|
<div id="I">
|
434
434
|
<h2>3.1.<span style="mso-tab-count:1">  </span>Normal Terms</h2>
|
435
435
|
<p class="TermNum" id="J">3.1.1.</p>
|
@@ -669,7 +669,12 @@ OUTPUT
|
|
669
669
|
</div>
|
670
670
|
<p class='zzSTDTitle1'/>
|
671
671
|
<div id='H'>
|
672
|
-
|
672
|
+
<h1>
|
673
|
+
1.  Terms, Definitions, Symbols and Abbreviated Terms
|
674
|
+
<a rel='footnote' href='#fn:10' epub:type='footnote'>
|
675
|
+
<sup>10</sup>
|
676
|
+
</a>
|
677
|
+
</h1>
|
673
678
|
<div id='I'>
|
674
679
|
<h2>
|
675
680
|
1.1.  Normal Terms
|
@@ -872,7 +877,7 @@ OUTPUT
|
|
872
877
|
<div>
|
873
878
|
<h1>Normative references</h1>
|
874
879
|
</div>
|
875
|
-
<div id="H"><h1>Terms,
|
880
|
+
<div id="H"><h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
876
881
|
<div id="I"><h2>Normal Terms</h2>
|
877
882
|
|
878
883
|
<p class="TermNum" id="J">3.1.1.</p>
|
@@ -964,7 +969,7 @@ OUTPUT
|
|
964
969
|
INPUT
|
965
970
|
#{HTML_HDR}
|
966
971
|
<p class="zzSTDTitle1"/>
|
967
|
-
<div id="H"><h1>1.  Terms and
|
972
|
+
<div id="H"><h1>1.  Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
968
973
|
<p class="TermNum" id="J">1.1.</p>
|
969
974
|
<p class="Terms" style="text-align:left;">Term2</p>
|
970
975
|
</div>
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -28,7 +28,26 @@ RSpec.describe IsoDoc do
|
|
28
28
|
<modification>
|
29
29
|
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
30
30
|
</modification>
|
31
|
-
</termsource
|
31
|
+
</termsource>
|
32
|
+
|
33
|
+
<termsource status='identical'>
|
34
|
+
<origin citeas=''>
|
35
|
+
<termref base='IEV' target='xyz'>t1</termref>
|
36
|
+
</origin>
|
37
|
+
</termsource>
|
38
|
+
|
39
|
+
<termsource status='modified'>
|
40
|
+
<origin citeas=''>
|
41
|
+
<termref base='IEV' target='xyz'/>
|
42
|
+
</origin>
|
43
|
+
<modification>
|
44
|
+
<p id='_'>with adjustments</p>
|
45
|
+
</modification>
|
46
|
+
</termsource>
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</term>
|
32
51
|
|
33
52
|
<term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
|
34
53
|
<admitted>rough rice</admitted>
|
@@ -55,7 +74,7 @@ RSpec.describe IsoDoc do
|
|
55
74
|
INPUT
|
56
75
|
#{HTML_HDR}
|
57
76
|
<p class="zzSTDTitle1"/>
|
58
|
-
<div id="_terms_and_definitions"><h1>1.  Terms and
|
77
|
+
<div id="_terms_and_definitions"><h1>1.  Terms and Definitions</h1><p>For the purposes of this document,
|
59
78
|
the following terms and definitions apply.</p>
|
60
79
|
<p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
|
61
80
|
|
@@ -75,7 +94,10 @@ RSpec.describe IsoDoc do
|
|
75
94
|
<p>[TERMREF]
|
76
95
|
<a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
|
77
96
|
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
78
|
-
[/TERMREF]</p
|
97
|
+
[/TERMREF]</p>
|
98
|
+
<p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
|
99
|
+
<p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
|
100
|
+
<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>
|
79
101
|
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
80
102
|
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
81
103
|
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
@@ -122,7 +144,26 @@ OUTPUT
|
|
122
144
|
<modification>
|
123
145
|
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
124
146
|
</modification>
|
125
|
-
</termsource
|
147
|
+
</termsource>
|
148
|
+
|
149
|
+
<termsource status='identical'>
|
150
|
+
<origin citeas=''>
|
151
|
+
<termref base='IEV' target='xyz'>t1</termref>
|
152
|
+
</origin>
|
153
|
+
</termsource>
|
154
|
+
|
155
|
+
<termsource status='modified'>
|
156
|
+
<origin citeas=''>
|
157
|
+
<termref base='IEV' target='xyz'/>
|
158
|
+
</origin>
|
159
|
+
<modification>
|
160
|
+
<p id='_'>with adjustments</p>
|
161
|
+
</modification>
|
162
|
+
</termsource>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</term>
|
126
167
|
|
127
168
|
<term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
|
128
169
|
<admitted>rough rice</admitted>
|
@@ -149,7 +190,7 @@ OUTPUT
|
|
149
190
|
INPUT
|
150
191
|
#{WORD_HDR}
|
151
192
|
<p class="zzSTDTitle1"/>
|
152
|
-
<div id="_terms_and_definitions"><h1>1.<span style="mso-tab-count:1">  </span>Terms and
|
193
|
+
<div id="_terms_and_definitions"><h1>1.<span style="mso-tab-count:1">  </span>Terms and Definitions</h1><p>For the purposes of this document,
|
153
194
|
the following terms and definitions apply.</p>
|
154
195
|
<p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
|
155
196
|
|
@@ -169,7 +210,10 @@ OUTPUT
|
|
169
210
|
<p>[TERMREF]
|
170
211
|
<a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
|
171
212
|
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
172
|
-
[/TERMREF]</p
|
213
|
+
[/TERMREF]</p>
|
214
|
+
<p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
|
215
|
+
<p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
|
216
|
+
<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>
|
173
217
|
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
174
218
|
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
175
219
|
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -176,7 +176,7 @@ RSpec.describe IsoDoc do
|
|
176
176
|
<a href="#N">Note</a>
|
177
177
|
</p>
|
178
178
|
</div>
|
179
|
-
<div id="terms"><h1>2. 
|
179
|
+
<div id="terms"><h1>2.  </h1>
|
180
180
|
</div>
|
181
181
|
<div id="widgets">
|
182
182
|
<h1>3.  Widgets</h1>
|
@@ -345,7 +345,7 @@ RSpec.describe IsoDoc do
|
|
345
345
|
<a href="#N">Figure 2</a>
|
346
346
|
</p>
|
347
347
|
</div>
|
348
|
-
<div id="terms"><h1>2. 
|
348
|
+
<div id="terms"><h1>2.  </h1>
|
349
349
|
</div>
|
350
350
|
<div id="widgets">
|
351
351
|
<h1>3.  Widgets</h1>
|
@@ -492,7 +492,7 @@ RSpec.describe IsoDoc do
|
|
492
492
|
<div id="scope">
|
493
493
|
<h1>1.  Scope</h1>
|
494
494
|
</div>
|
495
|
-
<div id="terms"><h1>2. 
|
495
|
+
<div id="terms"><h1>2.  </h1>
|
496
496
|
</div>
|
497
497
|
<div id="widgets">
|
498
498
|
<h1>3.  Widgets</h1>
|
@@ -642,7 +642,7 @@ RSpec.describe IsoDoc do
|
|
642
642
|
<a href="#N">Example</a>
|
643
643
|
</p>
|
644
644
|
</div>
|
645
|
-
<div id="terms"><h1>2. 
|
645
|
+
<div id="terms"><h1>2.  </h1>
|
646
646
|
</div>
|
647
647
|
<div id="widgets">
|
648
648
|
<h1>3.  Widgets</h1>
|
@@ -781,7 +781,7 @@ RSpec.describe IsoDoc do
|
|
781
781
|
<a href="#N">Formula (2)</a>
|
782
782
|
</p>
|
783
783
|
</div>
|
784
|
-
<div id="terms"><h1>2. 
|
784
|
+
<div id="terms"><h1>2.  </h1>
|
785
785
|
</div>
|
786
786
|
<div id="widgets">
|
787
787
|
<h1>3.  Widgets</h1>
|
@@ -916,7 +916,7 @@ RSpec.describe IsoDoc do
|
|
916
916
|
<a href="#N">Requirement 2</a>
|
917
917
|
</p>
|
918
918
|
</div>
|
919
|
-
<div id="terms"><h1>2. 
|
919
|
+
<div id="terms"><h1>2.  </h1>
|
920
920
|
</div>
|
921
921
|
<div id="widgets">
|
922
922
|
<h1>3.  Widgets</h1>
|
@@ -1061,7 +1061,7 @@ OUTPUT
|
|
1061
1061
|
<a href="#N">Recommendation 2</a>
|
1062
1062
|
</p>
|
1063
1063
|
</div>
|
1064
|
-
<div id="terms"><h1>2. 
|
1064
|
+
<div id="terms"><h1>2.  </h1>
|
1065
1065
|
</div>
|
1066
1066
|
<div id="widgets">
|
1067
1067
|
<h1>3.  Widgets</h1>
|
@@ -1206,7 +1206,7 @@ OUTPUT
|
|
1206
1206
|
<a href="#N">Permission 2</a>
|
1207
1207
|
</p>
|
1208
1208
|
</div>
|
1209
|
-
<div id="terms"><h1>2. 
|
1209
|
+
<div id="terms"><h1>2.  </h1>
|
1210
1210
|
</div>
|
1211
1211
|
<div id="widgets">
|
1212
1212
|
<h1>3.  Widgets</h1>
|
@@ -1520,7 +1520,7 @@ OUTPUT
|
|
1520
1520
|
<a href="#N">Table 2</a>
|
1521
1521
|
</p>
|
1522
1522
|
</div>
|
1523
|
-
<div id="terms"><h1>2. 
|
1523
|
+
<div id="terms"><h1>2.  </h1>
|
1524
1524
|
</div>
|
1525
1525
|
<div id="widgets">
|
1526
1526
|
<h1>3.  Widgets</h1>
|
@@ -1599,7 +1599,7 @@ OUTPUT
|
|
1599
1599
|
<div id="scope">
|
1600
1600
|
<h1>1.  Scope</h1>
|
1601
1601
|
</div>
|
1602
|
-
<div id="terms"><h1>2. 
|
1602
|
+
<div id="terms"><h1>2.  </h1>
|
1603
1603
|
<p class="TermNum" id="_waxy_rice">2.1.</p><p class="Terms" style="text-align:left;">waxy rice</p>
|
1604
1604
|
<div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div><p class="TermNum" id="_nonwaxy_rice">2.2.</p><p class="Terms" style="text-align:left;">nonwaxy rice</p>
|
1605
1605
|
<div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
|
@@ -1875,7 +1875,7 @@ OUTPUT
|
|
1875
1875
|
<li><p>A</p></li>
|
1876
1876
|
</ol>
|
1877
1877
|
</div>
|
1878
|
-
<div id="terms"><h1>2. 
|
1878
|
+
<div id="terms"><h1>2.  </h1>
|
1879
1879
|
</div>
|
1880
1880
|
<div id="widgets">
|
1881
1881
|
<h1>3.  Widgets</h1>
|
@@ -2014,7 +2014,7 @@ OUTPUT
|
|
2014
2014
|
<li id="N"><p>A</p></li>
|
2015
2015
|
</ol>
|
2016
2016
|
</div>
|
2017
|
-
<div id="terms"><h1>2. 
|
2017
|
+
<div id="terms"><h1>2.  </h1>
|
2018
2018
|
</div>
|
2019
2019
|
<div id="widgets">
|
2020
2020
|
<h1>3.  Widgets</h1>
|
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.0.
|
4
|
+
version: 1.0.25
|
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-
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|