Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions scripts/validate-register.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,50 @@
end
end

# ---- pass 2b: bibliography markup (renders empty when malformed) -------------
# Metanorma drops bibliography entries without a [[[id,text]]] anchor and
# renders only the first anchor of a multi-anchor entry, so a malformed
# section silently produces an empty trailing "Bibliography" heading.
ROOTS.each do |root|
key = root
all_dirs[root].each do |d|
name = File.basename(d)
next if FROZEN_V1.include?(name)
Dir.glob(File.join(d, "sections", "*.adoc")).each do |f|
lines = File.readlines(f)
lines.each_with_index do |line, i|
next unless line =~ /^== (Bibliography|Normative references)\s*$/

prior = lines[0...i].reverse.find { |l| !l.strip.empty? }
unless prior && prior =~ /^\[bibliography\]\s*$/
report.call(key, "#{name}:#{File.basename(f)}:#{i + 1}: " \
"heading `#{line.strip}` lacks the [bibliography] marker")
end

lines[(i + 1)..].each_with_index do |entry, j|
break if entry =~ /^== /
next unless entry =~ /^\* /

ln = i + 1 + j + 1
anchors = entry.scan(/\[\[\[([^\],]+),/).flatten
if anchors.empty?
report.call(key, "#{name}:#{File.basename(f)}:#{ln}: " \
"bibliography entry without an anchor")
elsif anchors.size > 1
report.call(key, "#{name}:#{File.basename(f)}:#{ln}: " \
"multi-anchor entry (renders later anchors empty): " \
"#{anchors.join(", ")}")
end
if entry =~ /\nofetch\([^)]*\z/
report.call(key, "#{name}:#{File.basename(f)}:#{ln}: " \
"unbalanced nofetch( parenthesis")
end
end
end
end
end
end

# ---- pass 3: cross-part citations resolve ------------------------------------
all_names = all_dirs.values.flatten.map { |d| File.basename(d) }
# Only check citations to series visible in the scanned registers; a sibling
Expand Down
3 changes: 3 additions & 0 deletions sources/asciiunits/sections/99-bibliography.adoc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[bibliography]
== Bibliography

* [[[unitsml-ruby,nofetch(unitsml/unitsml-ruby)]]] — the Ruby implementation of AsciiUnits from which the grammar was extracted, and the reference parser validated against it
* [[[asciiunits-repo,nofetch(unitsml/asciiunits)]]] — the PARG grammar artifact and conformance corpus repository
2 changes: 1 addition & 1 deletion sources/unitsdb/sections/02-normrefs.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[bibliography]
== Normative references

* [[SI_Brochure,BIPM SI Brochure]], SI Brochure: The International System of Units (SI), 9th edition, 2019, BIPM
* [[[SI_Brochure,BIPM SI Brochure]]], SI Brochure: The International System of Units (SI), 9th edition, 2019, BIPM
2 changes: 1 addition & 1 deletion sources/unitsml-36814-unitsdb/sections/02-normrefs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
== Normative references

* [[[unitsml-36812,nofetch(CalConnect 36812)]]]
* [[[unitsml-3682,nofetch(CalConnect 36813]]]
* [[[unitsml-36813,nofetch(CalConnect 36813)]]]
* [[[iso4217,ISO 4217]]] (currency codes)
* [[[iec62720,nofetch(IEC 62720)]]] (units dictionary; source corpus only — no IEC backing of this register is implied)
* [[[cc36811,nofetch(CalConnect 36811)]]], _UnitsML — UnitsDB specification_ (v1 base standard, frozen 2025-03; historical)
4 changes: 2 additions & 2 deletions sources/unitsml-36815-units-model/sections/02-normrefs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
== Normative references

* [[[unitsml-36812,nofetch(CalConnect 36812)]]]
* [[[unitsml-3682,nofetch(CalConnect 36813]]]
* [[[unitsml-3683,nofetch(CalConnect 36814]]]
* [[[unitsml-36813,nofetch(CalConnect 36813)]]]
* [[[unitsml-36814,nofetch(CalConnect 36814)]]]
* [[[jcgm200,JCGM 200:2012]]] (VIM), entries 1.1–1.5, 2.30–2.38
* [[[iso80000-1,ISO 80000-1]]] (quantities and units; scales)
* [[[pendrill2024,nofetch(Pendrill 2024)]]] (L0–L3 concept levels; isq-smart concept system)
6 changes: 3 additions & 3 deletions sources/unitsml-36816-conversions/sections/02-normrefs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
== Normative references

* [[[unitsml-36812,nofetch(CalConnect 36812)]]]
* [[[unitsml-3682,nofetch(CalConnect 36813]]]
* [[[unitsml-3683,nofetch(CalConnect 36814]]]
* [[[unitsml-3684,nofetch(CalConnect 36815]]]
* [[[unitsml-36813,nofetch(CalConnect 36813)]]]
* [[[unitsml-36814,nofetch(CalConnect 36814)]]]
* [[[unitsml-36815,nofetch(CalConnect 36815)]]]
* [[[xsd-float64,nofetch(UnitsML 1.0 XSD Float64ConversionFromType)]]] (the data syntax)
* [[[jcgm100,JCGM 100:2008]]] (exactness discipline analogy)
2 changes: 1 addition & 1 deletion sources/unitsml-36817-asciiunits/sections/02-normrefs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
== Normative references

* [[[unitsml-36812,nofetch(CalConnect 36812)]]]
* [[[unitsml-3683,nofetch(CalConnect 36814]]]
* [[[unitsml-36814,nofetch(CalConnect 36814)]]]
* [[[parg,nofetch(PARG grammar language and artifact format)]]] (parsanol/docs)
* [[[cc36810,nofetch(CalConnect 36810)]]], _AsciiUnits syntax specification_ (v1 base standard, frozen 2025-03; historical)
6 changes: 3 additions & 3 deletions sources/unitsml-36818-xml-usage/sections/02-normrefs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
== Normative references

* [[[unitsml-36812,nofetch(CalConnect 36812)]]]
* [[[unitsml-3683,nofetch(CalConnect 36814]]]
* [[[unitsml-3684,nofetch(CalConnect 36815]]]
* [[[unitsml-3685,nofetch(CalConnect 36816]]]
* [[[unitsml-36814,nofetch(CalConnect 36814)]]]
* [[[unitsml-36815,nofetch(CalConnect 36815)]]]
* [[[unitsml-36816,nofetch(CalConnect 36816)]]]
* [[[xsd-spec,nofetch(generated XSD specification)]]] (base document)
* [[[unitsml-xsd,nofetch(UnitsML 1.0 XSD)]]] (unitsml-v1.0.xsd)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
== Normative references

* [[[unitsml-36812,nofetch(CalConnect 36812)]]]
* [[[unitsml-3682,nofetch(CalConnect 36813]]]
* [[[unitsml-36813,nofetch(CalConnect 36813)]]]
* [[[tested-parts,nofetch(tested parts)]]] — CalConnect 36814–7 and the Plurimath series parts under test
* [[[jcgm101,JCGM 101:2008]]], Clause 7.9 (adaptive procedure)
* [[[jcgm106,JCGM 106:2012]]] (decision vectors)
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* [[[jcgm101-t10,JCGM 101:2008]]], Table 10 (§9.5 results)
* [[[jcgm106-t1,JCGM 106:2012]]], Table 1
* [[[gum5,nofetch(GUM-5:2026)]]], Examples
* [[[testsuite,nofetch(unitsml/unitsml-testsuite#1)]]]
* [[[testsuite-1,nofetch(unitsml/unitsml-testsuite pull 1)]]], the shared render corpus
Loading