metanorma-standoc 2.8.9 → 2.8.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/html/htmlstyle.css +9 -1
- data/lib/metanorma/standoc/base.rb +3 -2
- data/lib/metanorma/standoc/basicdoc.rng +840 -419
- data/lib/metanorma/standoc/biblio.rng +26 -27
- data/lib/metanorma/standoc/cleanup.rb +1 -0
- data/lib/metanorma/standoc/cleanup_bibdata.rb +0 -84
- data/lib/metanorma/standoc/cleanup_bibitem.rb +47 -0
- data/lib/metanorma/standoc/cleanup_dochistory.rb +89 -0
- data/lib/metanorma/standoc/cleanup_maths.rb +1 -2
- data/lib/metanorma/standoc/init.rb +2 -0
- data/lib/metanorma/standoc/inline.rb +2 -1
- data/lib/metanorma/standoc/isodoc.rng +351 -510
- data/lib/metanorma/standoc/ref.rb +27 -26
- data/lib/metanorma/standoc/ref_utility.rb +15 -9
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- metadata +5 -4
@@ -17,7 +17,7 @@ module Metanorma
|
|
17
17
|
|
18
18
|
def isorefrender1(bib, match, code, year, allp = "")
|
19
19
|
bib.title(**plaintxt) { |i| i << ref_normalise(match[:text]) }
|
20
|
-
#refitem_render_formattedref(bib, match[:text])
|
20
|
+
# refitem_render_formattedref(bib, match[:text])
|
21
21
|
docid(bib, match[:usrlbl]) if match[:usrlbl]
|
22
22
|
docid(bib, code[:usrlabel]) if code && code[:usrlabel]
|
23
23
|
docid(bib, id_and_year(match[:code], year) + allp)
|
@@ -33,16 +33,14 @@ module Metanorma
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def isorefmatchesout(item, xml)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
set_date_range(d, item[:ref][:year])
|
43
|
-
end
|
44
|
-
iso_publisher(t, item[:ref][:match][:code])
|
36
|
+
item[:doc] and return use_retrieved_relaton(item, xml)
|
37
|
+
r = item[:ref]
|
38
|
+
xml.bibitem **attr_code(ref_attributes(r[:match])) do |t|
|
39
|
+
isorefrender1(t, r[:match], r[:analyse_code], r[:year])
|
40
|
+
y = r[:year] and t.date type: "published" do |d|
|
41
|
+
set_date_range(d, y)
|
45
42
|
end
|
43
|
+
iso_publisher(t, r[:match][:code])
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
@@ -111,19 +109,26 @@ module Metanorma
|
|
111
109
|
end
|
112
110
|
|
113
111
|
def refitem_render1(match, code, bib)
|
114
|
-
|
115
|
-
bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), type: "URI"
|
116
|
-
bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), type: "citation"
|
117
|
-
end
|
112
|
+
refitem_uri(code, bib)
|
118
113
|
# code[:id].sub!(/[:-](19|20)[0-9][0-9]$/, "")
|
119
114
|
docid(bib, match[:usrlbl]) if match[:usrlbl]
|
120
115
|
docid(bib, code[:usrlabel]) if code[:usrlabel]
|
121
|
-
code[:id] and
|
122
|
-
docid(bib, /^\d+$/.match?(code[:id]) ? "[#{code[:id]}]" : code[:id])
|
116
|
+
i = code[:id] and docid(bib, /^\d+$/.match?(i) ? "[#{i}]" : i)
|
123
117
|
code[:type] == "repo" and
|
124
118
|
bib.docidentifier code[:key], type: "repository"
|
125
119
|
end
|
126
120
|
|
121
|
+
def refitem_uri(code, bib)
|
122
|
+
if code[:type] == "path"
|
123
|
+
bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), type: "URI"
|
124
|
+
bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), type: "citation"
|
125
|
+
end
|
126
|
+
if code[:type] == "attachment"
|
127
|
+
bib.uri code[:key], type: "attachment"
|
128
|
+
bib.uri code[:key], type: "citation"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
127
132
|
def refitem_render(xml, match, code)
|
128
133
|
xml.bibitem **attr_code(
|
129
134
|
id: match[:anchor], suppress_identifier: code[:dropid],
|
@@ -214,16 +219,12 @@ module Metanorma
|
|
214
219
|
end
|
215
220
|
|
216
221
|
def reference1code(item, node)
|
217
|
-
|
218
|
-
|
219
|
-
refitemcode(item, node).merge(process: 0)
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
item).merge(process: 2)
|
224
|
-
elsif !matched3.nil? then isorefmatches3code(matched3,
|
225
|
-
item).merge(process: 3)
|
226
|
-
end
|
222
|
+
m, m2, m3 = reference1_matches(item)
|
223
|
+
m3.nil? && m2.nil? && m.nil? and
|
224
|
+
return refitemcode(item, node).merge(process: 0)
|
225
|
+
!m.nil? and return isorefmatchescode(m, item).merge(process: 1)
|
226
|
+
!m2.nil? and return isorefmatches2code(m2, item).merge(process: 2)
|
227
|
+
!m3.nil? and return isorefmatches3code(m3, item).merge(process: 3)
|
227
228
|
end
|
228
229
|
|
229
230
|
def reference1out(item, xml)
|
@@ -33,9 +33,9 @@ module Metanorma
|
|
33
33
|
|
34
34
|
def use_my_anchor(ref, id, opt)
|
35
35
|
ref.parent.elements.last["id"] = id
|
36
|
-
opt[:hidden] and ref.parent.elements.last["hidden"] =
|
37
|
-
opt[:dropid] and
|
38
|
-
ref.parent.elements.last["suppress_identifier"] =
|
36
|
+
a = opt[:hidden] and ref.parent.elements.last["hidden"] = a
|
37
|
+
a = opt[:dropid] and
|
38
|
+
ref.parent.elements.last["suppress_identifier"] = a
|
39
39
|
ref
|
40
40
|
end
|
41
41
|
|
@@ -69,7 +69,7 @@ module Metanorma
|
|
69
69
|
def analyse_ref_localfile(ret)
|
70
70
|
m = /^local-file\((?:(?<source>[^,]+),\s*)?(?<id>.+)\)$/.match(ret[:id])
|
71
71
|
m or return ret
|
72
|
-
ret.merge(id: m[:id], localfile:
|
72
|
+
ret.merge(id: m[:id], localfile: m[:source] || "default")
|
73
73
|
end
|
74
74
|
|
75
75
|
def analyse_ref_nofetch(ret)
|
@@ -88,9 +88,14 @@ module Metanorma
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def analyse_ref_repo_path(ret)
|
91
|
-
m = /^(?<type>repo|path):\((?<key>[^,]+),?(?<id
|
91
|
+
m = /^(?<type>repo|path|attachment):\((?<key>[^,]+),?(?<id>[^)]*)\)$/
|
92
92
|
.match(ret[:id]) or return ret
|
93
|
-
id = m[:id].empty?
|
93
|
+
id = if m[:id].empty?
|
94
|
+
if m[:type] == "attachment"
|
95
|
+
"(#{m[:key]})"
|
96
|
+
else m[:key].sub(%r{^[^/]+/}, "")
|
97
|
+
end
|
98
|
+
else m[:id] end
|
94
99
|
ret.merge(id: id, type: m[:type], key: m[:key], nofetch: true)
|
95
100
|
end
|
96
101
|
|
@@ -139,12 +144,12 @@ module Metanorma
|
|
139
144
|
case k
|
140
145
|
when :dropid, :hidden, :nofetch
|
141
146
|
ret[k] = v == "true"
|
142
|
-
when :repo, :path
|
147
|
+
when :repo, :path, :attachment
|
143
148
|
ret[:type] = k.to_s
|
144
149
|
ret[:key] = v
|
145
150
|
ret[:nofetch] = true
|
146
151
|
source[:code] or
|
147
|
-
ret[:id] = v.sub(%r{^[^/]+/}, "")
|
152
|
+
ret[:id] = v == :attachment ? nil : v.sub(%r{^[^/]+/}, "")
|
148
153
|
when :"local-file"
|
149
154
|
ret[:localfile] = v
|
150
155
|
when :number
|
@@ -160,7 +165,8 @@ module Metanorma
|
|
160
165
|
|
161
166
|
# ref id = (usrlbl)code[:-]year
|
162
167
|
# code = \[? number \]? | ident | nofetch(code) | hidden(code) |
|
163
|
-
# dropid(code) | # (repo|path):(key,code) |
|
168
|
+
# dropid(code) | # (repo|path|attachment):(key,code) |
|
169
|
+
# local-file(source,? key) |
|
164
170
|
# merge(code, code) | dual(code, code)
|
165
171
|
def analyse_ref_code_nested(ret)
|
166
172
|
analyse_ref_dual(
|
data/metanorma-standoc.gemspec
CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_dependency "asciimath2unitsml", "~> 0.4.0"
|
43
43
|
spec.add_dependency "concurrent-ruby"
|
44
44
|
spec.add_dependency "pngcheck"
|
45
|
-
spec.add_dependency "relaton-cli", "~> 1.18.
|
45
|
+
spec.add_dependency "relaton-cli", "~> 1.18.1"
|
46
46
|
spec.add_dependency "relaton-iev", "~> 1.2.0"
|
47
47
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
48
48
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: 1.18.
|
201
|
+
version: 1.18.1
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: 1.18.
|
208
|
+
version: 1.18.1
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: relaton-iev
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -495,6 +495,7 @@ files:
|
|
495
495
|
- lib/metanorma/standoc/cleanup_bibitem.rb
|
496
496
|
- lib/metanorma/standoc/cleanup_block.rb
|
497
497
|
- lib/metanorma/standoc/cleanup_boilerplate.rb
|
498
|
+
- lib/metanorma/standoc/cleanup_dochistory.rb
|
498
499
|
- lib/metanorma/standoc/cleanup_footnotes.rb
|
499
500
|
- lib/metanorma/standoc/cleanup_image.rb
|
500
501
|
- lib/metanorma/standoc/cleanup_inline.rb
|