Skip to content

Commit

Permalink
bilingual committee names: #5
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Oct 15, 2020
1 parent 8cd8191 commit 79d7a5d
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 48 deletions.
37 changes: 19 additions & 18 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,29 @@ document may still remain in effect. Comma delimited.
`:status:``:: The document status. The permitted types are: `draft-proposal`,
`draft-development`, `in-force`, `retired`.

`:committee:`:: The name of the relevant committee (mandatory)
`:committee-en:`:: The name of the relevant committee in English (mandatory)
`:committee-fr:`:: The name of the relevant committee in French (mandatory)
`:committee-acronym:`:: The acronym of the relevant committee (mandatory)
+
--
* CGPM: General Conference on Weights and Measures
* CIPM: International Committee for Weights and Measures
* BIPM: International Bureau of Weights and Measures
* CCAUV: Consultative Committee for Acoustics, Ultrasound and Vibration
* CCEM: Consultative Committee for Electricity and Magnetism
* CCL: Consultative Committee for Length
* CCM: Consultative Committee for Mass and Related Quantities
* CCPR: Consultative Committee for Photometry and Radiometry
* CCQM: Consultative Committee for Amount of Substance:: Metrology in Chemistry and Biology
* CCRI: Consultative Committee for Ionizing Radiation
* CCT: Consultative Committee for Thermometry
* CCTF: Consultative Committee for Time and Frequency
* CCU: Consultative Committee for Units
* CGPM: General Conference on Weights and Measures / Conférence générale des poids et mesures
* CIPM: International Committee for Weights and Measures / Comité international des poids et mesures
* BIPM: International Bureau of Weights and Measures / Bureau International des Poids et Mesures
* CCAUV: Consultative Committee for Acoustics, Ultrasound and Vibration / Comité consultatif de l'acoustique, des ultrasons et des vibrations
* CCEM: Consultative Committee for Electricity and Magnetism / Comité consultatif d'électricité et magnétisme
* CCL: Consultative Committee for Length / Comité consultatif des longueurs
* CCM: Consultative Committee for Mass and Related Quantities / Comité consultatif pour la masse et les grandeurs apparentées
* CCPR: Consultative Committee for Photometry and Radiometry / Comité consultatif de photométrie et radiométrie
* CCQM: Consultative Committee for Amount of Substance: Metrology in Chemistry and Biology / Comité consultatif pour la quantité de matière : métrologie en chimie et biologie
* CCRI: Consultative Committee for Ionizing Radiation / Comité consultatif des rayonnements ionisants
* CCT: Consultative Committee for Thermometry / Comité consultatif de thermométrie
* CCTF: Consultative Committee for Time and Frequency / Comité consultatif du temps et des fréquences
* CCU: Consultative Committee for Units / Comité consultatif des unités
* CCL-CCTF: Frequency Standards Working Group
* JCGM: Joint Committee for Guides in Metrology
* JCRB: Joint Committee of the Regional Metrology Organizations and the BIPM
* JCTLM: Joint Committee for Traceability in Laboratory Medicine
* INetQI: International Network on Quality Infrastructure
* JCGM: Joint Committee for Guides in Metrology / Comité commun pour les guides en métrologie
* JCRB: Joint Committee of the Regional Metrology Organizations and the BIPM / Comité mixte des organisations régionales de métrologie et du BIPM
* JCTLM: Joint Committee for Traceability in Laboratory Medicine / Comité commun pour la traçabilité en médecine de laboratoire
* INetQI: International Network on Quality Infrastructure
--
`:workgroup:`:: The name of the relevant workgroup (mandatory)
`:workgroup-acronym:`:: The acronym of the relevant workgroup (mandatory)
Expand Down
52 changes: 36 additions & 16 deletions lib/asciidoctor/bipm/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,44 @@ def configuration
end

def metadata_committee(node, xml)
return unless node.attr("committee")
return unless node.attr("committee-en") || node.attr("committee-fr")
xml.editorialgroup do |a|
a.committee node.attr("committee"),
acronym: node.attr("committee-acronym")
i = 2
while node.attr("committee_#{i}") do
a.committee node.attr("committee_#{i}"),
acronym: node.attr("committee-acronym_#{i}")
i += 1
end
a.workgroup node.attr("workgroup"),
acronym: node.attr("workgroup-acronym")
i = 2
while node.attr("workgroup_#{i}") do
a.workgroup node.attr("workgroup_#{i}"),
acronym: node.attr("workgroup-acronym_#{i}")
i += 1
metadata_committee1(node, a)
metadata_committee2(node, a)
metadata_workgroup(node, a)
end
end

def metadata_committee1(node, a)
a.committee **attr_code(acronym: node.attr("committee-acronym")) do |c|
e = node.attr("committee-en") and
c.variant e, language: "en", script: "Latn"
e = node.attr("committee-fr") and
c.variant e, language: "fr", script: "Latn"
end
end

def metadata_committee2(node, a)
i = 2
while node.attr("committee-en_#{i}") || node.attr("committee-fr_#{i}") do
a.committee **attr_code(acronym: node.attr("committee-acronym_#{i}")) do |c|
e = node.attr("committee-en_#{i}") and
c.variant e, language: "en", script: "Latn"
e = node.attr("committee-fr_#{i}") and
c.variant e, language: "fr", script: "Latn"
end
i += 1
end
end

def metadata_workgroup(node, a)
a.workgroup node.attr("workgroup"),
**attr_code(acronym: node.attr("workgroup-acronym"))
i = 2
while node.attr("workgroup_#{i}") do
a.workgroup node.attr("workgroup_#{i}"),
**attr_code(acronym: node.attr("workgroup-acronym_#{i}"))
i += 1
end
end

Expand Down
8 changes: 7 additions & 1 deletion lib/isodoc/bipm/html/html_bipm_titlepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@
{% endif %}
</div>

{% for item in metadata_extensions["editorialgroup"]["committee"]["variant_language"] %}
{% if item == lang %}
{% assign committee = metadata_extensions["editorialgroup"]["committee"]["variant"][forloop.index0] %}
{% endif %}
{% endfor %}

<div class="coverpage-tc-name">
<span>{{ metadata_extensions["editorialgroup"]["committee_acronym"] }}{% if metadata_extensions["editorialgroup"]["committee_acronym"] and metadata_extensions["editorialgroup"]["committee"] %}: {% endif %}{{ metadata_extensions["editorialgroup"]["committee"] }}</span>
<span>{{ metadata_extensions["editorialgroup"]["committee_acronym"] }}{% if metadata_extensions["editorialgroup"]["committee_acronym"] and committee %}: {% endif %}{{ committee }}</span>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion metanorma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ committees:
- Comité international des poids et mesures
- BIPM
- International Bureau of Weights and Measures
- Bureau Inernational des Poids et Mesures
- Bureau International des Poids et Mesures
- CCAUV
- Consultative Committee for Acoustics, Ultrasound and Vibration
- Comité consultatif de l'acoustique, des ultrasons et des vibrations
Expand Down
21 changes: 15 additions & 6 deletions spec/asciidoctor/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
Author
:docfile: test.adoc
:novalid:
:no-pdf:
INPUT

output = xmlpp(<<~"OUTPUT")
Expand All @@ -31,8 +30,10 @@
OUTPUT

system "rm -f test.html"
system "rm -f test.pdf"
expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :bipm, header_footer: true)))).to be_equivalent_to output
expect(File.exist?("test.html")).to be true
expect(File.exist?("test.pdf")).to be true
end

it "processes default metadata" do
Expand All @@ -47,7 +48,8 @@
:edition: 2
:revdate: 2000-01-01
:draft: 3.4
:committee: TC
:committee-en: TC
:committee-fr: CT
:committee-acronym: TCA
:committee-number: 1
:committee-type: A
Expand Down Expand Up @@ -147,7 +149,10 @@
<ext>
<doctype>brochure</doctype>
<editorialgroup>
<committee acronym="TCA">TC</committee>
<committee acronym="TCA">
<variant language='en' script='Latn'>TC</variant>
<variant language='fr' script='Latn'>CT</variant>
</committee>
<workgroup acronym="WGA">WG</workgroup>
</editorialgroup>
<comment-period>
Expand Down Expand Up @@ -181,7 +186,8 @@
:edition: 2
:revdate: 2000-01-01
:draft: 3.4
:committee: TC
:committee-en: TC
:committee-fr: CT
:committee-number: 1
:committee-type: A
:subcommittee: SC
Expand Down Expand Up @@ -274,8 +280,11 @@
<ext>
<doctype>brochure</doctype>
<editorialgroup>
<committee acronym="">TC</committee>
<workgroup acronym="">WG</workgroup>
<committee>
<variant language='en' script='Latn'>TC</variant>
<variant language='fr' script='Latn'>CT</variant>
</committee>
<workgroup>WG</workgroup>
</editorialgroup>
<comment-period>
<from>X</from>
Expand Down
30 changes: 24 additions & 6 deletions spec/isodoc/html_convert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
</copyright>
<ext>
<editorialgroup>
<committee acronym="A">TC</committee>
<committee acronym='TCA'>
<variant language='en' script='Latn'>TC</variant>
<variant language='fr' script='Latn'>CT</variant>
</committee>
<workgroup acronym="B">WC</committee>
</editorialgroup>
<comment-period><from>N1</from><to>N2</to></comment-period>
Expand Down Expand Up @@ -94,7 +97,10 @@
</copyright>
<ext>
<editorialgroup>
<committee type="A">TC</committee>
<committee acronym='TCA'>
<variant language='en' script='Latn'>TC</variant>
<variant language='fr' script='Latn'>CT</variant>
</committee>
</editorialgroup>
<comment-period><from>N1</from><to>N2</to></comment-period>
<si-aspect>A_e_deltanu</si-aspect>
Expand Down Expand Up @@ -127,19 +133,21 @@
:draftinfo=>" (draft 3.4, 2000-01-01)",
:implementeddate=>"XXX",
:issueddate=>"XXX",
:lang=>"en",
:logo=>"#{File.join(logoloc, "logo.png")}",
:metadata_extensions=>{"editorialgroup"=>{"committee_acronym"=>"A", "committee"=>"TC", "workgroup_acronym"=>"B", "workgroup"=>"WC"}, "comment-period"=>{"from"=>"N1", "to"=>"N2"}, "si-aspect"=>"A_e_deltanu", "structuredidentifier"=>{"docnumber"=>"1000", "appendix"=>"ABC"}},
:metadata_extensions=>{"editorialgroup"=>{"committee_acronym"=>"TCA", "committee"=>{"variant_language"=>["en", "fr"], "variant_script"=>["Latn", "Latn"], "variant"=>["TC", "CT"]}, "workgroup_acronym"=>"B", "workgroup"=>"WC"}, "comment-period"=>{"from"=>"N1", "to"=>"N2"}, "si-aspect"=>"A_e_deltanu", "structuredidentifier"=>{"docnumber"=>"1000", "appendix"=>"ABC"}},
:obsoleteddate=>"XXX",
:publisheddate=>"XXX",
:publisher=>"#{Metanorma::BIPM.configuration.organization_name_long}",
:receiveddate=>"XXX",
:revdate=>"2000-01-01",
:revdate_monthyear=>"January 2000",
:script=>"Latn",
:si_aspect_index=>#{si_aspect},
:si_aspect_paths=>#{si_aspect_paths},
:stage=>"Mise en Pratique",
:stage_display=>"En Vigeur",
:tc=>"TC",
:tc=>"\\n TC\\n CT\\n",
:transmitteddate=>"XXX",
:unchangeddate=>"XXX",
:unpublished=>true,
Expand Down Expand Up @@ -193,7 +201,10 @@
</owner>
</copyright>
<editorialgroup>
<committee type="A">TC</committee>
<committee acronym='TCA'>
<variant language='en' script='Latn'>TC</variant>
<variant language='fr' script='Latn'>CT</variant>
</committee>
</editorialgroup>
<security>Client Confidential</security>
<ext><doctype>cipm-mra</doctype>
Expand Down Expand Up @@ -237,7 +248,10 @@
</owner>
</copyright>
<editorialgroup>
<committee type="A">TC</committee>
<committee acronym='TCA'>
<variant language='en' script='Latn'>TC</variant>
<variant language='fr' script='Latn'>CT</variant>
</committee>
</editorialgroup>
<security>Client Confidential</security>
<ext><doctype>procès-verbal</doctype>
Expand Down Expand Up @@ -273,6 +287,7 @@
:draftinfo=>" (brouillon 3.4, 2000-01-01)",
:implementeddate=>"XXX",
:issueddate=>"XXX",
:lang=>"fr",
:logo=>"#{File.join(logoloc, "logo.png")}",
:metadata_extensions=>{"doctype"=>"cipm-mra", "comment-period"=>{"from"=>"N1", "to"=>"N2"}, "structuredidentifier"=>{"docnumber"=>"1000", "appendix"=>"ABC"}},
:obsoleteddate=>"XXX",
Expand All @@ -281,6 +296,7 @@
:receiveddate=>"XXX",
:revdate=>"2000-01-01",
:revdate_monthyear=>"Janvier 2000",
:script=>"Latn",
:si_aspect_index=>#{si_aspect},
:si_aspect_paths=>#{si_aspect_paths},
:stage=>"Working Draft",
Expand Down Expand Up @@ -321,12 +337,14 @@
:draftinfo=>" (draft 3.4, 2000-01-01)",
:implementeddate=>"XXX",
:issueddate=>"XXX",
:lang=>"en",
:logo=>"#{File.join(logoloc, "logo.png")}",
:obsoleteddate=>"XXX",
:publisheddate=>"XXX",
:receiveddate=>"XXX",
:revdate=>"2000-01-01",
:revdate_monthyear=>"January 2000",
:script=>"Latn",
:si_aspect_index=>#{si_aspect},
:si_aspect_paths=>#{si_aspect_paths},
:stage=>"Standard",
Expand Down

0 comments on commit 79d7a5d

Please sign in to comment.