mn-requirements 0.5.10 → 0.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e446f52e8a55fc21a99df29ce798a2a7ea84d987d07aceb23d64b5c1c77be7e3
4
- data.tar.gz: f1142726f55149df21ff127df360b656cd14b9c376f7d13844ba04451239b5b1
3
+ metadata.gz: a9c3746379428caff796ce59625c1642ec417399c50bd0544227a80a0152ca61
4
+ data.tar.gz: 0ebf8d83e75efca52ea7b76b81e6aaf2f8d02236b2ad37ed670784832e1bd9e4
5
5
  SHA512:
6
- metadata.gz: 2617c33c902c0caddd8ac9f47f4b9fd497ce04482ef53195d50e13776e3f2a165ec1c13f3891efb67cfdbfc11b891dcff9a598894bf344d6f97a3b538bc171b8
7
- data.tar.gz: dba9959bd392290b870c539410f8d50b55203308d96b3ec786c1c6a9532bcbc7e650f89a614390425f2fe21d52853109dfd63f792729de68aab92b20345ab684
6
+ metadata.gz: a0f30d1674c1d097d8494eac7606d7275a1df0f180ddc9fbc8b92eb9f6ea5020f4470c603f02e1597844e884bf882f86f4ca5787bb2c6bacde9519c39ce40a39
7
+ data.tar.gz: 10547de736b015b3e4ca782ebee129fbfc46b0c27fbe7f946f24ac4e2e42e6323e5599e131442837f3e157714c1596443dcc703eed2596999ed20dbcf6339c18
data/.rubocop.yml CHANGED
@@ -1,10 +1,22 @@
1
1
  # Auto-generated by Cimas: Do not edit it manually!
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
- - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+
6
+ # Rubocop plugins enabled centrally so every metanorma-org gem picks them up
7
+ # on cimas sync — best practice belongs at the shared-template layer, not
8
+ # per-repo. Per ronaldtse feedback on metanorma/ci#332.
9
+ plugins:
10
+ - rubocop-rspec
11
+ - rubocop-performance
12
+ - rubocop-rake
5
13
 
6
14
  # local repo-specific modifications
7
15
  # ...
8
16
 
9
17
  AllCops:
10
- TargetRubyVersion: 2.5
18
+ # 3.3 matches the org-wide minimum being pushed via #274 (Raise minimum
19
+ # Ruby version to 3.3 due to EOL of 3.2 on 2026-03-31). Was 3.4 before
20
+ # this commit — 3.4 was above the org's stated minimum and would have
21
+ # applied Rubocop rules that fail-close on gems still targeting 3.3.
22
+ TargetRubyVersion: 3.3
@@ -1,4 +1,3 @@
1
- require "isodoc"
2
1
 
3
2
  module Metanorma
4
3
  class Requirements
@@ -69,31 +69,27 @@ module Metanorma
69
69
  r.at(ns("./th"))&.text&.strip == hdr or break
70
70
  td = r.remove.at(ns("./td"))
71
71
  id = td["id"] ? "<bookmark id='#{td['id']}'/>" : ""
72
- ret << id + to_xml(td.children).strip
72
+ ret << (id + to_xml(td.children).strip)
73
73
  end
74
74
  ret
75
75
  end
76
76
 
77
77
  def requirement_table_nested_cleanup(node, out, table)
78
78
  rows = []
79
- table.xpath(ns("./tbody/tr/td/*/fmt-provision/table"))
80
- .sort_by do |t|
81
- [t.at(ns(".//fmt-name//span[@class = 'fmt-element-name']"))&.text,
82
- t.at(ns(".//fmt-name//semx[@element = 'autonum']"))&.text&.to_i]
83
- end.each do |t|
84
- x = t.at(ns("./thead/tr")) or next
85
- x.at(ns("./th")).children =
86
- requirement_table_nested_cleanup_hdr(node)
87
- f = x.at(ns("./td/fmt-name")) and
88
- f.parent.children = to_xml(f.children).strip
89
- td = x.at(ns("./td"))
90
- td["id"] = t["original-id"] || t["id"]
91
- if desc = t.at(ns("./tbody/tr/td/semx[@element = 'description']"))
92
- p = desc.at(ns("./p")) and p.replace(p.children)
93
- td << " #{to_xml(desc)}"
94
- end
95
- rows << x
79
+ requirement_table_nested_cleanup_sort(table).each do |t|
80
+ x = t.at(ns("./thead/tr")) or next
81
+ x.at(ns("./th")).children =
82
+ requirement_table_nested_cleanup_hdr(node)
83
+ f = x.at(ns("./td/fmt-name")) and
84
+ f.parent.children = to_xml(f.children).strip
85
+ td = x.at(ns("./td"))
86
+ td["id"] = t["original-id"] || t["id"]
87
+ if desc = t.at(ns("./tbody/tr/td/semx[@element = 'description']"))
88
+ p = desc.at(ns("./p")) and p.replace(p.children)
89
+ td << " #{to_xml(desc)}"
96
90
  end
91
+ rows << x
92
+ end
97
93
  table.xpath(ns("./tbody/tr[./td/*/fmt-provision/table]"))
98
94
  .each_with_index do |t, i|
99
95
  t.replace(rows[i])
@@ -102,6 +98,25 @@ module Metanorma
102
98
  table
103
99
  end
104
100
 
101
+ def requirement_table_nested_cleanup_sort(table)
102
+ table.xpath(ns("./tbody/tr/td/*/fmt-provision/table"))
103
+ .sort_by do |t|
104
+ [t.at(ns(".//fmt-name//span[@class = 'fmt-element-name']"))&.text,
105
+ *autonum_sort_key(
106
+ t.at(ns(".//fmt-name//semx[@element = 'autonum']"))&.text,
107
+ )]
108
+ end
109
+ end
110
+
111
+ # allow autonum to be sorted numerically, but break up non-numeric text
112
+ # to allow for autonum values like "1a", "1b", etc. and delimited autonum
113
+ # values like "1.1", "1.2", etc.
114
+ def autonum_sort_key(text)
115
+ text ||= ""
116
+ nums = text.scan(/\d+/).map(&:to_i)
117
+ [nums, text]
118
+ end
119
+
105
120
  def requirement_table_nested_cleanup_hdr(node)
106
121
  label = "provision"
107
122
  node["type"] == "conformanceclass" and label = "conformancetest"
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  class Requirements
3
- VERSION = "0.5.10".freeze
3
+ VERSION = "0.5.12".freeze
4
4
  end
5
5
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
38
38
  spec.add_development_dependency "guard", "~> 2.14"
39
39
  spec.add_development_dependency "guard-rspec", "~> 4.7"
40
- spec.add_development_dependency "metanorma-standoc", ">= 3.4.1"
40
+ spec.add_development_dependency "metanorma-standoc", ">= 3.4.2"
41
41
  spec.add_development_dependency "rake", "~> 13.0"
42
42
  spec.add_development_dependency "rspec", "~> 3.6"
43
43
  spec.add_development_dependency "rubocop", "~> 1"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mn-requirements
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-04-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: isodoc-i18n
@@ -156,14 +155,14 @@ dependencies:
156
155
  requirements:
157
156
  - - ">="
158
157
  - !ruby/object:Gem::Version
159
- version: 3.4.1
158
+ version: 3.4.2
160
159
  type: :development
161
160
  prerelease: false
162
161
  version_requirements: !ruby/object:Gem::Requirement
163
162
  requirements:
164
163
  - - ">="
165
164
  - !ruby/object:Gem::Version
166
- version: 3.4.1
165
+ version: 3.4.2
167
166
  - !ruby/object:Gem::Dependency
168
167
  name: rake
169
168
  requirement: !ruby/object:Gem::Requirement
@@ -271,7 +270,6 @@ executables: []
271
270
  extensions: []
272
271
  extra_rdoc_files: []
273
272
  files:
274
- - ".hound.yml"
275
273
  - ".rubocop.yml"
276
274
  - CODE_OF_CONDUCT.md
277
275
  - Gemfile
@@ -307,7 +305,6 @@ homepage: https://github.com/metanorma/mn-requirements
307
305
  licenses:
308
306
  - BSD-2-Clause
309
307
  metadata: {}
310
- post_install_message:
311
308
  rdoc_options: []
312
309
  require_paths:
313
310
  - lib
@@ -322,8 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
319
  - !ruby/object:Gem::Version
323
320
  version: '0'
324
321
  requirements: []
325
- rubygems_version: 3.5.22
326
- signing_key:
322
+ rubygems_version: 4.0.10
327
323
  specification_version: 4
328
324
  summary: Requirements processing and rendering according to different models
329
325
  test_files: []
data/.hound.yml DELETED
@@ -1,5 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- ruby:
4
- enabled: true
5
- config_file: .rubocop.yml