isodoc 1.2.8 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/lib/isodoc/base_style/blocks.scss +2 -2
- data/lib/isodoc/base_style/typography.scss +1 -1
- data/lib/isodoc/convert.rb +12 -84
- data/lib/isodoc/css.rb +95 -0
- data/lib/isodoc/function/lists.rb +2 -1
- data/lib/isodoc/function/references.rb +7 -12
- data/lib/isodoc/html_function/postprocess.rb +11 -3
- data/lib/isodoc/presentation_function/bibdata.rb +3 -3
- data/lib/isodoc/presentation_function/inline.rb +5 -3
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +0 -20
- data/lib/isodoc/xref/xref_counter.rb +20 -9
- data/lib/isodoc/xref/xref_gen.rb +2 -2
- data/spec/assets/html.scss +14 -0
- data/spec/isodoc/lists_spec.rb +1 -1
- data/spec/isodoc/postproc_spec.rb +32 -8
- data/spec/isodoc/presentation_xml_spec.rb +2 -2
- data/spec/isodoc/ref_spec.rb +323 -5
- data/spec/isodoc/xref_spec.rb +17 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1edc88536663d06a4d23249a6ec1909148185456f84a427fe2299da8e138ab4
|
4
|
+
data.tar.gz: fd6099657296706882b03eb557f59b242c733415b9d49fe8bf4e3aa73bd67eb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4112c5b84d25a09e9d701b9735d80e01e9f4bf294288c097524c83e31689dc90c1dd9168e9f70061868d41c032d2b864a96b76b19f0926584a2549a1f5309a63
|
7
|
+
data.tar.gz: b002124056e50a37732ad78fa9e959658b0f07c9f5af9d248f69c0d282cc74804471124fc4b7f150ba19935e3aa904df0d54222fb201e279d6325ebfffe9def8
|
data/.github/workflows/rake.yml
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
}
|
51
51
|
|
52
52
|
background-color: $colorBg;
|
53
|
-
font-size:
|
53
|
+
font-size: $monospacefontsize;
|
54
54
|
line-height: 1.6em;
|
55
55
|
padding: 1.5em;
|
56
56
|
margin: 2em 0 1em 0;
|
@@ -68,7 +68,7 @@
|
|
68
68
|
}
|
69
69
|
|
70
70
|
background-color: $colorBg;
|
71
|
-
font-size:
|
71
|
+
font-size: $monospacefontsize;
|
72
72
|
line-height: 1.6em;
|
73
73
|
padding: 1.5em;
|
74
74
|
margin: 2em 0 1em 0;
|
data/lib/isodoc/convert.rb
CHANGED
@@ -3,6 +3,7 @@ require "isodoc/common"
|
|
3
3
|
require "fileutils"
|
4
4
|
require "tempfile"
|
5
5
|
require_relative "i18n"
|
6
|
+
require_relative "css"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
class Convert < ::IsoDoc::Common
|
@@ -17,6 +18,10 @@ module IsoDoc
|
|
17
18
|
# wordcoverpage: Cover page for Word
|
18
19
|
# htmlintropage: Introductory page for HTML
|
19
20
|
# wordintropage: Introductory page for Word
|
21
|
+
# normalfontsize: Font size for body text
|
22
|
+
# smallerfontsize: Font size for smaller than body text
|
23
|
+
# monospacefontsize: Font size for monospace font
|
24
|
+
# footnotefontsize: Font size for footnotes
|
20
25
|
# i18nyaml: YAML file for internationalisation of text
|
21
26
|
# ulstyle: list style in Word CSS for unordered lists
|
22
27
|
# olstyle: list style in Word CSS for ordered lists
|
@@ -25,8 +30,10 @@ module IsoDoc
|
|
25
30
|
# monospace: font to use for monospace text
|
26
31
|
# suppressheadingnumbers: suppress heading numbers for clauses
|
27
32
|
# scripts: Scripts file for HTML
|
28
|
-
# scripts_pdf: Scripts file for PDF
|
33
|
+
# scripts_pdf: Scripts file for PDF (not used in XSLT PDF)
|
29
34
|
# datauriimage: Encode images in HTML output as data URIs
|
35
|
+
# break_up_urls_in_tables: whether to insert spaces in URLs in tables
|
36
|
+
# every 40-odd chars
|
30
37
|
def initialize(options)
|
31
38
|
@libdir ||= File.dirname(__FILE__)
|
32
39
|
options.merge!(default_fonts(options)) do |_, old, new|
|
@@ -46,6 +53,10 @@ module IsoDoc
|
|
46
53
|
@wordcoverpage = options[:wordcoverpage]
|
47
54
|
@htmlintropage = options[:htmlintropage]
|
48
55
|
@wordintropage = options[:wordintropage]
|
56
|
+
@normalfontsize = options[:normalfontsize]
|
57
|
+
@smallerfontsize = options[:smallerfontsize]
|
58
|
+
@monospacefontsize = options[:monospacefontsize]
|
59
|
+
@footnotefontsize = options[:footnotefontsize]
|
49
60
|
@scripts = options[:scripts]
|
50
61
|
@scripts_pdf = options[:scripts_pdf]
|
51
62
|
@i18nyaml = options[:i18nyaml]
|
@@ -80,62 +91,10 @@ module IsoDoc
|
|
80
91
|
@fn_bookmarks = {}
|
81
92
|
end
|
82
93
|
|
83
|
-
# Check if already compiled version(.css) exists,
|
84
|
-
# if not, return original scss file. During release
|
85
|
-
# we compile scss into css files in order to not depend on scss
|
86
|
-
def precompiled_style_or_original(stylesheet_path)
|
87
|
-
# Already have compiled stylesheet, use it
|
88
|
-
return stylesheet_path if stylesheet_path.nil? ||
|
89
|
-
File.extname(stylesheet_path) == '.css'
|
90
|
-
|
91
|
-
basename = File.basename(stylesheet_path, '.*')
|
92
|
-
compiled_path = File.join(File.dirname(stylesheet_path),
|
93
|
-
"#{basename}.css")
|
94
|
-
return stylesheet_path unless File.file?(compiled_path)
|
95
|
-
|
96
|
-
compiled_path
|
97
|
-
end
|
98
|
-
|
99
|
-
# run this after @meta is populated
|
100
|
-
def populate_css
|
101
|
-
@htmlstylesheet = generate_css(@htmlstylesheet_name, true)
|
102
|
-
@wordstylesheet = generate_css(@wordstylesheet_name, false)
|
103
|
-
@standardstylesheet = generate_css(@standardstylesheet_name, false)
|
104
|
-
end
|
105
|
-
|
106
94
|
def tmpimagedir_suffix
|
107
95
|
'_images'
|
108
96
|
end
|
109
97
|
|
110
|
-
def default_fonts(_options)
|
111
|
-
{
|
112
|
-
bodyfont: 'Arial',
|
113
|
-
headerfont: 'Arial',
|
114
|
-
monospacefont: 'Courier'
|
115
|
-
}
|
116
|
-
end
|
117
|
-
|
118
|
-
# none for this parent gem, but will be populated in child gems
|
119
|
-
# which have access to stylesheets &c
|
120
|
-
def default_file_locations(_options)
|
121
|
-
{}
|
122
|
-
end
|
123
|
-
|
124
|
-
def fonts_options
|
125
|
-
{
|
126
|
-
'bodyfont' => options[:bodyfont] || 'Arial',
|
127
|
-
'headerfont' => options[:headerfont] || 'Arial',
|
128
|
-
'monospacefont' => options[:monospacefont] || 'Courier'
|
129
|
-
}
|
130
|
-
end
|
131
|
-
|
132
|
-
def scss_fontheader
|
133
|
-
b = options[:bodyfont] || 'Arial'
|
134
|
-
h = options[:headerfont] || 'Arial'
|
135
|
-
m = options[:monospacefont] || 'Courier'
|
136
|
-
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
|
137
|
-
end
|
138
|
-
|
139
98
|
def html_doc_path(*file)
|
140
99
|
file.each do |f|
|
141
100
|
ret = File.join(@libdir, File.join('html', f))
|
@@ -144,37 +103,6 @@ module IsoDoc
|
|
144
103
|
nil
|
145
104
|
end
|
146
105
|
|
147
|
-
def convert_scss(filename, stylesheet)
|
148
|
-
require 'sassc'
|
149
|
-
require 'isodoc/sassc_importer'
|
150
|
-
|
151
|
-
[File.join(Gem.loaded_specs['isodoc'].full_gem_path,
|
152
|
-
'lib', 'isodoc'),
|
153
|
-
File.dirname(filename)].each do |name|
|
154
|
-
SassC.load_paths << name
|
155
|
-
end
|
156
|
-
SassC::Engine.new(scss_fontheader + stylesheet, syntax: :scss,
|
157
|
-
importer: SasscImporter)
|
158
|
-
.render
|
159
|
-
end
|
160
|
-
|
161
|
-
def generate_css(filename, stripwordcss)
|
162
|
-
return nil if filename.nil?
|
163
|
-
|
164
|
-
filename = precompiled_style_or_original(filename)
|
165
|
-
stylesheet = File.read(filename, encoding: 'UTF-8')
|
166
|
-
stylesheet = populate_template(stylesheet, :word)
|
167
|
-
stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m, '\\1') if stripwordcss
|
168
|
-
if File.extname(filename) == '.scss'
|
169
|
-
stylesheet = convert_scss(filename, stylesheet)
|
170
|
-
end
|
171
|
-
Tempfile.open([File.basename(filename, '.*'), 'css'],
|
172
|
-
encoding: 'utf-8') do |f|
|
173
|
-
f.write(stylesheet)
|
174
|
-
f
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
106
|
def convert1(docxml, filename, dir)
|
179
107
|
@xrefs.parse docxml
|
180
108
|
noko do |xml|
|
data/lib/isodoc/css.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
class Convert < ::IsoDoc::Common
|
3
|
+
# Check if already compiled version(.css) exists,
|
4
|
+
# if not, return original scss file. During release
|
5
|
+
# we compile scss into css files in order to not depend on scss
|
6
|
+
def precompiled_style_or_original(stylesheet_path)
|
7
|
+
# Already have compiled stylesheet, use it
|
8
|
+
return stylesheet_path if stylesheet_path.nil? ||
|
9
|
+
File.extname(stylesheet_path) == '.css'
|
10
|
+
basename = File.basename(stylesheet_path, '.*')
|
11
|
+
compiled_path = File.join(File.dirname(stylesheet_path),
|
12
|
+
"#{basename}.css")
|
13
|
+
return stylesheet_path unless File.file?(compiled_path)
|
14
|
+
compiled_path
|
15
|
+
end
|
16
|
+
|
17
|
+
# run this after @meta is populated
|
18
|
+
def populate_css
|
19
|
+
@htmlstylesheet = generate_css(@htmlstylesheet_name, true)
|
20
|
+
@wordstylesheet = generate_css(@wordstylesheet_name, false)
|
21
|
+
@standardstylesheet = generate_css(@standardstylesheet_name, false)
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_fonts(_options)
|
25
|
+
{
|
26
|
+
bodyfont: 'Arial',
|
27
|
+
headerfont: 'Arial',
|
28
|
+
monospacefont: 'Courier',
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# none for this parent gem, but will be populated in child gems
|
33
|
+
# which have access to stylesheets &c
|
34
|
+
def default_file_locations(_options)
|
35
|
+
{}
|
36
|
+
end
|
37
|
+
|
38
|
+
def fonts_options
|
39
|
+
{
|
40
|
+
'bodyfont' => options[:bodyfont] || 'Arial',
|
41
|
+
'headerfont' => options[:headerfont] || 'Arial',
|
42
|
+
'monospacefont' => options[:monospacefont] || 'Courier',
|
43
|
+
"normalfontsize" => options[:normalfontsize],
|
44
|
+
"monospacefontsize" => options[:monospacefontsize],
|
45
|
+
"smallerfontsize" => options[:smallerfontsize],
|
46
|
+
"footnotefontsize" => options[:footnotefontsize]
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def scss_fontheader(is_html_css)
|
51
|
+
b = options[:bodyfont] || 'Arial'
|
52
|
+
h = options[:headerfont] || 'Arial'
|
53
|
+
m = options[:monospacefont] || 'Courier'
|
54
|
+
ns = options[:normalfontsize] || (is_html_css ? "1.0em" : '12.0pt')
|
55
|
+
ms = options[:monospacefontsize] || (is_html_css ? "0.8em" : '11.0pt')
|
56
|
+
ss = options[:smallerfontsize] || (is_html_css ? "0.9em" : '10.0pt')
|
57
|
+
fs = options[:footnotefontsize] || (is_html_css ? "0.9em" : '9.0pt')
|
58
|
+
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"\
|
59
|
+
"$normalfontsize: #{ns};\n$monospacefontsize: #{ms};\n"\
|
60
|
+
"$smallerfontsize: #{ss};\n$footnotefontsize: #{fs};\n"
|
61
|
+
end
|
62
|
+
|
63
|
+
def convert_scss(filename, stylesheet, stripwordcss)
|
64
|
+
require 'sassc'
|
65
|
+
require 'isodoc/sassc_importer'
|
66
|
+
|
67
|
+
[File.join(Gem.loaded_specs['isodoc'].full_gem_path,
|
68
|
+
'lib', 'isodoc'),
|
69
|
+
File.dirname(filename)].each do |name|
|
70
|
+
SassC.load_paths << name
|
71
|
+
end
|
72
|
+
SassC::Engine.new(scss_fontheader(stripwordcss) + stylesheet,
|
73
|
+
syntax: :scss, importer: SasscImporter)
|
74
|
+
.render
|
75
|
+
end
|
76
|
+
|
77
|
+
# stripwordcss if HTML stylesheet, !stripwordcss if DOC stylesheet
|
78
|
+
def generate_css(filename, stripwordcss)
|
79
|
+
return nil if filename.nil?
|
80
|
+
|
81
|
+
filename = precompiled_style_or_original(filename)
|
82
|
+
stylesheet = File.read(filename, encoding: 'UTF-8')
|
83
|
+
stylesheet = populate_template(stylesheet, :word)
|
84
|
+
stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m, '\\1') if stripwordcss
|
85
|
+
if File.extname(filename) == '.scss'
|
86
|
+
stylesheet = convert_scss(filename, stylesheet, stripwordcss)
|
87
|
+
end
|
88
|
+
Tempfile.open([File.basename(filename, '.*'), 'css'],
|
89
|
+
encoding: 'utf-8') do |f|
|
90
|
+
f.write(stylesheet)
|
91
|
+
f
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -38,7 +38,8 @@ module IsoDoc::Function
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def ol_attrs(node)
|
41
|
-
{ type:
|
41
|
+
{ type: node["type"] ? ol_style(node["type"].to_sym) : ol_depth(node),
|
42
|
+
id: node["id"], style: keep_style(node) }
|
42
43
|
end
|
43
44
|
|
44
45
|
def ol_parse(node, out)
|
@@ -80,7 +80,8 @@ module IsoDoc::Function
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def docid_prefix(prefix, docid)
|
83
|
-
docid = "#{prefix} #{docid}" if prefix && !omit_docid_prefix(prefix)
|
83
|
+
docid = "#{prefix} #{docid}" if prefix && !omit_docid_prefix(prefix) &&
|
84
|
+
!/^#{prefix}\b/.match(docid)
|
84
85
|
docid_l10n(docid)
|
85
86
|
end
|
86
87
|
|
@@ -111,7 +112,7 @@ module IsoDoc::Function
|
|
111
112
|
# reference not to be rendered because it is deemed implicit
|
112
113
|
# in the standards environment
|
113
114
|
def implicit_reference(b)
|
114
|
-
|
115
|
+
b["hidden"] == "true"
|
115
116
|
end
|
116
117
|
|
117
118
|
def prefix_bracketed_ref(ref, text)
|
@@ -160,7 +161,7 @@ module IsoDoc::Function
|
|
160
161
|
end
|
161
162
|
|
162
163
|
def norm_ref(isoxml, out, num)
|
163
|
-
f = isoxml.at(ns(norm_ref_xpath)) or return num
|
164
|
+
f = isoxml.at(ns(norm_ref_xpath)) and f["hidden"] != "true" or return num
|
164
165
|
out.div do |div|
|
165
166
|
num = num + 1
|
166
167
|
clause_name(num, f.at(ns("./title")), div, nil)
|
@@ -180,10 +181,9 @@ module IsoDoc::Function
|
|
180
181
|
end
|
181
182
|
|
182
183
|
def bibliography(isoxml, out)
|
183
|
-
f = isoxml.at(ns(bibliography_xpath))
|
184
|
+
f = isoxml.at(ns(bibliography_xpath)) and f["hidden"] != "true" or return
|
184
185
|
page_break(out)
|
185
186
|
out.div do |div|
|
186
|
-
#div.h1 @bibliography_lbl, **{ class: "Section3" }
|
187
187
|
div.h1 **{class: "Section3"} do |h1|
|
188
188
|
f&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
|
189
189
|
end
|
@@ -192,6 +192,7 @@ module IsoDoc::Function
|
|
192
192
|
end
|
193
193
|
|
194
194
|
def bibliography_parse(node, out)
|
195
|
+
node["hidden"] != true or return
|
195
196
|
title = node&.at(ns("./title"))&.text || ""
|
196
197
|
out.div do |div|
|
197
198
|
clause_parse_title(node, div, node.at(ns("./title")), out,
|
@@ -202,15 +203,9 @@ module IsoDoc::Function
|
|
202
203
|
|
203
204
|
def format_ref(ref, prefix, isopub, date, allparts)
|
204
205
|
ref = docid_prefix(prefix, ref)
|
205
|
-
return "[#{ref}]" if /^\d+$/.match(ref) && !prefix &&
|
206
|
+
return "[#{ref}]" if ref && /^\d+$/.match(ref) && !prefix &&
|
206
207
|
!/^\[.*\]$/.match(ref)
|
207
208
|
ref
|
208
209
|
end
|
209
|
-
|
210
|
-
# def ref_names(ref)
|
211
|
-
# linkend = ref.text
|
212
|
-
# linkend.gsub!(/[\[\]]/, "") unless /^\[\d+\]$/.match linkend
|
213
|
-
# @anchors[ref["id"]] = { xref: linkend }
|
214
|
-
# end
|
215
210
|
end
|
216
211
|
end
|
@@ -186,14 +186,22 @@ module IsoDoc::HtmlFunction
|
|
186
186
|
docxml
|
187
187
|
end
|
188
188
|
|
189
|
+
def footnote_backlinks1(x, fn)
|
190
|
+
xdup = x.dup
|
191
|
+
xdup.remove["id"]
|
192
|
+
if fn.elements.empty?
|
193
|
+
fn.children.first.previous = xdup
|
194
|
+
else
|
195
|
+
fn.elements.first.children.first.previous = xdup
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
189
199
|
def footnote_backlinks(docxml)
|
190
200
|
seen = {}
|
191
201
|
docxml.xpath('//a[@class = "FootnoteRef"]').each_with_index do |x, i|
|
192
202
|
seen[x["href"]] and next or seen[x["href"]] = true
|
193
203
|
fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
|
194
|
-
|
195
|
-
xdup.remove["id"]
|
196
|
-
fn.elements.first.children.first.previous = xdup
|
204
|
+
footnote_backlinks1(x, fn)
|
197
205
|
x["id"] ||= "fnref:#{i + 1}"
|
198
206
|
fn.add_child "<a href='##{x['id']}'>↩</a>"
|
199
207
|
end
|
@@ -25,13 +25,13 @@ module IsoDoc
|
|
25
25
|
hash_translate(b, @i18n.get["substage_dict"], "./status/substage")
|
26
26
|
end
|
27
27
|
|
28
|
-
def hash_translate(bibdata, hash, xpath)
|
28
|
+
def hash_translate(bibdata, hash, xpath, lang = @lang)
|
29
29
|
x = bibdata.at(ns(xpath)) or return
|
30
30
|
x["language"] = ""
|
31
31
|
hash.is_a? Hash or return
|
32
32
|
hash[x.text] or return
|
33
33
|
x.next = x.dup
|
34
|
-
x.next["language"] =
|
34
|
+
x.next["language"] = lang
|
35
35
|
x.next.children = hash[x.text]
|
36
36
|
end
|
37
37
|
|
@@ -40,7 +40,7 @@ module IsoDoc
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def i18n_safe(k)
|
43
|
-
k.gsub(/\s|\./, "_")
|
43
|
+
k.to_s.gsub(/\s|\./, "_")
|
44
44
|
end
|
45
45
|
|
46
46
|
def i8n_name(h, pref)
|
@@ -164,14 +164,16 @@ module IsoDoc
|
|
164
164
|
def localize_maths(f, locale)
|
165
165
|
f.xpath(".//m:mn", MATHML).each do |x|
|
166
166
|
num = /\./.match(x.text) ? x.text.to_f : x.text.to_i
|
167
|
-
x.
|
167
|
+
precision = /\./.match(x.text) ? x.text.sub(/^.*\./, "").size : 0
|
168
|
+
x.children = localized_number(num, locale, precision)
|
168
169
|
end
|
169
170
|
end
|
170
171
|
|
171
172
|
# By itself twiiter cldr does not support fraction part digits grouping
|
172
173
|
# and custom delimeter, will decorate fraction part manually
|
173
|
-
def localized_number(num, locale)
|
174
|
-
localized = num.localize(locale).to_s
|
174
|
+
def localized_number(num, locale, precision)
|
175
|
+
localized = precision == 0 ? num.localize(locale).to_s :
|
176
|
+
num.localize(locale).to_decimal.to_s(:precision => precision)
|
175
177
|
twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
|
176
178
|
return localized unless twitter_cldr_reader_symbols[:decimal]
|
177
179
|
integer, fraction = localized.split(twitter_cldr_reader_symbols[:decimal])
|
data/lib/isodoc/version.rb
CHANGED
data/lib/isodoc/word_convert.rb
CHANGED
@@ -4,26 +4,6 @@ require_relative "word_function/body.rb"
|
|
4
4
|
require_relative "word_function/postprocess.rb"
|
5
5
|
|
6
6
|
module IsoDoc
|
7
|
-
|
8
|
-
=begin
|
9
|
-
module WordConvertModule
|
10
|
-
# http://tech.tulentsev.com/2012/02/ruby-how-to-override-class-method-with-a-module/
|
11
|
-
# https://www.ruby-forum.com/topic/148303
|
12
|
-
#
|
13
|
-
# The following is ugly indeed, but the only way I can split module override methods
|
14
|
-
# across files
|
15
|
-
def self.included base
|
16
|
-
base.class_eval do
|
17
|
-
|
18
|
-
eval File.open(File.join(File.dirname(__FILE__),"wordconvertmodule.rb")).read
|
19
|
-
eval File.open(File.join(File.dirname(__FILE__),"comments.rb")).read
|
20
|
-
eval File.open(File.join(File.dirname(__FILE__),"footnotes.rb")).read
|
21
|
-
eval File.open(File.join(File.dirname(__FILE__),"postprocess.rb")).read
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
=end
|
26
|
-
|
27
7
|
class WordConvert < ::IsoDoc::Convert
|
28
8
|
include WordFunction::Comments
|
29
9
|
include WordFunction::Footnotes
|
@@ -2,8 +2,8 @@ require "roman-numerals"
|
|
2
2
|
|
3
3
|
module IsoDoc::XrefGen
|
4
4
|
class Counter
|
5
|
-
def initialize
|
6
|
-
@num =
|
5
|
+
def initialize(num = 0)
|
6
|
+
@num = num
|
7
7
|
@letter = ""
|
8
8
|
@subseq = ""
|
9
9
|
@letter_override = nil
|
@@ -76,13 +76,24 @@ module IsoDoc::XrefGen
|
|
76
76
|
"#{@base}#{@number_override || @num}#{@letter_override || @letter}"
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
80
|
-
return
|
81
|
-
return
|
82
|
-
return
|
83
|
-
return
|
84
|
-
return
|
85
|
-
return
|
79
|
+
def ol_type(list, depth)
|
80
|
+
return list["type"].to_sym if list["type"]
|
81
|
+
return :arabic if [2, 7].include? depth
|
82
|
+
return :alphabet if [1, 6].include? depth
|
83
|
+
return :alphabet_upper if [4, 9].include? depth
|
84
|
+
return :roman if [3, 8].include? depth
|
85
|
+
return :roman_upper if [5, 10].include? depth
|
86
|
+
return :arabic
|
87
|
+
end
|
88
|
+
|
89
|
+
def listlabel(list, depth)
|
90
|
+
case ol_type(list, depth)
|
91
|
+
when :arabic then @num.to_s
|
92
|
+
when :alphabet then (96 + @num).chr.to_s
|
93
|
+
when :alphabet_upper then (64 + @num).chr.to_s
|
94
|
+
when :roman then RomanNumerals.to_roman(@num).downcase
|
95
|
+
when :roman_upper then RomanNumerals.to_roman(@num).upcase
|
96
|
+
end
|
86
97
|
end
|
87
98
|
end
|
88
99
|
end
|
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -123,9 +123,9 @@ module IsoDoc::XrefGen
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
|
126
|
-
c = Counter.new
|
126
|
+
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
|
127
127
|
list.xpath(ns("./li")).each do |li|
|
128
|
-
label = c.increment(li).listlabel(depth)
|
128
|
+
label = c.increment(li).listlabel(list, depth)
|
129
129
|
label = "#{prev_label}.#{label}" unless prev_label.empty?
|
130
130
|
label = "#{list_anchor[:xref]} #{label}" if refer_list
|
131
131
|
li["id"] and @anchors[li["id"]] =
|
data/spec/assets/html.scss
CHANGED
@@ -3,4 +3,18 @@
|
|
3
3
|
|
4
4
|
p {
|
5
5
|
font-family: $bodyfont;
|
6
|
+
font-size: $normalfontsize;
|
7
|
+
}
|
8
|
+
code {
|
9
|
+
font-family: $monospacefont;
|
10
|
+
font-size: $monospacefontsize;
|
11
|
+
}
|
12
|
+
aside {
|
13
|
+
font-size: $footnotefontsize;
|
14
|
+
}
|
15
|
+
h1 {
|
16
|
+
font-family: $headerfont;
|
17
|
+
}
|
18
|
+
p.note {
|
19
|
+
font-size: $smallerfontsize;
|
6
20
|
}
|
data/spec/isodoc/lists_spec.rb
CHANGED
@@ -203,7 +203,7 @@ RSpec.describe IsoDoc do
|
|
203
203
|
<br/>
|
204
204
|
<div>
|
205
205
|
<h1 class="ForewordTitle">Foreword</h1>
|
206
|
-
<ol type="
|
206
|
+
<ol type="I" id="_ae34a226-aab4-496d-987b-1aa7b6314026">
|
207
207
|
<li id="_ae34a226-aab4-496d-987b-1aa7b6314027">
|
208
208
|
<p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
|
209
209
|
</li>
|
@@ -139,7 +139,7 @@ expect(File.exist?("test.doc")).to be true
|
|
139
139
|
it "generates HTML output docs with complete configuration" do
|
140
140
|
FileUtils.rm_f "test.doc"
|
141
141
|
FileUtils.rm_f "test.html"
|
142
|
-
IsoDoc::HtmlConvert.new({bodyfont: "Zapf", htmlstylesheet: "spec/assets/html.scss", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
|
142
|
+
IsoDoc::HtmlConvert.new({bodyfont: "Zapf", monospacefont: "Consolas", headerfont: "Comic Sans", normalfontsize: "30pt", monospacefontsize: "29pt", smallerfontsize: "28pt", footnotefontsize: "27pt", htmlstylesheet: "spec/assets/html.scss", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
|
143
143
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
144
144
|
<preface><foreword>
|
145
145
|
<note>
|
@@ -150,7 +150,13 @@ expect(File.exist?("test.doc")).to be true
|
|
150
150
|
INPUT
|
151
151
|
html = File.read("test.html")
|
152
152
|
expect(html).to match(/another empty stylesheet/)
|
153
|
-
expect(html).to match(/font-family: Zapf/)
|
153
|
+
expect(html).to match(/p \{[^}]*?font-family: Zapf/m)
|
154
|
+
expect(html).to match(/code \{[^}]*?font-family: Consolas/m)
|
155
|
+
expect(html).to match(/h1 \{[^}]*?font-family: Comic Sans/m)
|
156
|
+
expect(html).to match(/p \{[^}]*?font-size: 30pt/m)
|
157
|
+
expect(html).to match(/code \{[^}]*?font-size: 29pt/m)
|
158
|
+
expect(html).to match(/p\.note \{[^}]*?font-size: 28pt/m)
|
159
|
+
expect(html).to match(/aside \{[^}]*?font-size: 27pt/m)
|
154
160
|
expect(html).to match(/an empty html cover page/)
|
155
161
|
expect(html).to match(/an empty html intro page/)
|
156
162
|
expect(html).to match(/This is > a script/)
|
@@ -172,7 +178,13 @@ expect(File.exist?("test.doc")).to be true
|
|
172
178
|
INPUT
|
173
179
|
html = File.read("test.html")
|
174
180
|
expect(html).to match(/another empty stylesheet/)
|
175
|
-
expect(html).to match(/font-family: Arial/)
|
181
|
+
expect(html).to match(/p \{[^}]*?font-family: Arial/m)
|
182
|
+
expect(html).to match(/code \{[^}]*?font-family: Courier/m)
|
183
|
+
expect(html).to match(/h1 \{[^}]*?font-family: Arial/m)
|
184
|
+
expect(html).to match(/p \{[^}]*?font-size: 1em;/m)
|
185
|
+
expect(html).to match(/code \{[^}]*?font-size: 0.8em/m)
|
186
|
+
expect(html).to match(/p\.note \{[^}]*?font-size: 0.9em/m)
|
187
|
+
expect(html).to match(/aside \{[^}]*?font-size: 0.9em/m)
|
176
188
|
expect(html).to match(/an empty html cover page/)
|
177
189
|
expect(html).to match(/an empty html intro page/)
|
178
190
|
expect(html).to match(/This is > a script/)
|
@@ -183,7 +195,7 @@ expect(File.exist?("test.doc")).to be true
|
|
183
195
|
it "generates Word output docs with complete configuration" do
|
184
196
|
FileUtils.rm_f "test.doc"
|
185
197
|
FileUtils.rm_f "test.html"
|
186
|
-
IsoDoc::WordConvert.new({bodyfont: "Zapf", wordstylesheet: "spec/assets/html.scss", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
|
198
|
+
IsoDoc::WordConvert.new({bodyfont: "Zapf", monospacefont: "Consolas", headerfont: "Comic Sans", normalfontsize: "30pt", monospacefontsize: "29pt", smallerfontsize: "28pt", footnotefontsize: "27pt", wordstylesheet: "spec/assets/html.scss", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
|
187
199
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
188
200
|
<preface><foreword>
|
189
201
|
<note>
|
@@ -194,7 +206,13 @@ expect(File.exist?("test.doc")).to be true
|
|
194
206
|
INPUT
|
195
207
|
word = File.read("test.doc")
|
196
208
|
expect(word).to match(/another empty stylesheet/)
|
197
|
-
expect(word).to match(/font-family: Zapf/)
|
209
|
+
expect(word).to match(/p \{[^}]*?font-family: Zapf/m)
|
210
|
+
expect(word).to match(/code \{[^}]*?font-family: Consolas/m)
|
211
|
+
expect(word).to match(/h1 \{[^}]*?font-family: Comic Sans/m)
|
212
|
+
expect(word).to match(/p \{[^}]*?font-size: 30pt/m)
|
213
|
+
expect(word).to match(/code \{[^}]*?font-size: 29pt/m)
|
214
|
+
expect(word).to match(/p\.note \{[^}]*?font-size: 28pt/m)
|
215
|
+
expect(word).to match(/aside \{[^}]*?font-size: 27pt/m)
|
198
216
|
expect(word).to match(/a third empty stylesheet/)
|
199
217
|
#expect(word).to match(/<title>test<\/title>/)
|
200
218
|
expect(word).to match(/test_files\/header.html/)
|
@@ -217,7 +235,13 @@ expect(File.exist?("test.doc")).to be true
|
|
217
235
|
INPUT
|
218
236
|
word = File.read("test.doc")
|
219
237
|
expect(word).to match(/another empty stylesheet/)
|
220
|
-
expect(word).to match(/font-family: Arial/)
|
238
|
+
expect(word).to match(/p \{[^}]*?font-family: Arial/m)
|
239
|
+
expect(word).to match(/code \{[^}]*?font-family: Courier/m)
|
240
|
+
expect(word).to match(/h1 \{[^}]*?font-family: Arial/m)
|
241
|
+
expect(word).to match(/p \{[^}]*?font-size: 12pt/m)
|
242
|
+
expect(word).to match(/code \{[^}]*?font-size: 11pt/m)
|
243
|
+
expect(word).to match(/p\.note \{[^}]*?font-size: 10pt/m)
|
244
|
+
expect(word).to match(/aside \{[^}]*?font-size: 9pt/m)
|
221
245
|
expect(word).to match(/a third empty stylesheet/)
|
222
246
|
#expect(word).to match(/<title>test<\/title>/)
|
223
247
|
expect(word).to match(/test_files\/header.html/)
|
@@ -512,7 +536,7 @@ TOCLEVEL
|
|
512
536
|
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
|
513
537
|
</fn><clause id="N" inline-header="false" obligation="normative">
|
514
538
|
<title>Introduction to this<fn reference="2">
|
515
|
-
|
539
|
+
Formerly denoted as 15 % (m/m).
|
516
540
|
</fn></title>
|
517
541
|
</clause>
|
518
542
|
<clause id="O" inline-header="false" obligation="normative">
|
@@ -548,7 +572,7 @@ TOCLEVEL
|
|
548
572
|
</a>This is a footnote.</p>
|
549
573
|
<a href="#fnref:1">↩</a></aside>
|
550
574
|
<aside id="fn:2" class="footnote">
|
551
|
-
<
|
575
|
+
<a class='FootnoteRef' href='#fn:2'><sup>2</sup></a>Formerly denoted as 15 % (m/m).
|
552
576
|
<a href="#fnref:2">↩</a></aside>
|
553
577
|
</main>
|
554
578
|
OUTPUT
|
@@ -494,7 +494,7 @@ it "customises localisation of numbers" do
|
|
494
494
|
</bibdata>
|
495
495
|
<preface>
|
496
496
|
<p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
|
497
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mfenced open="(" close=")"><mrow><mi>X</mi><mo>≥</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mfenced><mo>=</mo><munderover><mrow><mo>∑</mo></mrow><mrow><mrow><mi>j</mi><mo>=</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mrow><mrow><mn>1000</mn></mrow></munderover><mfenced open="(" close=")"><mtable><mtr><mtd><mn>1000</mn></mtd></mtr><mtr><mtd><mi>j</mi></mtd></mtr></mtable></mfenced><msup><mrow><mi>p</mi></mrow><mrow><mi>j</mi></mrow></msup><msup><mrow><mfenced open="(" close=")"><mrow><mn>
|
497
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mfenced open="(" close=")"><mrow><mi>X</mi><mo>≥</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mfenced><mo>=</mo><munderover><mrow><mo>∑</mo></mrow><mrow><mrow><mi>j</mi><mo>=</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mrow><mrow><mn>1000</mn></mrow></munderover><mfenced open="(" close=")"><mtable><mtr><mtd><mn>1000</mn></mtd></mtr><mtr><mtd><mi>j</mi></mtd></mtr></mtable></mfenced><msup><mrow><mi>p</mi></mrow><mrow><mi>j</mi></mrow></msup><msup><mrow><mfenced open="(" close=")"><mrow><mn>0.0000032</mn><mo>−</mo><mi>p</mi></mrow></mfenced></mrow><mrow><mrow><mn>1.003</mn><mo>−</mo><mi>j</mi></mrow></mrow></msup></math></stem></p>
|
498
498
|
</preface>
|
499
499
|
</iso-standard>
|
500
500
|
INPUT
|
@@ -573,7 +573,7 @@ it "customises localisation of numbers" do
|
|
573
573
|
<mrow>
|
574
574
|
<mfenced open='(' close=')'>
|
575
575
|
<mrow>
|
576
|
-
<mn>
|
576
|
+
<mn>0,0000032</mn>
|
577
577
|
<mo>−</mo>
|
578
578
|
<mi>p</mi>
|
579
579
|
</mrow>
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -63,7 +63,7 @@ RSpec.describe IsoDoc do
|
|
63
63
|
</bibitem>
|
64
64
|
<bibitem id="ref1">
|
65
65
|
<formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
|
66
|
-
<docidentifier type="ICC">167</docidentifier>
|
66
|
+
<docidentifier type="ICC">ICC/167</docidentifier>
|
67
67
|
</bibitem>
|
68
68
|
<note><p>This is an annotation of ISO 20483:2013-2014</p></note>
|
69
69
|
<bibitem id="zip_ffs"><formattedref format="application/x-isodoc+xml">Title 5</formattedref><docidentifier type="metanorma">[5]</docidentifier></bibitem>
|
@@ -136,7 +136,7 @@ RSpec.describe IsoDoc do
|
|
136
136
|
<eref bibitemid='ISBN'>[1]</eref>
|
137
137
|
<eref bibitemid='ISSN'>[2]</eref>
|
138
138
|
<eref bibitemid='ISO16634'>ISO 16634:-- (all parts)</eref>
|
139
|
-
<eref bibitemid='ref1'>ICC
|
139
|
+
<eref bibitemid='ref1'>ICC/167</eref>
|
140
140
|
<eref bibitemid='ref10'>[10]</eref>
|
141
141
|
<eref bibitemid='ref12'>Citn</eref>
|
142
142
|
<eref bibitemid='zip_ffs'>[5]</eref>
|
@@ -213,7 +213,7 @@ RSpec.describe IsoDoc do
|
|
213
213
|
<link target='http://www.icc.or.at'/>
|
214
214
|
)
|
215
215
|
</formattedref>
|
216
|
-
<docidentifier type='ICC'>167</docidentifier>
|
216
|
+
<docidentifier type='ICC'>ICC/167</docidentifier>
|
217
217
|
</bibitem>
|
218
218
|
<note>
|
219
219
|
<name>NOTE</name>
|
@@ -309,7 +309,7 @@ RSpec.describe IsoDoc do
|
|
309
309
|
<a href='#ISBN'>[1]</a>
|
310
310
|
<a href='#ISSN'>[2]</a>
|
311
311
|
<a href='#ISO16634'>ISO 16634:-- (all parts)</a>
|
312
|
-
<a href='#ref1'>ICC
|
312
|
+
<a href='#ref1'>ICC/167</a>
|
313
313
|
<a href='#ref10'>[10]</a>
|
314
314
|
<a href='#ref12'>Citn</a>
|
315
315
|
<a href='#zip_ffs'>[5]</a>
|
@@ -342,7 +342,7 @@ RSpec.describe IsoDoc do
|
|
342
342
|
<i>Cereals and pulses</i>
|
343
343
|
</p>
|
344
344
|
<p id='ref1' class='NormRef'>
|
345
|
-
ICC
|
345
|
+
ICC/167,
|
346
346
|
<span style='font-variant:small-caps;'>Standard No I.C.C 167</span>
|
347
347
|
.
|
348
348
|
<i>
|
@@ -424,4 +424,322 @@ RSpec.describe IsoDoc do
|
|
424
424
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
425
425
|
end
|
426
426
|
|
427
|
+
|
428
|
+
it "processes hidden references sections in Relaton bibliographies" do
|
429
|
+
presxml = <<~PRESXML
|
430
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
431
|
+
<bibdata>
|
432
|
+
<language current="true">en</language>
|
433
|
+
</bibdata>
|
434
|
+
<preface>
|
435
|
+
<foreword>
|
436
|
+
<p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
|
437
|
+
<eref bibitemid='ISO712'>[110]</eref>
|
438
|
+
<eref bibitemid='ISBN'>[1]</eref>
|
439
|
+
<eref bibitemid='ISSN'>[2]</eref>
|
440
|
+
<eref bibitemid='ISO16634'>ISO 16634:-- (all parts)</eref>
|
441
|
+
<eref bibitemid='ref1'>ICC/167</eref>
|
442
|
+
<eref bibitemid='ref10'>[10]</eref>
|
443
|
+
<eref bibitemid='ref12'>Citn</eref>
|
444
|
+
<eref bibitemid='zip_ffs'>[5]</eref>
|
445
|
+
</p>
|
446
|
+
</foreword>
|
447
|
+
</preface>
|
448
|
+
<bibliography>
|
449
|
+
<references id='_normative_references' obligation='informative' normative='true' hidden="true">
|
450
|
+
<title depth='1'>1.<tab/>Normative References</title>
|
451
|
+
<p>
|
452
|
+
The following documents are referred to in the text in such a way that
|
453
|
+
some or all of their content constitutes requirements of this document.
|
454
|
+
For dated references, only the edition cited applies. For undated
|
455
|
+
references, the latest edition of the referenced document (including any
|
456
|
+
amendments) applies.
|
457
|
+
</p>
|
458
|
+
<bibitem id='ISO712' type='standard'>
|
459
|
+
<title format='text/plain'>Cereals or cereal products</title>
|
460
|
+
<title type='main' format='text/plain'>Cereals and cereal products</title>
|
461
|
+
<docidentifier type='ISO'>ISO 712</docidentifier>
|
462
|
+
<docidentifier type='metanorma'>[110]</docidentifier>
|
463
|
+
<contributor>
|
464
|
+
<role type='publisher'/>
|
465
|
+
<organization>
|
466
|
+
<name>International Organization for Standardization</name>
|
467
|
+
</organization>
|
468
|
+
</contributor>
|
469
|
+
</bibitem>
|
470
|
+
<bibitem id='ISO16634' type='standard'>
|
471
|
+
<title language='x' format='text/plain'>
|
472
|
+
Cereals, pulses, milled cereal products, xxxx, oilseeds and animal
|
473
|
+
feeding stuffs
|
474
|
+
</title>
|
475
|
+
<title language='en' format='text/plain'>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
|
476
|
+
<docidentifier type='ISO'>ISO 16634:-- (all parts)</docidentifier>
|
477
|
+
<date type='published'>
|
478
|
+
<on>--</on>
|
479
|
+
</date>
|
480
|
+
<contributor>
|
481
|
+
<role type='publisher'/>
|
482
|
+
<organization>
|
483
|
+
<abbreviation>ISO</abbreviation>
|
484
|
+
</organization>
|
485
|
+
</contributor>
|
486
|
+
<note format='text/plain' type='Unpublished-Status' reference='1'>Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
|
487
|
+
<extent type='part'>
|
488
|
+
<referenceFrom>all</referenceFrom>
|
489
|
+
</extent>
|
490
|
+
</bibitem>
|
491
|
+
<bibitem id='ISO20483' type='standard'>
|
492
|
+
<title format='text/plain'>Cereals and pulses</title>
|
493
|
+
<docidentifier type='ISO'>ISO 20483:2013-2014</docidentifier>
|
494
|
+
<date type='published'>
|
495
|
+
<from>2013</from>
|
496
|
+
<to>2014</to>
|
497
|
+
</date>
|
498
|
+
<contributor>
|
499
|
+
<role type='publisher'/>
|
500
|
+
<organization>
|
501
|
+
<name>International Organization for Standardization</name>
|
502
|
+
</organization>
|
503
|
+
</contributor>
|
504
|
+
</bibitem>
|
505
|
+
<bibitem id='ref1'>
|
506
|
+
<formattedref format='application/x-isodoc+xml'>
|
507
|
+
<smallcap>Standard No I.C.C 167</smallcap>
|
508
|
+
.
|
509
|
+
<em>
|
510
|
+
Determination of the protein content in cereal and cereal products
|
511
|
+
for food and animal feeding stuffs according to the Dumas combustion
|
512
|
+
method
|
513
|
+
</em>
|
514
|
+
(see
|
515
|
+
<link target='http://www.icc.or.at'/>
|
516
|
+
)
|
517
|
+
</formattedref>
|
518
|
+
<docidentifier type='ICC'>ICC/167</docidentifier>
|
519
|
+
</bibitem>
|
520
|
+
<note>
|
521
|
+
<name>NOTE</name>
|
522
|
+
<p>This is an annotation of ISO 20483:2013-2014</p>
|
523
|
+
</note>
|
524
|
+
<bibitem id='zip_ffs'>
|
525
|
+
<formattedref format='application/x-isodoc+xml'>Title 5</formattedref>
|
526
|
+
<docidentifier type='metanorma'>[5]</docidentifier>
|
527
|
+
</bibitem>
|
528
|
+
</references>
|
529
|
+
<references id='_bibliography' obligation='informative' normative='false' hidden="true">
|
530
|
+
<title depth="1">Bibliography</title>
|
531
|
+
<bibitem id='ISBN' type='ISBN'>
|
532
|
+
<title format='text/plain'>Chemicals for analytical laboratory use</title>
|
533
|
+
<docidentifier type='ISBN'>ISBN</docidentifier>
|
534
|
+
<docidentifier type='metanorma'>[1]</docidentifier>
|
535
|
+
<contributor>
|
536
|
+
<role type='publisher'/>
|
537
|
+
<organization>
|
538
|
+
<abbreviation>ISBN</abbreviation>
|
539
|
+
</organization>
|
540
|
+
</contributor>
|
541
|
+
</bibitem>
|
542
|
+
<bibitem id='ISSN' type='ISSN'>
|
543
|
+
<title format='text/plain'>Instruments for analytical laboratory use</title>
|
544
|
+
<docidentifier type='ISSN'>ISSN</docidentifier>
|
545
|
+
<docidentifier type='metanorma'>[2]</docidentifier>
|
546
|
+
<contributor>
|
547
|
+
<role type='publisher'/>
|
548
|
+
<organization>
|
549
|
+
<abbreviation>ISSN</abbreviation>
|
550
|
+
</organization>
|
551
|
+
</contributor>
|
552
|
+
</bibitem>
|
553
|
+
<note>
|
554
|
+
<name>NOTE</name>
|
555
|
+
<p>This is an annotation of document ISSN.</p>
|
556
|
+
</note>
|
557
|
+
<note>
|
558
|
+
<name>NOTE</name>
|
559
|
+
<p>This is another annotation of document ISSN.</p>
|
560
|
+
</note>
|
561
|
+
<bibitem id='ISO3696' type='standard'>
|
562
|
+
<title format='text/plain'>Water for analytical laboratory use</title>
|
563
|
+
<docidentifier type='ISO'>ISO 3696</docidentifier>
|
564
|
+
<contributor>
|
565
|
+
<role type='publisher'/>
|
566
|
+
<organization>
|
567
|
+
<abbreviation>ISO</abbreviation>
|
568
|
+
</organization>
|
569
|
+
</contributor>
|
570
|
+
</bibitem>
|
571
|
+
<bibitem id='ref10'>
|
572
|
+
<formattedref format='application/x-isodoc+xml'>
|
573
|
+
<smallcap>Standard No I.C.C 167</smallcap>
|
574
|
+
.
|
575
|
+
<em>
|
576
|
+
Determination of the protein content in cereal and cereal products
|
577
|
+
for food and animal feeding stuffs according to the Dumas combustion
|
578
|
+
method
|
579
|
+
</em>
|
580
|
+
(see
|
581
|
+
<link target='http://www.icc.or.at'/>
|
582
|
+
)
|
583
|
+
</formattedref>
|
584
|
+
<docidentifier type='metanorma'>[10]</docidentifier>
|
585
|
+
</bibitem>
|
586
|
+
<bibitem id='ref11'>
|
587
|
+
<title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
|
588
|
+
<docidentifier type='IETF'>RFC 10</docidentifier>
|
589
|
+
</bibitem>
|
590
|
+
<bibitem id='ref12'>
|
591
|
+
<formattedref format='application/x-isodoc+xml'>
|
592
|
+
CitationWorks. 2019.
|
593
|
+
<em>How to cite a reference</em>
|
594
|
+
.
|
595
|
+
</formattedref>
|
596
|
+
<docidentifier type='metanorma'>[Citn]</docidentifier>
|
597
|
+
<docidentifier type='IETF'>RFC 20</docidentifier>
|
598
|
+
</bibitem>
|
599
|
+
</references>
|
600
|
+
</bibliography>
|
601
|
+
</iso-standard>
|
602
|
+
PRESXML
|
603
|
+
|
604
|
+
html = <<~OUTPUT
|
605
|
+
#{HTML_HDR}
|
606
|
+
<br/>
|
607
|
+
<div>
|
608
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
609
|
+
<p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
|
610
|
+
<a href='#ISO712'>[110]</a>
|
611
|
+
<a href='#ISBN'>[1]</a>
|
612
|
+
<a href='#ISSN'>[2]</a>
|
613
|
+
<a href='#ISO16634'>ISO 16634:-- (all parts)</a>
|
614
|
+
<a href='#ref1'>ICC/167</a>
|
615
|
+
<a href='#ref10'>[10]</a>
|
616
|
+
<a href='#ref12'>Citn</a>
|
617
|
+
<a href='#zip_ffs'>[5]</a>
|
618
|
+
</p>
|
619
|
+
</div>
|
620
|
+
<p class='zzSTDTitle1'/>
|
621
|
+
</div>
|
622
|
+
</body>
|
623
|
+
</html>
|
624
|
+
|
625
|
+
OUTPUT
|
626
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
627
|
+
end
|
628
|
+
|
629
|
+
it "processes hidden references sections in Relaton bibliographies" do
|
630
|
+
presxml = <<~PRESXML
|
631
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
632
|
+
<bibdata>
|
633
|
+
<language current="true">en</language>
|
634
|
+
</bibdata>
|
635
|
+
<preface>
|
636
|
+
<foreword>
|
637
|
+
<p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
|
638
|
+
<eref bibitemid='ISO712'>[110]</eref>
|
639
|
+
<eref bibitemid='ISBN'>[1]</eref>
|
640
|
+
<eref bibitemid='ISSN'>[2]</eref>
|
641
|
+
<eref bibitemid='ISO16634'>ISO 16634:-- (all parts)</eref>
|
642
|
+
<eref bibitemid='ref1'>ICC/167</eref>
|
643
|
+
<eref bibitemid='ref10'>[10]</eref>
|
644
|
+
<eref bibitemid='ref12'>Citn</eref>
|
645
|
+
<eref bibitemid='zip_ffs'>[5]</eref>
|
646
|
+
</p>
|
647
|
+
</foreword>
|
648
|
+
</preface>
|
649
|
+
<bibliography>
|
650
|
+
<references id='_normative_references' obligation='informative' normative='true'>
|
651
|
+
<title depth='1'>1.<tab/>Normative References</title>
|
652
|
+
<p>
|
653
|
+
The following documents are referred to in the text in such a way that
|
654
|
+
some or all of their content constitutes requirements of this document.
|
655
|
+
For dated references, only the edition cited applies. For undated
|
656
|
+
references, the latest edition of the referenced document (including any
|
657
|
+
amendments) applies.
|
658
|
+
</p>
|
659
|
+
<bibitem id='ISO712' type='standard' hidden="true">
|
660
|
+
<title format='text/plain'>Cereals or cereal products</title>
|
661
|
+
<title type='main' format='text/plain'>Cereals and cereal products</title>
|
662
|
+
<docidentifier type='ISO'>ISO 712</docidentifier>
|
663
|
+
<docidentifier type='metanorma'>[110]</docidentifier>
|
664
|
+
<contributor>
|
665
|
+
<role type='publisher'/>
|
666
|
+
<organization>
|
667
|
+
<name>International Organization for Standardization</name>
|
668
|
+
</organization>
|
669
|
+
</contributor>
|
670
|
+
</bibitem>
|
671
|
+
<bibitem id='ISO16634' type='standard'>
|
672
|
+
<title language='x' format='text/plain'>
|
673
|
+
Cereals, pulses, milled cereal products, xxxx, oilseeds and animal
|
674
|
+
feeding stuffs
|
675
|
+
</title>
|
676
|
+
<title language='en' format='text/plain'>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
|
677
|
+
<docidentifier type='ISO'>ISO 16634:-- (all parts)</docidentifier>
|
678
|
+
<date type='published'>
|
679
|
+
<on>--</on>
|
680
|
+
</date>
|
681
|
+
<contributor>
|
682
|
+
<role type='publisher'/>
|
683
|
+
<organization>
|
684
|
+
<abbreviation>ISO</abbreviation>
|
685
|
+
</organization>
|
686
|
+
</contributor>
|
687
|
+
<note format='text/plain' type='Unpublished-Status' reference='1'>Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
|
688
|
+
<extent type='part'>
|
689
|
+
<referenceFrom>all</referenceFrom>
|
690
|
+
</extent>
|
691
|
+
</bibitem>
|
692
|
+
</references></bibliography></iso-standard>
|
693
|
+
PRESXML
|
694
|
+
|
695
|
+
html = <<~OUTPUT
|
696
|
+
#{HTML_HDR}
|
697
|
+
<br/>
|
698
|
+
<div>
|
699
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
700
|
+
<p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
|
701
|
+
<a href='#ISO712'>[110]</a>
|
702
|
+
<a href='#ISBN'>[1]</a>
|
703
|
+
<a href='#ISSN'>[2]</a>
|
704
|
+
<a href='#ISO16634'>ISO 16634:-- (all parts)</a>
|
705
|
+
<a href='#ref1'>ICC/167</a>
|
706
|
+
<a href='#ref10'>[10]</a>
|
707
|
+
<a href='#ref12'>Citn</a>
|
708
|
+
<a href='#zip_ffs'>[5]</a>
|
709
|
+
</p>
|
710
|
+
</div>
|
711
|
+
<p class='zzSTDTitle1'/>
|
712
|
+
<div>
|
713
|
+
<h1>1.  Normative References</h1>
|
714
|
+
<p>
|
715
|
+
The following documents are referred to in the text in such a way
|
716
|
+
that some or all of their content constitutes requirements of this
|
717
|
+
document. For dated references, only the edition cited applies. For
|
718
|
+
undated references, the latest edition of the referenced document
|
719
|
+
(including any amendments) applies.
|
720
|
+
</p>
|
721
|
+
<p id='ISO16634' class='NormRef'>
|
722
|
+
ISO 16634:-- (all parts)
|
723
|
+
<a class='FootnoteRef' href='#fn:1'>
|
724
|
+
<sup>1</sup>
|
725
|
+
</a>
|
726
|
+
,
|
727
|
+
<i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i>
|
728
|
+
</p>
|
729
|
+
</div>
|
730
|
+
<aside id='fn:1' class='footnote'>
|
731
|
+
<p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
|
732
|
+
</aside>
|
733
|
+
|
734
|
+
</div>
|
735
|
+
</body>
|
736
|
+
</html>
|
737
|
+
|
738
|
+
OUTPUT
|
739
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
740
|
+
end
|
741
|
+
|
742
|
+
|
427
743
|
end
|
744
|
+
|
745
|
+
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -2313,7 +2313,7 @@ OUTPUT
|
|
2313
2313
|
<li id="N1"><p>A</p></li>
|
2314
2314
|
</ol>
|
2315
2315
|
<clause id="xyz"><title>Preparatory</title>
|
2316
|
-
<ol id="N02">
|
2316
|
+
<ol id="N02" type="arabic">
|
2317
2317
|
<li id="N2"><p>A</p></li>
|
2318
2318
|
</ol>
|
2319
2319
|
</clause>
|
@@ -2321,17 +2321,17 @@ OUTPUT
|
|
2321
2321
|
</preface>
|
2322
2322
|
<sections>
|
2323
2323
|
<clause id="scope" type="scope"><title>Scope</title>
|
2324
|
-
<ol id="N0">
|
2324
|
+
<ol id="N0" type="roman">
|
2325
2325
|
<li id="N"><p>A</p></li>
|
2326
2326
|
</ol>
|
2327
2327
|
</clause>
|
2328
2328
|
<terms id="terms"/>
|
2329
2329
|
<clause id="widgets"><title>Widgets</title>
|
2330
2330
|
<clause id="widgets1">
|
2331
|
-
<ol id="note1l">
|
2331
|
+
<ol id="note1l" type="alphabet">
|
2332
2332
|
<li id="note1"><p>A</p></li>
|
2333
2333
|
</ol>
|
2334
|
-
<ol id="note2l">
|
2334
|
+
<ol id="note2l" type="roman_upper">
|
2335
2335
|
<li id="note2"><p>A</p></li>
|
2336
2336
|
</ol>
|
2337
2337
|
</clause>
|
@@ -2339,12 +2339,12 @@ OUTPUT
|
|
2339
2339
|
</sections>
|
2340
2340
|
<annex id="annex1">
|
2341
2341
|
<clause id="annex1a">
|
2342
|
-
<ol id="ANl">
|
2342
|
+
<ol id="ANl" type="alphabet_upper">
|
2343
2343
|
<li id="AN"><p>A</p></li>
|
2344
2344
|
</ol>
|
2345
2345
|
</clause>
|
2346
2346
|
<clause id="annex1b">
|
2347
|
-
<ol id="Anote1l">
|
2347
|
+
<ol id="Anote1l" type="roman" start="4">
|
2348
2348
|
<li id="Anote1"><p>A</p></li>
|
2349
2349
|
</ol>
|
2350
2350
|
<ol id="Anote2l">
|
@@ -2360,12 +2360,12 @@ OUTPUT
|
|
2360
2360
|
<foreword>
|
2361
2361
|
<p>
|
2362
2362
|
<xref target='N1'>Introduction, a)</xref>
|
2363
|
-
<xref target='N2'>Preparatory,
|
2364
|
-
<xref target='N'>Clause 1,
|
2363
|
+
<xref target='N2'>Preparatory, 1)</xref>
|
2364
|
+
<xref target='N'>Clause 1, i)</xref>
|
2365
2365
|
<xref target='note1'>Clause 3.1, List 1 a)</xref>
|
2366
|
-
<xref target='note2'>Clause 3.1, List 2
|
2367
|
-
<xref target='AN'>Annex A.1,
|
2368
|
-
<xref target='Anote1'>Annex A.2, List 1
|
2366
|
+
<xref target='note2'>Clause 3.1, List 2 I)</xref>
|
2367
|
+
<xref target='AN'>Annex A.1, A)</xref>
|
2368
|
+
<xref target='Anote1'>Annex A.2, List 1 iv)</xref>
|
2369
2369
|
<xref target='Anote2'>Annex A.2, List 2 a)</xref>
|
2370
2370
|
</p>
|
2371
2371
|
</foreword>
|
@@ -2377,7 +2377,7 @@ OUTPUT
|
|
2377
2377
|
</ol>
|
2378
2378
|
<clause id='xyz'>
|
2379
2379
|
<title depth='2'>Preparatory</title>
|
2380
|
-
<ol id='N02'>
|
2380
|
+
<ol id='N02' type="arabic">
|
2381
2381
|
<li id='N2'>
|
2382
2382
|
<p>A</p>
|
2383
2383
|
</li>
|
@@ -2392,7 +2392,7 @@ OUTPUT
|
|
2392
2392
|
<tab/>
|
2393
2393
|
Scope
|
2394
2394
|
</title>
|
2395
|
-
<ol id='N0'>
|
2395
|
+
<ol id='N0' type="roman">
|
2396
2396
|
<li id='N'>
|
2397
2397
|
<p>A</p>
|
2398
2398
|
</li>
|
@@ -2408,12 +2408,12 @@ OUTPUT
|
|
2408
2408
|
Widgets
|
2409
2409
|
</title>
|
2410
2410
|
<clause id='widgets1'><title>3.1.</title>
|
2411
|
-
<ol id='note1l'>
|
2411
|
+
<ol id='note1l' type="alphabet">
|
2412
2412
|
<li id='note1'>
|
2413
2413
|
<p>A</p>
|
2414
2414
|
</li>
|
2415
2415
|
</ol>
|
2416
|
-
<ol id='note2l'>
|
2416
|
+
<ol id='note2l' type="roman_upper">
|
2417
2417
|
<li id='note2'>
|
2418
2418
|
<p>A</p>
|
2419
2419
|
</li>
|
@@ -2428,14 +2428,14 @@ OUTPUT
|
|
2428
2428
|
(informative)
|
2429
2429
|
</title>
|
2430
2430
|
<clause id='annex1a'><title>A.1.</title>
|
2431
|
-
<ol id='ANl'>
|
2431
|
+
<ol id='ANl' type="alphabet_upper">
|
2432
2432
|
<li id='AN'>
|
2433
2433
|
<p>A</p>
|
2434
2434
|
</li>
|
2435
2435
|
</ol>
|
2436
2436
|
</clause>
|
2437
2437
|
<clause id='annex1b'><title>A.2.</title>
|
2438
|
-
<ol id='Anote1l'>
|
2438
|
+
<ol id='Anote1l' type="roman" start="4">
|
2439
2439
|
<li id='Anote1'>
|
2440
2440
|
<p>A</p>
|
2441
2441
|
</li>
|
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.
|
4
|
+
version: 1.3.0
|
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-
|
11
|
+
date: 2020-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|
@@ -352,6 +352,7 @@ files:
|
|
352
352
|
- lib/isodoc/class_utils.rb
|
353
353
|
- lib/isodoc/common.rb
|
354
354
|
- lib/isodoc/convert.rb
|
355
|
+
- lib/isodoc/css.rb
|
355
356
|
- lib/isodoc/function.rb
|
356
357
|
- lib/isodoc/function/blocks.rb
|
357
358
|
- lib/isodoc/function/blocks_example_note.rb
|