metanorma-iso 3.5.38 → 3.5.39
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/Gemfile +1 -1
- data/README.adoc +13 -0
- data/docs/validation.md +137 -0
- data/lib/isodoc/iso/docx/middle_title_renderer.rb +1 -1
- data/lib/isodoc/iso/iso.amendment.xsl +9 -2
- data/lib/isodoc/iso/iso.international-standard.xsl +9 -2
- data/lib/metanorma/iso/html/renderer.rb +505 -508
- data/lib/metanorma/iso/themes/iso/theme.yaml +9 -2
- data/lib/metanorma/iso/themes/iso-legacy/theme.yaml +9 -2
- data/lib/metanorma/iso/validation/model_validator.rb +13 -0
- data/lib/metanorma/iso/validation/rules/base.rb +34 -0
- data/lib/metanorma/iso/validation/rules/doctype_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/foreword_presence_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/foreword_structure_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/iteration_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/normative_references_presence_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/only_child_clause_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/scope_presence_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/scope_subclauses_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/section_sequence_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/style_abbrev_articles_rule.rb +5 -2
- data/lib/metanorma/iso/validation/rules/style_empty_clause_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/subcommittee_type_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/subpart_iec_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/symbols_section_content_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/symbols_section_count_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/technical_committee_type_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/termdef_style_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/terms_presence_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/title_first_level_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/title_names_doctype_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/title_pairing_rule.rb +4 -0
- data/lib/metanorma/iso/validation/rules/title_siblings_consistency_rule.rb +4 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/script/migrate-logo-records.rb +92 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35d1a73671c86ea8da53081c22ec75f215a4cf24a59f45f2bfd023d3e9cc62ba
|
|
4
|
+
data.tar.gz: b66d49974971efc6a92afda9287877ecc450e1cb3b2f6c1eee19b2309a780cf1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fc42430aac8ba3a63d1b04909254617a5e6013d7dbb9f49c499b285c2b5d45743c6ff7ab092f24c213240e34cb1b7431b59c38e2580f234d37074112181151f
|
|
7
|
+
data.tar.gz: f9e5ad2b9602fd98a9c857a82daad6f2aee1d7a67d98e3799a1d9977f4a973b490d5350c403849e6de7eb9f6dc54d1ee6314ba353afbfbcc16b0dffcbdc619a2
|
data/Gemfile
CHANGED
|
@@ -12,7 +12,7 @@ gem "metanorma-standoc", "~> 3.5.7" # Standoc::Document split + the pubid-dispat
|
|
|
12
12
|
# Dev pin: golden capture and the engine-delegation parity runs execute
|
|
13
13
|
# against the released engine (metanorma-document#165); the gemspec
|
|
14
14
|
# floor is raised in the engine-delegation wave.
|
|
15
|
-
gem "metanorma-document", "~> 0.5.
|
|
15
|
+
gem "metanorma-document", "~> 0.5.21" # the logo records schema wave
|
|
16
16
|
gem "rake"
|
|
17
17
|
# relaton-bib is retired; its successors ship in the relaton 3.1 line.
|
|
18
18
|
gem "rspec"
|
data/README.adoc
CHANGED
|
@@ -92,6 +92,19 @@ The metanorma-cli gem is the command-line interface for the Metanorma tool suite
|
|
|
92
92
|
|
|
93
93
|
See https://www.metanorma.com/author/iso/[The ISO flavor of Metanorma].
|
|
94
94
|
|
|
95
|
+
The validation subsystem is documented in the `docs/` directory:
|
|
96
|
+
|
|
97
|
+
* link:docs/validation.md[The validation system] — rules and codes, the
|
|
98
|
+
validation profiles (`DEFAULT`, `STRICT`, `PUBLICATION`, published profile
|
|
99
|
+
files, `only_codes`/`except_codes`) and the amendment document-type
|
|
100
|
+
exemption (`exempt_doctypes`).
|
|
101
|
+
* link:docs/validation-rule-kinds.md[Validation rule kinds] — the four
|
|
102
|
+
implementation kinds behind a rule code.
|
|
103
|
+
* link:docs/validation-suppression-authoring.md[Suppressing validation
|
|
104
|
+
warnings] — the document-level suppression attributes.
|
|
105
|
+
* link:docs/validation-baselines.md[Validation baselines] — the flavour
|
|
106
|
+
severity baselines and the suppression resolution chain.
|
|
107
|
+
|
|
95
108
|
== Examples
|
|
96
109
|
|
|
97
110
|
* Example documents are avalable at the https://github.com/metanorma/mn-samples-iso[mn-samples-iso] repository.
|
data/docs/validation.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# The metanorma-iso validation system
|
|
2
|
+
|
|
3
|
+
Metanorma-iso validates a document against the ISO/IEC Directives, Part 2
|
|
4
|
+
and the ISO House Style, and reports every violation with a stable rule
|
|
5
|
+
code such as `ISO_29` or `ISO_63`. This page documents the machinery that
|
|
6
|
+
decides which rules run: the rule registry, the validation profiles, and
|
|
7
|
+
the document-type exemption that keeps amendment documents free of
|
|
8
|
+
full-standard structure findings. The sibling pages cover the rule
|
|
9
|
+
implementation kinds (`validation-rule-kinds.md`), the document-level
|
|
10
|
+
suppression attributes (`validation-suppression-authoring.md`) and the
|
|
11
|
+
flavour severity baselines (`validation-baselines.md`).
|
|
12
|
+
|
|
13
|
+
## Rules and codes
|
|
14
|
+
|
|
15
|
+
Every rule is a `Metanorma::Iso::Validation::Rules::Base` subclass that
|
|
16
|
+
declares its log key with `code "ISO_N"`, its policy documentation with a
|
|
17
|
+
`policy` declaration, and returns findings from `#check`. The registry
|
|
18
|
+
(`Metanorma::Iso::Validation::RuleRegistry`) discovers every concrete rule
|
|
19
|
+
class under `lib/metanorma/iso/validation/rules/` automatically; a new rule
|
|
20
|
+
file plus one autoload line is the whole registration. The orchestrator
|
|
21
|
+
(`Metanorma::Iso::Validation::ModelValidator`) runs the discovered rules
|
|
22
|
+
against the deserialized document model and mirrors the findings into the
|
|
23
|
+
converter log and the structured report.
|
|
24
|
+
|
|
25
|
+
## Validation profiles
|
|
26
|
+
|
|
27
|
+
A profile filters which rules run and configures how warnings are treated.
|
|
28
|
+
Profiles are composable: new profiles are new instances, no existing code
|
|
29
|
+
changes.
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
# The built-in profiles
|
|
33
|
+
Metanorma::Iso.validate(xml, profile: Metanorma::Iso::Validation::Profile::DEFAULT)
|
|
34
|
+
Metanorma::Iso.validate(xml, profile: Metanorma::Iso::Validation::Profile::STRICT)
|
|
35
|
+
Metanorma::Iso.validate(xml, profile: Metanorma::Iso::Validation::Profile::PUBLICATION)
|
|
36
|
+
|
|
37
|
+
# A custom profile
|
|
38
|
+
profile = Metanorma::Iso::Validation::Profile.new(
|
|
39
|
+
name: "ci",
|
|
40
|
+
only_codes: ["ISO_5", "ISO_29", "ISO_30", "ISO_31"],
|
|
41
|
+
strict_warnings: true
|
|
42
|
+
)
|
|
43
|
+
Metanorma::Iso.validate(xml, profile: profile)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The filters are additive: `only_codes` keeps just the named rules;
|
|
47
|
+
`except_codes` drops the named ones. `strict_warnings` promotes warnings to
|
|
48
|
+
fatal findings, so a report with warnings fails alongside reports with
|
|
49
|
+
errors.
|
|
50
|
+
|
|
51
|
+
The built-in profiles are:
|
|
52
|
+
|
|
53
|
+
* `DEFAULT` — every rule runs; warnings are not fatal.
|
|
54
|
+
* `STRICT` — every rule runs; warnings are fatal.
|
|
55
|
+
* `PUBLICATION` — every rule runs except the style-warning family
|
|
56
|
+
(the House Style text lints), for documents whose style findings have
|
|
57
|
+
already been addressed.
|
|
58
|
+
|
|
59
|
+
### Published profiles
|
|
60
|
+
|
|
61
|
+
Declarative profile files ship with the gem under
|
|
62
|
+
`lib/metanorma/iso/validation/profiles/` (for example `house-style.yml`,
|
|
63
|
+
`quality-english.yml`, `oxford-spelling.yml`). Each file declares the
|
|
64
|
+
`metanorma-validation-profile/1` schema and a `select:` block whose entries
|
|
65
|
+
pick rules by policy metadata — `mn_category`, `source` or `category` — or
|
|
66
|
+
directly by rule class name. Entries are disjunctive; the keys inside one
|
|
67
|
+
entry are conjunctive.
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
schema: metanorma-validation-profile/1
|
|
71
|
+
profile: house-style-core
|
|
72
|
+
flavor: iso
|
|
73
|
+
select:
|
|
74
|
+
- mn_category: style
|
|
75
|
+
source: house_style
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Load a published profile with `Profile.load`:
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
profile = Metanorma::Iso::Validation::Profile.load("house-style-core")
|
|
82
|
+
Metanorma::Iso.validate(xml, profile: profile)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
An unknown profile name or an unrecognized schema aborts the load, so an
|
|
86
|
+
importer pins behavior instead of drifting.
|
|
87
|
+
|
|
88
|
+
## The amendment document-type exemption
|
|
89
|
+
|
|
90
|
+
Some rules enforce the full-standard structure contract: the Scope clause
|
|
91
|
+
(`ISO_29`), the Normative references (`ISO_30`), the Terms and definitions
|
|
92
|
+
clause (`ISO_31`), the section sequencing (`ISO_28`) and the subclause-free
|
|
93
|
+
Scope (`ISO_39`). Amendments and technical corrigenda are not freestanding
|
|
94
|
+
standards and legitimately lack these elements; running the structure
|
|
95
|
+
contract against them produces false positives.
|
|
96
|
+
|
|
97
|
+
Such rules declare the doctypes they do not apply to with the
|
|
98
|
+
`exempt_doctypes` class-level DSL:
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
class ScopePresenceRule < Base
|
|
102
|
+
code "ISO_29"
|
|
103
|
+
|
|
104
|
+
policy category: "Document structure",
|
|
105
|
+
rule: "the document must contain a Scope clause",
|
|
106
|
+
source: :directives, directives: "14.3",
|
|
107
|
+
mn_category: :structure
|
|
108
|
+
|
|
109
|
+
# Amendments and technical corrigenda are not freestanding
|
|
110
|
+
# standards; the full-standard structure contract does not
|
|
111
|
+
# apply to them (metanorma/metanorma-pdfa#130).
|
|
112
|
+
exempt_doctypes "amendment", "technical-corrigendum"
|
|
113
|
+
end
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The engine enforces the declaration at the rule-run site:
|
|
117
|
+
`ModelValidator` skips a rule when the document's doctype — carried on the
|
|
118
|
+
run's `ConverterState` — appears in the rule's `exempt_doctypes` list. A
|
|
119
|
+
document without a doctype exempts nothing, and rules that do not declare
|
|
120
|
+
the exemption run for every doctype. Declarations accumulate across calls
|
|
121
|
+
and the accumulated list is frozen.
|
|
122
|
+
|
|
123
|
+
The declaration is kept honest by an audit specification
|
|
124
|
+
(`spec/metanorma/validation/exempt_doctypes_spec.rb`): every registered
|
|
125
|
+
rule whose policy category is `Document structure` must declare the
|
|
126
|
+
amendment exemption, so a future structure rule without the declaration
|
|
127
|
+
fails CI. A rule author who sees that failure either adds the declaration
|
|
128
|
+
or reconsiders the rule's category.
|
|
129
|
+
|
|
130
|
+
## Further reading
|
|
131
|
+
|
|
132
|
+
* `docs/validation-rule-kinds.md` — the four implementation kinds and why
|
|
133
|
+
the code is the interface.
|
|
134
|
+
* `docs/validation-suppression-authoring.md` — the document-level
|
|
135
|
+
suppression attributes.
|
|
136
|
+
* `docs/validation-baselines.md` — the flavour severity baselines and the
|
|
137
|
+
suppression resolution chain.
|
|
@@ -89,7 +89,7 @@ module IsoDoc
|
|
|
89
89
|
description = localized.title_amd&.value.to_s.strip
|
|
90
90
|
return if label.empty? && description.empty?
|
|
91
91
|
|
|
92
|
-
text = label.empty?
|
|
92
|
+
text = [label, description].reject(&:empty?).join(": ")
|
|
93
93
|
append_title(doc, :main_title2, text)
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -1261,7 +1261,7 @@
|
|
|
1261
1261
|
<xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or ($layoutVersion = '1989' and $revision_date_num <= 19981231)"><!-- copyright renders in the footer footer-preface-first_1987-1998--></xsl:when>
|
|
1262
1262
|
<xsl:otherwise>
|
|
1263
1263
|
|
|
1264
|
-
<xsl:call-template name="inner-cover-
|
|
1264
|
+
<xsl:call-template name="inner-cover-pages">
|
|
1265
1265
|
<xsl:with-param name="num" select="$num"/>
|
|
1266
1266
|
</xsl:call-template>
|
|
1267
1267
|
|
|
@@ -4366,7 +4366,7 @@
|
|
|
4366
4366
|
<!-- ============================= -->
|
|
4367
4367
|
|
|
4368
4368
|
<!-- element with title -->
|
|
4369
|
-
<xsl:template match="*[mn:title or mn:fmt-title]" mode="contents">
|
|
4369
|
+
<xsl:template match="*[mn:title or mn:fmt-title]" mode="contents" name="title_contents">
|
|
4370
4370
|
<xsl:variable name="level">
|
|
4371
4371
|
<xsl:call-template name="getLevel">
|
|
4372
4372
|
<xsl:with-param name="depth" select="mn:fmt-title/@depth | mn:title/@depth"/>
|
|
@@ -8283,6 +8283,13 @@
|
|
|
8283
8283
|
</xsl:call-template>
|
|
8284
8284
|
</xsl:template>
|
|
8285
8285
|
|
|
8286
|
+
<xsl:template name="inner-cover-pages">
|
|
8287
|
+
<xsl:param name="num"/>
|
|
8288
|
+
<xsl:call-template name="inner-cover-page">
|
|
8289
|
+
<xsl:with-param name="num" select="$num"/>
|
|
8290
|
+
</xsl:call-template>
|
|
8291
|
+
</xsl:template>
|
|
8292
|
+
|
|
8286
8293
|
<!-- insert cover page image -->
|
|
8287
8294
|
<!-- background cover image -->
|
|
8288
8295
|
<xsl:template name="insertBackgroundPageImage">
|
|
@@ -1261,7 +1261,7 @@
|
|
|
1261
1261
|
<xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or ($layoutVersion = '1989' and $revision_date_num <= 19981231)"><!-- copyright renders in the footer footer-preface-first_1987-1998--></xsl:when>
|
|
1262
1262
|
<xsl:otherwise>
|
|
1263
1263
|
|
|
1264
|
-
<xsl:call-template name="inner-cover-
|
|
1264
|
+
<xsl:call-template name="inner-cover-pages">
|
|
1265
1265
|
<xsl:with-param name="num" select="$num"/>
|
|
1266
1266
|
</xsl:call-template>
|
|
1267
1267
|
|
|
@@ -4366,7 +4366,7 @@
|
|
|
4366
4366
|
<!-- ============================= -->
|
|
4367
4367
|
|
|
4368
4368
|
<!-- element with title -->
|
|
4369
|
-
<xsl:template match="*[mn:title or mn:fmt-title]" mode="contents">
|
|
4369
|
+
<xsl:template match="*[mn:title or mn:fmt-title]" mode="contents" name="title_contents">
|
|
4370
4370
|
<xsl:variable name="level">
|
|
4371
4371
|
<xsl:call-template name="getLevel">
|
|
4372
4372
|
<xsl:with-param name="depth" select="mn:fmt-title/@depth | mn:title/@depth"/>
|
|
@@ -8283,6 +8283,13 @@
|
|
|
8283
8283
|
</xsl:call-template>
|
|
8284
8284
|
</xsl:template>
|
|
8285
8285
|
|
|
8286
|
+
<xsl:template name="inner-cover-pages">
|
|
8287
|
+
<xsl:param name="num"/>
|
|
8288
|
+
<xsl:call-template name="inner-cover-page">
|
|
8289
|
+
<xsl:with-param name="num" select="$num"/>
|
|
8290
|
+
</xsl:call-template>
|
|
8291
|
+
</xsl:template>
|
|
8292
|
+
|
|
8286
8293
|
<!-- insert cover page image -->
|
|
8287
8294
|
<!-- background cover image -->
|
|
8288
8295
|
<xsl:template name="insertBackgroundPageImage">
|