metanorma-standoc 2.8.8 → 2.8.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- if item[:doc] then use_retrieved_relaton(item, xml)
37
- else
38
- xml.bibitem **attr_code(ref_attributes(item[:ref][:match])) do |t|
39
- isorefrender1(t, item[:ref][:match], item[:ref][:analyse_code],
40
- item[:ref][:year])
41
- item[:ref][:year] and t.date type: "published" do |d|
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
- if code[:type] == "path"
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
- matched, matched2, matched3 = reference1_matches(item)
218
- if matched3.nil? && matched2.nil? && matched.nil?
219
- refitemcode(item, node).merge(process: 0)
220
- elsif !matched.nil? then isorefmatchescode(matched,
221
- item).merge(process: 1)
222
- elsif !matched2.nil? then isorefmatches2code(matched2,
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"] = opt[:hidden]
37
- opt[:dropid] and
38
- ref.parent.elements.last["suppress_identifier"] = opt[:dropid]
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: (m[:source] || "default"))
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? ? m[:key].sub(%r{^[^/]+/}, "") : m[:id]
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) | local-file(source,? key) |
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(
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.8.8".freeze
22
+ VERSION = "2.8.10".freeze
23
23
  end
24
24
  end
@@ -32,11 +32,11 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "asciidoctor", "~> 2.0.0"
33
33
  spec.add_dependency "crass", "~> 1.0.0"
34
34
  spec.add_dependency "iev", "~> 0.3.0"
35
- spec.add_dependency "isodoc", "~> 2.10.0"
35
+ spec.add_dependency "isodoc", "~> 2.10.2"
36
36
  spec.add_dependency "metanorma", ">= 1.6.0"
37
37
  spec.add_dependency "metanorma-plugin-datastruct", "~> 0.3.0"
38
38
  spec.add_dependency "metanorma-plugin-glossarist", "~> 0.2.0"
39
- spec.add_dependency "metanorma-plugin-lutaml", "~> 0.5.0"
39
+ spec.add_dependency "metanorma-plugin-lutaml", "~> 0.6.0"
40
40
  spec.add_dependency "ruby-jing"
41
41
  # relaton-cli not just relaton, to avoid circular reference in metanorma
42
42
  spec.add_dependency "asciimath2unitsml", "~> 0.4.0"
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.8
4
+ version: 2.8.10
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-04-22 00:00:00.000000000 Z
11
+ date: 2024-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.10.0
75
+ version: 2.10.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.10.0
82
+ version: 2.10.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: metanorma
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.5.0
131
+ version: 0.6.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.5.0
138
+ version: 0.6.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: ruby-jing
141
141
  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
@@ -573,7 +574,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
573
574
  - !ruby/object:Gem::Version
574
575
  version: '0'
575
576
  requirements: []
576
- rubygems_version: 3.3.26
577
+ rubygems_version: 3.3.27
577
578
  signing_key:
578
579
  specification_version: 4
579
580
  summary: metanorma-standoc realises standards following the Metanorma standoc model