From 9ffb573262703fb7d26a55759d2a63349ac93418 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Fri, 24 Nov 2023 00:12:31 +1100 Subject: [PATCH] refactor organisation contributor metadata, add ITU abbreviation to metadata, i18n of ITU name and abbreviation in metadata: https://github.com/metanorma/metanorma-nist/issues/103 --- Gemfile | 6 ++- Gemfile.devel | 2 + lib/isodoc/itu/i18n-de.yaml | 1 + lib/isodoc/itu/i18n-en.yaml | 1 + lib/isodoc/itu/i18n-es.yaml | 1 + lib/isodoc/itu/i18n-fr.yaml | 1 + lib/isodoc/itu/i18n-ru.yaml | 1 + lib/metanorma/itu/front.rb | 10 ++++- spec/metanorma/base_spec.rb | 19 ++++++++- spec/metanorma/i18n_spec.rb | 77 +++++++++++++++++++++++++------------ spec/spec_helper.rb | 3 ++ 11 files changed, 95 insertions(+), 27 deletions(-) create mode 100644 Gemfile.devel diff --git a/Gemfile b/Gemfile index 11d79ae7..6afa08ee 100644 --- a/Gemfile +++ b/Gemfile @@ -4,8 +4,12 @@ Encoding.default_internal = Encoding::UTF_8 source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}" } -gemspec +group :development, :test do + gem "rspec" +end if File.exist? "Gemfile.devel" eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval end + +gemspec diff --git a/Gemfile.devel b/Gemfile.devel new file mode 100644 index 00000000..0b68a228 --- /dev/null +++ b/Gemfile.devel @@ -0,0 +1,2 @@ +gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "features/logos" + diff --git a/lib/isodoc/itu/i18n-de.yaml b/lib/isodoc/itu/i18n-de.yaml index ec5ccd46..2c72b166 100644 --- a/lib/isodoc/itu/i18n-de.yaml +++ b/lib/isodoc/itu/i18n-de.yaml @@ -52,6 +52,7 @@ annex_to_itu_ob: Anhang zum ITU Operational Bulletin number_abbrev: Nr. annex_to_itu_ob_abbrev: Anhang zum ITU OB % international_telecommunication_union: Internationale Fernmeldeunion +ITU: ITU position_on: (Position auf %) revision_abbreviation: Rev. tsb: TSB diff --git a/lib/isodoc/itu/i18n-en.yaml b/lib/isodoc/itu/i18n-en.yaml index 84de0635..91625aa3 100644 --- a/lib/isodoc/itu/i18n-en.yaml +++ b/lib/isodoc/itu/i18n-en.yaml @@ -53,6 +53,7 @@ annex_to_itu_ob: Annex to ITU Operational Bulletin number_abbrev: No. annex_to_itu_ob_abbrev: Annex to ITU OB % international_telecommunication_union: International Telecommunication Union +ITU: ITU position_on: (Position on %) revision_abbreviation: Rev. tsb: TSB diff --git a/lib/isodoc/itu/i18n-es.yaml b/lib/isodoc/itu/i18n-es.yaml index ad7fb758..c39b86ae 100755 --- a/lib/isodoc/itu/i18n-es.yaml +++ b/lib/isodoc/itu/i18n-es.yaml @@ -53,6 +53,7 @@ annex_to_itu_ob: Anexo al Boletín de Explotación de la UIT number_abbrev: N.° annex_to_itu_ob_abbrev: Anexo al BE de la UIT % international_telecommunication_union: Unión Internacional de Telecomunicaciones +ITU: UIT position_on: (Posición en %) revision_abbreviation: Rev. tsb: TSB diff --git a/lib/isodoc/itu/i18n-fr.yaml b/lib/isodoc/itu/i18n-fr.yaml index cf324053..8cc1aceb 100644 --- a/lib/isodoc/itu/i18n-fr.yaml +++ b/lib/isodoc/itu/i18n-fr.yaml @@ -53,6 +53,7 @@ annex_to_itu_ob: Annexe au Bulletin d’exploitation de l’UIT number_abbrev: Nº annex_to_itu_ob_abbrev: Annexe au BE de l’UIT % international_telecommunication_union: Union internationale des télécommunications +ITU: UIT position_on: (Position sur %) revision_abbreviation: Rev. tsb: TSB diff --git a/lib/isodoc/itu/i18n-ru.yaml b/lib/isodoc/itu/i18n-ru.yaml index ca6a7899..4ff793d2 100755 --- a/lib/isodoc/itu/i18n-ru.yaml +++ b/lib/isodoc/itu/i18n-ru.yaml @@ -53,6 +53,7 @@ annex_to_itu_ob: Приложение к Оперативному бюллете number_abbrev: №. annex_to_itu_ob_abbrev: Приложение к ОБ МСЭ % international_telecommunication_union: Международный Союз Электросвязи +ITU: МСЭ position_on: (Позиция по %) revision_abbreviation: Ред. tsb: БСЭ diff --git a/lib/metanorma/itu/front.rb b/lib/metanorma/itu/front.rb index 99bf2d36..6f93ec7e 100644 --- a/lib/metanorma/itu/front.rb +++ b/lib/metanorma/itu/front.rb @@ -75,7 +75,15 @@ def other_title_otherlangs(node, xml, type) end def default_publisher - "International Telecommunication Union" + @i18n.get["ITU"] || @i18n.international_telecommunication_union + end + + def org_abbrev + if @i18n.get["ITU"] + { @i18n.international_telecommunication_union => @i18n.get["ITU"] } + else + {} + end end def metadata_committee(node, xml) diff --git a/spec/metanorma/base_spec.rb b/spec/metanorma/base_spec.rb index 274ba806..36d451bd 100644 --- a/spec/metanorma/base_spec.rb +++ b/spec/metanorma/base_spec.rb @@ -110,12 +110,14 @@ International Telecommunication Union + ITU International Telecommunication Union + ITU @@ -132,6 +134,7 @@ International Telecommunication Union + ITU @@ -263,6 +266,7 @@ International Telecommunication Union + ITU @@ -286,6 +290,7 @@ International Telecommunication Union + ITU 2 @@ -302,6 +307,7 @@ International Telecommunication Union + ITU @@ -709,7 +715,7 @@ - International Telecommunication Union + International Telecommunication UnionITU @@ -754,6 +760,7 @@ International Telecommunication Union + ITU 2 @@ -771,6 +778,7 @@ International Telecommunication Union + ITU @@ -875,12 +883,14 @@ International Telecommunication Union + ITU International Telecommunication Union + ITU 2 @@ -898,6 +908,7 @@ International Telecommunication Union + ITU @@ -1014,6 +1025,7 @@ International Telecommunication Union + ITU @@ -1058,6 +1070,7 @@ International Telecommunication Union + ITU 2 @@ -1075,6 +1088,7 @@ International Telecommunication Union + ITU @@ -1154,12 +1168,14 @@ International Telecommunication Union + ITU International Telecommunication Union + ITU en @@ -1172,6 +1188,7 @@ International Telecommunication Union + ITU diff --git a/spec/metanorma/i18n_spec.rb b/spec/metanorma/i18n_spec.rb index c070888e..b6c8db88 100644 --- a/spec/metanorma/i18n_spec.rb +++ b/spec/metanorma/i18n_spec.rb @@ -71,7 +71,8 @@ - International Telecommunication Union + Union internationale des télécommunications + UIT @@ -115,7 +116,8 @@ - International Telecommunication Union + Union internationale des télécommunications + UIT 2 @@ -132,7 +134,8 @@ 2001 - International Telecommunication Union + Union internationale des télécommunications + UIT @@ -311,7 +314,10 @@ output = <<~OUTPUT #{@blank_hdr.sub('', '

Text

') .sub('en</language>', '<language>fr</language>')} + .sub('<language>en</language>', '<language>fr</language>') + .gsub('<name>International Telecommunication Union</name>', '<name>Union internationale des télécommunications</name>') + .gsub('<abbreviation>ITU</abbreviation>', '<abbreviation>UIT</abbreviation>') + } <preface> <abstract id='_'> <title>Résumé @@ -517,7 +523,7 @@ - International Telecommunication Union + 国际电信联盟 @@ -561,7 +567,7 @@ - International Telecommunication Union + 国际电信联盟 2 @@ -578,7 +584,7 @@ 2001 - International Telecommunication Union + 国际电信联盟 @@ -732,7 +738,10 @@ #{@blank_hdr.sub('', '

Text

') .sub('en', 'zh') .sub('Latn</script>', '<script>Hans</script>')} + .sub('<script>Latn</script>', '<script>Hans</script>') + .gsub('<name>International Telecommunication Union</name>', '<name>国际电信联盟</name>') + .gsub('<abbreviation>ITU</abbreviation>', '') + } <preface> <abstract id='_'> <title>摘要 @@ -944,7 +953,7 @@ - International Telecommunication Union + الاتحاد الدولي للاتصالات @@ -988,7 +997,7 @@ - International Telecommunication Union + الاتحاد الدولي للاتصالات 2 @@ -1005,7 +1014,7 @@ 2001 - International Telecommunication Union + الاتحاد الدولي للاتصالات @@ -1160,7 +1169,10 @@ #{@blank_hdr.sub('', '

Text

') .sub('en', 'ar') .sub('Latn</script>', '<script>Arab</script>')} + .sub('<script>Latn</script>', '<script>Arab</script>') + .gsub('<name>International Telecommunication Union</name>', '<name>الاتحاد الدولي للاتصالات</name>') + .gsub('<abbreviation>ITU</abbreviation>', '') + } <preface> <abstract id='_'> <title>ملخص @@ -1378,7 +1390,8 @@ - International Telecommunication Union + Unión Internacional de Telecomunicaciones + UIT @@ -1422,7 +1435,8 @@ - International Telecommunication Union + Unión Internacional de Telecomunicaciones + UIT 2 @@ -1439,7 +1453,8 @@ 2001 - International Telecommunication Union + Unión Internacional de Telecomunicaciones + UIT @@ -1592,7 +1607,10 @@ output = <<~OUTPUT #{@blank_hdr.sub('', '

Text

') .sub('en</language>', '<language>es</language>')} + .sub('<language>en</language>', '<language>es</language>') + .gsub('<name>International Telecommunication Union</name>', '<name>Unión Internacional de Telecomunicaciones</name>') + .gsub('<abbreviation>ITU</abbreviation>', '<abbreviation>UIT</abbreviation>') + } <preface> <abstract id='_'> <title>Resumen @@ -1792,7 +1810,8 @@ - International Telecommunication Union + Internationale Fernmeldeunion + ITU @@ -1836,7 +1855,8 @@ - International Telecommunication Union + Internationale Fernmeldeunion + ITU 2 @@ -1853,7 +1873,8 @@ 2001 - International Telecommunication Union + Internationale Fernmeldeunion + ITU @@ -2007,7 +2028,9 @@ output = <<~OUTPUT #{@blank_hdr.sub('', '

Text

') .sub('en</language>', '<language>de</language>')} + .sub('<language>en</language>', '<language>de</language>') + .gsub('<name>International Telecommunication Union</name>', '<name>Internationale Fernmeldeunion</name>') + } <preface> <abstract id='_'> <title>Abstrakt @@ -2213,7 +2236,8 @@ - International Telecommunication Union + Международный Союз Электросвязи + МСЭ @@ -2257,7 +2281,8 @@ - International Telecommunication Union + Международный Союз Электросвязи + МСЭ 2 @@ -2274,7 +2299,8 @@ 2001 - International Telecommunication Union + Международный Союз Электросвязи + МСЭ @@ -2428,7 +2454,10 @@ #{@blank_hdr.sub('', '

Text

') .sub('en', 'ru') .sub('', '') - .sub('International Telecommunication Union</name>', '<name>Международный Союз Электросвязи</name>') + .gsub('<abbreviation>ITU</abbreviation>', '<abbreviation>МСЭ</abbreviation>') + } <preface> <abstract id='_'> <title>Реферат diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 648cfef7..d6b7452b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -223,12 +223,14 @@ def itudoc(lang) International Telecommunication Union + ITU
International Telecommunication Union + ITU @@ -243,6 +245,7 @@ def itudoc(lang) International Telecommunication Union + ITU