Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/letter symbol type #835

Merged
merged 4 commits into from
Nov 30, 2023
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
13 changes: 13 additions & 0 deletions lib/metanorma/standoc/biblio.rng
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,16 @@
<ref name="image"/>
</element>
</define>
<define name="depiction">
<element name="depiction">
<optional>
<attribute name="scope"/>
</optional>
<zeroOrMore>
<ref name="image"/>
</zeroOrMore>
</element>
</define>
<define name="NameWithVariants">
<element name="primary">
<ref name="LocalizedString"/>
Expand Down Expand Up @@ -760,6 +770,9 @@
<optional>
<ref name="validity"/>
</optional>
<optional>
<ref name="depiction"/>
</optional>
</define>
<define name="ReducedBibliographicItem">
<optional>
Expand Down
12 changes: 6 additions & 6 deletions lib/metanorma/standoc/cleanup_terms_designations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ def termdef_stem_cleanup(xmldoc)
xmldoc.xpath("//term//expression/name[stem]").each do |n|
test = n.dup
test.at("./stem").remove
next unless test.text.strip.empty?

test.text.strip.empty? or next
n.parent.name = "letter-symbol"
end
end
Expand Down Expand Up @@ -107,10 +106,11 @@ def term_dl_to_designation_category(prev, category)
end

def term_to_letter_symbol(prev, dlist)
ls = dlist.at("./dt[text()='letter-symbol']/following::dd/p")
return unless ls&.text == "true"

prev.at(".//expression").name = "letter-symbol"
ls = dlist.at("./dt[text()='letter-symbol']/following::dd/p")&.text
!ls || ls == "false" and return
e = prev.at(".//expression")
e.name = "letter-symbol"
ls != "true" and e["type"] = ls
end

def dl_to_designation(dlist)
Expand Down
12 changes: 11 additions & 1 deletion lib/metanorma/standoc/isodoc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
these elements; we just want one namespace for any child grammars
of this.
-->
<!-- VERSION v1.2.8 -->
<!-- VERSION v1.2.9 -->
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<include href="reqt.rng"/>
<include href="basicdoc.rng">
Expand Down Expand Up @@ -1958,6 +1958,16 @@
<data type="boolean"/>
</attribute>
</optional>
<optional>
<attribute name="type">
<choice>
<value>letter</value>
<value>symbol</value>
<value>formula</value>
<value>equation</value>
</choice>
</attribute>
</optional>
<element name="name">
<oneOrMore>
<choice>
Expand Down
8 changes: 4 additions & 4 deletions spec/metanorma/cleanup_terms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,14 @@
alt:[Third Designation]

[%metadata]
letter-symbol:: true
letter-symbol:: letter

deprecated:[stem:[t_90]]

related:see[<<second>>,Fifth Designation]

[%metadata]
letter-symbol:: true
letter-symbol:: equation

Definition
INPUT
Expand All @@ -848,7 +848,7 @@
</expression>
</preferred>
<admitted>
<letter-symbol>
<letter-symbol type="letter">
<name>Third Designation</name>
</letter-symbol>
</admitted>
Expand All @@ -871,7 +871,7 @@
</deprecates>
<related type='see'>
<preferred>
<letter-symbol>
<letter-symbol type="equation">
<name>Fifth Designation</name>
</letter-symbol>
</preferred>
Expand Down
31 changes: 15 additions & 16 deletions spec/metanorma/refs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@
[bibliography]
== Normative References

* [[[iso123,BIPM CIPM RES 1]]] _Standard_
* [[[iso123,BIPM CIPM RES 1 (1879)]]] _Standard_
INPUT
output = <<~OUTPUT
#{BLANK_HDR}
Expand All @@ -1299,23 +1299,22 @@
<references id="_" normative="true" obligation="informative">
<title>Normative references</title>
<p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
<bibitem id="iso123" type="proceedings">
<bibitem id="iso123" type="proceedings">
<fetched/>
<title format="text/plain" language="en" script="Latn">Definition of the unit of time (second)</title>
<uri type="citation" language="en" script="Latn">https://www.bipm.org/en/committees/ci/cipm/46-1956/resolution-1</uri>
<uri type="citation" language="fr" script="Latn">https://www.bipm.org/fr/committees/ci/cipm/46-1956/resolution-1</uri>
<uri type="src" language="en" script="Latn">https://raw.githubusercontent.com/metanorma/bipm-data-outcomes/main/cipm/meetings-en/meeting-46.yml</uri>
<uri type="src" language="fr" script="Latn">https://raw.githubusercontent.com/metanorma/bipm-data-outcomes/main/cipm/meetings-fr/meeting-46.yml</uri>
<uri type="pdf">https://www.bipm.org/documents/20126/17315032/CIPM46.pdf/31124ce6-06d5-4981-7c93-a49484479053</uri>
<docidentifier type="BIPM" primary="true">CIPM RES 1 (1956)</docidentifier>
<docidentifier type="BIPM" primary="true" language="en" script="Latn">CIPM RES 1 (1956, E)</docidentifier>
<docidentifier type="BIPM" primary="true" language="fr" script="Latn">CIPM RES 1 (1956, F)</docidentifier>
<docidentifier type="BIPM-long" language="en" script="Latn">CIPM Resolution 1 (1956)</docidentifier>
<docidentifier type="BIPM-long" language="fr" script="Latn">Résolution 1 du CIPM (1956)</docidentifier>
<docidentifier type="BIPM-long">CIPM Resolution 1 (1956) / Résolution 1 du CIPM (1956)</docidentifier>
<docnumber>CIPM RES 1 (1956)</docnumber>
<title format="text/plain" language="en" script="Latn">Signes abréviatifs pour les poids et mesures métriques</title>
<uri type="citation" language="en" script="Latn">https://www.bipm.org/en/committees/ci/cipm/4-1879/resolution-</uri>
<uri type="src" language="en" script="Latn">https://raw.githubusercontent.com/metanorma/bipm-data-outcomes/main/cipm/meetings-en/meeting-4.yml</uri>
<uri type="src" language="fr" script="Latn">https://raw.githubusercontent.com/metanorma/bipm-data-outcomes/main/cipm/meetings-fr/meeting-4.yml</uri>
<uri type="pdf">https://www.bipm.org/documents/20126/17315032/CIPM4.pdf/47e647d4-26c2-d3d6-b367-e749fb22b261</uri>
<docidentifier type="BIPM" primary="true">CIPM RES (1879)</docidentifier>
<docidentifier type="BIPM" primary="true" language="en" script="Latn">CIPM RES (1879, E)</docidentifier>
<docidentifier type="BIPM" primary="true" language="fr" script="Latn">CIPM RES (1879, F)</docidentifier>
<docidentifier type="BIPM-long" language="en" script="Latn">CIPM Resolution (1879)</docidentifier>
<docidentifier type="BIPM-long" language="fr" script="Latn">Résolution du CIPM (1879)</docidentifier>
<docidentifier type="BIPM-long">CIPM Resolution (1879) / Résolution du CIPM (1879)</docidentifier>
<docnumber>CIPM RES (1879)</docnumber>
<date type="published">
<on>1956-10-06</on>
<on>1879-10-13</on>
</date>
<contributor>
<role type="publisher"/>
Expand Down
42 changes: 21 additions & 21 deletions spec/vcr_cassettes/bipm.yml

Large diffs are not rendered by default.