metanorma 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a7eed0e26e4338f4485a309446b6d0c008dc76773d8672e7560fa672af77b70
4
- data.tar.gz: a5d36260967385bb27afb23cfc024802e08809212acdbfc369bffa5c46c37196
3
+ metadata.gz: 9718bdc06f44f31d38c70b61597971da40b59aec92c34803fd90dee5a9737ef3
4
+ data.tar.gz: b4441a0010cc32bcea52b79533649bdde985f3a18054827f039346c1db0ba296
5
5
  SHA512:
6
- metadata.gz: 39e7761252dfc8467cd23fe1f5051c74a0c441b3cc8ff0d509793c8eaf04e7f135792ed34b12b1307a3cf85f593bb6b4f955feed831a3b0b1e156aa2a11a65de
7
- data.tar.gz: 7a94bd3e934c6255ecaa5a153eaf286aaf34ae49f03b326e4dbf12d03cbe51fca18bf971de3c7c68b399ea82f57671c4cbfc0d060b58e4e893cc0d7799fcad7c
6
+ metadata.gz: ed6c60df3dc293db574f7484e918deda0de754d23696e95834d30856bbc8c6a0917aebf15d0fad56e13bc7bfc5ef133b9554e92a679f949ac6495171bcc77025
7
+ data.tar.gz: 5c65c98e7194b3a366977a356d9f44fdbc3f2b2ebf4d871ee76b8f040f7ef824d540eccc82850c1e06908058210ed2cf2f58740388eee29fd63c977b6a80fa78
@@ -129,12 +129,34 @@ module Metanorma
129
129
  end
130
130
  file, _filename = targetfile(files[identifier], true)
131
131
  xml = Nokogiri::XML(file)
132
+ add_document_suffix(identifier, xml)
132
133
  files[identifier][:anchors] = read_anchors(xml)
133
134
  files[identifier][:bibdata] = xml.at(ns("//bibdata"))
134
135
  end
135
136
  files
136
137
  end
137
138
 
139
+ def add_suffix_to_attributes(doc, suffix, tag_name, attribute_name)
140
+ doc.xpath(ns("//#{tag_name}[@#{attribute_name}]")).each do |elem|
141
+ elem.attributes[attribute_name].value =
142
+ "#{elem.attributes[attribute_name].value}_#{suffix}"
143
+ end
144
+ end
145
+
146
+ def add_document_suffix(identifier, doc)
147
+ document_suffix = Asciidoctor::Standoc::Cleanup.to_ncname(identifier)
148
+ [%w[* id],
149
+ %w[* bibitemid],
150
+ %w[review from],
151
+ %w[review to],
152
+ %w[index to],
153
+ %w[xref target],
154
+ %w[callout target]]
155
+ .each do |(tag_name, attribute_name)|
156
+ add_suffix_to_attributes(doc, document_suffix, tag_name, attribute_name)
157
+ end
158
+ end
159
+
138
160
  # map locality type and label (e.g. "clause" "1") to id = anchor for
139
161
  # a document
140
162
  def read_anchors(xml)
@@ -271,6 +293,7 @@ module Metanorma
271
293
  # @return [String] XML content
272
294
  def update_xrefs(file, identifier)
273
295
  docxml = Nokogiri::XML(file)
296
+ add_document_suffix(identifier, docxml)
274
297
  docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |b|
275
298
  docid = b&.at(ns("./docidentifier[@type = 'repository']"))&.text
276
299
  next unless docid && %r{^current-metanorma-collection/}.match(docid)
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "byebug", "~> 10.0"
38
38
  spec.add_development_dependency "rspec-command", "~> 1.0"
39
39
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
40
- spec.add_development_dependency "metanorma-iso", "~> 1.5.8"
40
+ spec.add_development_dependency "metanorma-iso", "~> 1.6.0"
41
41
  spec.add_development_dependency "sassc", "~> 2.4.0"
42
42
  #spec.add_development_dependency "isodoc", "~> 1.2.1"
43
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
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-30 00:00:00.000000000 Z
11
+ date: 2020-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.5.8
159
+ version: 1.6.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.5.8
166
+ version: 1.6.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: sassc
169
169
  requirement: !ruby/object:Gem::Requirement