mn-requirements 0.5.12 → 0.5.13
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 +4 -4
- data/.rubocop.yml +9 -0
- data/lib/metanorma/default/cleanup.rb +20 -0
- data/lib/metanorma/requirements/selector.rb +7 -0
- data/lib/metanorma/requirements/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9574557770c7270c92d1b0fd472a1ab5678bc31952402a12d6a7c1ec0de06833
|
|
4
|
+
data.tar.gz: be81a6da8c6acb7cd8f7d0ad0c62e56b4ccaf25f09fbed311d6d4a8e0536e554
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c86a5f706ba90a0370c0da823c199db19973f5a2014b23c7dd134c60eee40ee33d97823a8a3b70cabe8970e235e9532271bc6cb462f654e911449ed58ccd67cd
|
|
7
|
+
data.tar.gz: ac5234f0e6e48b2502bbf041729db20c84144d30145e4edff57fd4365903fae59632300629ff925656a34e6ab5c6da671131dbda989a33f0d714eb8abb8a242d
|
data/.rubocop.yml
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
inherit_from:
|
|
4
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
|
+
# .rubocop_todo.yml MUST be the last entry. inherit_from is last-wins:
|
|
6
|
+
# if listed before oss-guides, the shared config's stricter Metrics/
|
|
7
|
+
# (MethodLength, BlockLength, etc.) rules override the todo's per-file
|
|
8
|
+
# grandfathering, and the todo becomes inert on those cops. Empirically
|
|
9
|
+
# verified on suma 2026-07-06: with todo listed first, 34 Metrics/* offenses
|
|
10
|
+
# remained; moved last, cleared. Every gem in the metanorma-org fleet
|
|
11
|
+
# already ships a `.rubocop_todo.yml` on its live tree (audited 2026-07-06,
|
|
12
|
+
# 54/54 have it), so this reference is safe to emit unconditionally.
|
|
13
|
+
- .rubocop_todo.yml
|
|
5
14
|
|
|
6
15
|
# Rubocop plugins enabled centrally so every metanorma-org gem picks them up
|
|
7
16
|
# on cimas sync — best practice belongs at the shared-template layer, not
|
|
@@ -72,6 +72,26 @@ module Metanorma
|
|
|
72
72
|
requirement_metadata1(reqt, dl, reqt.at("./title"))
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
+
# The provisions model fixes the metadata head order
|
|
76
|
+
# (title?, identifier?, subject*, inherit*, classification*), but the
|
|
77
|
+
# elements are emitted in authored order, so a requirement authoring its
|
|
78
|
+
# subject after its classifications is invalid. Reorder the metadata head
|
|
79
|
+
# into the canonical sequence, preserving relative order within each type.
|
|
80
|
+
# https://github.com/metanorma/metanorma-standoc/issues/1239
|
|
81
|
+
REQT_METADATA_HEAD = %w(title identifier subject inherit
|
|
82
|
+
classification).freeze
|
|
83
|
+
|
|
84
|
+
def requirement_metadata_reorder(reqt)
|
|
85
|
+
ordered = REQT_METADATA_HEAD.flat_map { |n| reqt.xpath("./#{n}").to_a }
|
|
86
|
+
ordered.size < 2 and return
|
|
87
|
+
ordered.reverse_each do |e|
|
|
88
|
+
e.unlink
|
|
89
|
+
if reqt.children.empty? then reqt.add_child(e)
|
|
90
|
+
else reqt.children.first.previous = e
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
75
95
|
def requirement_metadata1_attrs
|
|
76
96
|
%w(obligation model type class render)
|
|
77
97
|
end
|
|
@@ -79,6 +79,13 @@ module Metanorma
|
|
|
79
79
|
requirement_inherit_cleanup(xmldoc)
|
|
80
80
|
requirement_descriptions_cleanup(xmldoc)
|
|
81
81
|
requirement_identifier_cleanup(xmldoc)
|
|
82
|
+
requirement_metadata_reorder(xmldoc)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def requirement_metadata_reorder(xmldoc)
|
|
86
|
+
xmldoc.xpath(REQRECPER).each do |r|
|
|
87
|
+
model(r["model"]).requirement_metadata_reorder(r)
|
|
88
|
+
end
|
|
82
89
|
end
|
|
83
90
|
|
|
84
91
|
def requirement_type_cleanup(xmldoc)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mn-requirements
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
319
319
|
- !ruby/object:Gem::Version
|
|
320
320
|
version: '0'
|
|
321
321
|
requirements: []
|
|
322
|
-
rubygems_version: 4.0.
|
|
322
|
+
rubygems_version: 4.0.16
|
|
323
323
|
specification_version: 4
|
|
324
324
|
summary: Requirements processing and rendering according to different models
|
|
325
325
|
test_files: []
|