metanorma-bipm 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +38 -0
  3. data/.github/workflows/ubuntu.yml +56 -0
  4. data/.github/workflows/windows.yml +40 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +11 -0
  7. data/LICENSE +25 -0
  8. data/README.adoc +154 -0
  9. data/Rakefile +8 -0
  10. data/bin/console +14 -0
  11. data/bin/rspec +18 -0
  12. data/bin/setup +8 -0
  13. data/lib/asciidoctor/bipm.rb +8 -0
  14. data/lib/asciidoctor/bipm/basicdoc.rng +1082 -0
  15. data/lib/asciidoctor/bipm/biblio.rng +1237 -0
  16. data/lib/asciidoctor/bipm/bipm.rng +152 -0
  17. data/lib/asciidoctor/bipm/boilerplate-en.xml +21 -0
  18. data/lib/asciidoctor/bipm/boilerplate-fr.xml +21 -0
  19. data/lib/asciidoctor/bipm/converter.rb +85 -0
  20. data/lib/asciidoctor/bipm/isodoc.rng +1620 -0
  21. data/lib/asciidoctor/bipm/reqt.rng +194 -0
  22. data/lib/isodoc/bipm.rb +9 -0
  23. data/lib/isodoc/bipm/base_convert.rb +11 -0
  24. data/lib/isodoc/bipm/bipm.brochure.xsl +5447 -0
  25. data/lib/isodoc/bipm/html/html_bipm_intro.html +8 -0
  26. data/lib/isodoc/bipm/html/html_bipm_titlepage.html +71 -0
  27. data/lib/isodoc/bipm/html/htmlstyle.css +986 -0
  28. data/lib/isodoc/bipm/html/htmlstyle.scss +743 -0
  29. data/lib/isodoc/bipm/html/logo.png +0 -0
  30. data/lib/isodoc/bipm/html/scripts.html +71 -0
  31. data/lib/isodoc/bipm/html_convert.rb +15 -0
  32. data/lib/isodoc/bipm/i18n-en.yaml +1 -0
  33. data/lib/isodoc/bipm/i18n-fr.yaml +18 -0
  34. data/lib/isodoc/bipm/i18n.rb +9 -0
  35. data/lib/isodoc/bipm/init.rb +24 -0
  36. data/lib/isodoc/bipm/metadata.rb +41 -0
  37. data/lib/isodoc/bipm/pdf_convert.rb +19 -0
  38. data/lib/isodoc/bipm/presentation_xml_convert.rb +27 -0
  39. data/lib/isodoc/bipm/xref.rb +16 -0
  40. data/lib/metanorma-bipm.rb +11 -0
  41. data/lib/metanorma/bipm.rb +32 -0
  42. data/lib/metanorma/bipm/processor.rb +35 -0
  43. data/lib/metanorma/bipm/version.rb +5 -0
  44. data/metanorma-bipm.gemspec +42 -0
  45. data/metanorma.yml +74 -0
  46. metadata +258 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0b794a40444463cb9b1d3723f7964c8bb2936165a845f48557be8ef7adcada9c
4
+ data.tar.gz: 7e392b5f79b223deacf1092b0d06dc4bb12c0af0987e37ef664b4100b1899528
5
+ SHA512:
6
+ metadata.gz: 26571b020caa32428945853cafbea125396f0defd9fa2d2c2c209951f09dc4b2f48645941e7b5beab8a1a76d8f01d25a40e4caa4622c0a78cf481eaba08644b5
7
+ data.tar.gz: 79b3e4734a35aa5057421237e0a4d7b60c2c5890cd67a37fd8027522be26b780c92e672ce61885fbd780341094b40149a9f34858e58f5af75f98103d93fb1fd4
@@ -0,0 +1,38 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: macos
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/ubuntu.yml
11
+ - .github/workflows/windows.yml
12
+
13
+ jobs:
14
+ test-macos:
15
+ name: Test on Ruby ${{ matrix.ruby }} macOS
16
+ runs-on: macos-latest
17
+ continue-on-error: ${{ matrix.experimental }}
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
26
+ steps:
27
+ - uses: actions/checkout@master
28
+ - name: Use Ruby
29
+ uses: actions/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ - name: Update gems
33
+ run: |
34
+ sudo gem install bundler --force
35
+ bundle install --jobs 4 --retry 3
36
+ - name: Run specs
37
+ run: |
38
+ bundle exec rake
@@ -0,0 +1,56 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: ubuntu
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ tags:
9
+ - '*'
10
+ pull_request:
11
+ paths-ignore:
12
+ - .github/workflows/macos.yml
13
+ - .github/workflows/windows.yml
14
+
15
+ jobs:
16
+ test-linux:
17
+ name: Test on Ruby ${{ matrix.ruby }} Ubuntu
18
+ runs-on: ubuntu-latest
19
+ continue-on-error: ${{ matrix.experimental }}
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ ruby: [ '2.6', '2.5', '2.4' ]
24
+ experimental: [false]
25
+ include:
26
+ - ruby: '2.7'
27
+ experimental: true
28
+ steps:
29
+ - uses: actions/checkout@master
30
+ - name: Use Ruby
31
+ uses: actions/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ - name: Update gems
35
+ run: |
36
+ gem install bundler
37
+ bundle install --jobs 4 --retry 3
38
+ - name: Run specs
39
+ run: |
40
+ bundle exec rake
41
+ - name: Trigger repositories
42
+ if: matrix.ruby == '2.6'
43
+ env:
44
+ GH_USERNAME: metanorma-ci
45
+ GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
46
+ run: |
47
+ curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
48
+ [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
49
+ CLIENT_PAYLOAD=$(cat <<EOF
50
+ "{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
51
+ EOF
52
+ )
53
+ for repo in $REPOS
54
+ do
55
+ sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
56
+ done
@@ -0,0 +1,40 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: windows
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/ubuntu.yml
12
+
13
+ jobs:
14
+ test-windows:
15
+ name: Test on Ruby ${{ matrix.ruby }} Windows
16
+ runs-on: windows-latest
17
+ continue-on-error: ${{ matrix.experimental }}
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
26
+ steps:
27
+ - uses: actions/checkout@master
28
+ - name: Use Ruby
29
+ uses: actions/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ - name: Update gems
33
+ shell: pwsh
34
+ run: |
35
+ gem install bundler
36
+ bundle config --local path vendor/bundle
37
+ bundle install --jobs 4 --retry 3
38
+ - name: Run specs
39
+ run: |
40
+ bundle exec rake
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ronald.tse@ribose.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ Encoding.default_external = Encoding::UTF_8
2
+ Encoding.default_internal = Encoding::UTF_8
3
+
4
+ source "https://rubygems.org"
5
+ git_source(:github) { |repo| "https://github.com/#{repo}" }
6
+
7
+ gemspec
8
+
9
+ if File.exist? 'Gemfile.devel'
10
+ eval File.read('Gemfile.devel'), nil, 'Gemfile.devel' # rubocop:disable Security/Eval
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,154 @@
1
+ = Metanorma for BIPM: Metanorma processor for Bureau International de Poids et Mesures
2
+
3
+ image:https://img.shields.io/gem/v/metanorma-bimp.sbimp["Gem Version", link="https://rubygems.org/gems/metanorma-bimp"]
4
+ image:https://github.com/metanorma/metanorma-bimp/workflows/macos/badge.sbimp["Build Status (macOS)", link="https://github.com/metanorma/metanorma-bimp/actions?workflow=macos"]
5
+ image:https://github.com/metanorma/metanorma-bimp/workflows/ubuntu/badge.sbimp["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-bimp/actions?workflow=ubuntu"]
6
+ image:https://github.com/metanorma/metanorma-bimp/workflows/windows/badge.sbimp["Build Status (Windows)", link="https://github.com/metanorma/metanorma-bimp/actions?workflow=windows"]
7
+ image:https://codeclimate.com/github/metanorma/metanorma-bimp/badges/gpa.sbimp["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-bimp"]
8
+ image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-bimp.sbimp["Pull Requests", link="https://github.com/metanorma/metanorma-bimp/pulls"]
9
+ image:https://img.shields.io/github/commits-since/metanorma/metanorma-bimp/latest.sbimp["Commits since latest",link="https://github.com/metanorma/metanorma-bimp/releases"]
10
+
11
+ == Functionality
12
+
13
+ This gem processes http://asciidoctor.org/[Asciidoctor] documents following
14
+ a template for generating BIPM standards.
15
+
16
+ == Usage
17
+
18
+ The preferred way to invoke this gem is via the `metanorma` script:
19
+
20
+ [source,console]
21
+ ----
22
+ $ metanorma --type bipm a.adoc # output HTML and PDF
23
+ $ metanorma --type bipm --extensions html a.adoc # output just HTML
24
+ $ metanorma --type bipm --extensions pdf a.pdf # output just PDF
25
+ $ metanorma --type bipm --extensions xml a.adoc # output Metanorma XML
26
+ ----
27
+
28
+ The gem translates the document into Metanorma XML format, and then
29
+ validates its output against the BIPM Metanorma XML document model; errors are
30
+ reported to console against the XML, and are intended for users to
31
+ check that they have provided all necessary components of the
32
+ document.
33
+
34
+ The gem then converts the XML into output formats such as HTML and PDF.
35
+
36
+ === Installation
37
+
38
+ If you are using a Mac, the https://github.com/riboseinc/metanorma-macos-setup
39
+ repository has instructions on setting up your machine to run Metanorma
40
+ scripts such as this one. You need only run the following in a Terminal console:
41
+
42
+ [source,console]
43
+ ----
44
+ $ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
45
+ $ gem install metanorma-vg
46
+ ----
47
+
48
+
49
+ == Document Attributes
50
+
51
+ The gem relies on Asciidoctor document attributes to provide necessary
52
+ metadata about the document. These include:
53
+
54
+ `:edition:`:: The document edition
55
+
56
+ `:revdate:`:: The date the document was last updated
57
+
58
+ `:title-en:`:: The title of the document in English (mandatory)
59
+ `:title-fr:`:: The title of the document in French (mandatory)
60
+ `:title-cover-en:`:: The title of the front cover of the document in English (where different from the title proper)
61
+ `:title-cover-fr:`:: The title of the front cover of the document in French (where different from the title proper)
62
+ `:title-appendix-en:`:: The title of the appendix in English, if this document is an appendix published separately; `title-en` becomes the title of the main document, as presented within the standalone appendix.
63
+ `:title-appendix-fr:`:: The title of the appendix in English, if this document is an appendix published separately; `title-en` becomes the title of the main document, as presented within the standalone appendix.
64
+
65
+ `:appendix-id:`:: The number of the appendix, if this document is an appendix published separately
66
+
67
+ `:si-aspect:`:: The domain of SI covered by the document; used to select logo in PDF cover page. The logo nominates one primary SI base units, and defining consonants for that unit and possibly others as well. The permitted values are:
68
+ +
69
+ --
70
+ * A_e_deltanu (ampere; time)
71
+ * A_e (ampere)
72
+ * cd_Kcd_h_deltanu (candela; mass, time)
73
+ * cd_Kcd (candela)
74
+ * full (all units)
75
+ * K_k_deltanu (kelvin; mass, time)
76
+ * K_k (kelvin)
77
+ * kg_h_c_deltanu (kilogram; length, time)
78
+ * kg_h (kilogram)
79
+ * m_c_deltanu (metre; time)
80
+ * m_c (metre)
81
+ * mol_NA (mole)
82
+ * s_deltanu (second)
83
+ --
84
+
85
+ `:copyright-year:`:: The year which will be claimed as when the copyright for
86
+ the document was issued
87
+
88
+ `:supersedes:`:: One or more BIPM document that this BIPM document standard supersedes; the superseded
89
+ document may still remain in effect. Comma delimited.
90
+
91
+ `:superseded-by:`:: One or more BIPM document that this BIPM document standard is superseded by; this
92
+ document may still remain in effect. Comma delimited.
93
+
94
+ `:doctype:`:: The document type (mandatory). The permitted types are:
95
+ +
96
+ --
97
+ * brochure (default)
98
+ * mise-en-pratique
99
+ * rapport
100
+ * monographie
101
+ * guide
102
+ * meeting-report
103
+ * technical-report
104
+ * working-party-note
105
+ * strategy
106
+ * cipm-mra
107
+ * resolution
108
+ --
109
+
110
+ `:status:``:: The document status. The permitted types are: `draft-proposal`,
111
+ `draft-development`, `in-force`, `retired`.
112
+
113
+ `:committee:`:: The name of the relevant committee (mandatory):
114
+ +
115
+ --
116
+ * CGPM: General Conference on Weights and Measures
117
+ * CIPM: International Committee for Weights and Measures
118
+ * BIPM: International Bureau of Weights and Measures
119
+ * CCAUV: Consultative Committee for Acoustics, Ultrasound and Vibration
120
+ * CCEM: Consultative Committee for Electricity and Magnetism
121
+ * CCL: Consultative Committee for Length
122
+ * CCM: Consultative Committee for Mass and Related Quantities
123
+ * CCPR: Consultative Committee for Photometry and Radiometry
124
+ * CCQM: Consultative Committee for Amount of Substance:: Metrology in Chemistry and Biology
125
+ * CCRI: Consultative Committee for Ionizing Radiation
126
+ * CCT: Consultative Committee for Thermometry
127
+ * CCTF: Consultative Committee for Time and Frequency
128
+ * CCU: Consultative Committee for Units
129
+ * CCL-CCTF: Frequency Standards Working Group
130
+ * JCGM: Joint Committee for Guides in Metrology
131
+ * JCRB: Joint Committee of the Regional Metrology Organizations and the BIPM
132
+ * JCTLM: Joint Committee for Traceability in Laboratory Medicine
133
+ * INetQI: International Network on Quality Infrastructure
134
+ --
135
+ `:workgroup:`:: The name of the relevant workgroup (mandatory)
136
+
137
+ `:language:` :: The language of the document (`en` or `fr`) (mandatory)
138
+
139
+ `:comment-period-from:`:: Start of the period during which comments are allowed on the document draft
140
+ `:comment-period-to:`:: End of the period during which comments are allowed on the document draft (optional)
141
+
142
+ `:obsoleted-date:`:: The date a document was superseded
143
+ `:implemented-date:`:: The date a document became effective
144
+
145
+ The attribute `:draft:`, if present, includes review notes in the XML output;
146
+ these are otherwise suppressed.
147
+
148
+ == Data Models
149
+
150
+ The document model for BIPM is given in https://github.com/metanorma/metanorma-model-bipm[metanorma-model-bipm].
151
+
152
+ == Examples
153
+
154
+ Sample documents are given in https://github.com/metanorma/mn-samples-bipm[mn-samples-bipm]
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require 'isodoc/gem_tasks'
4
+
5
+ IsoDoc::GemTasks.install
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "asciidoctor/vsd"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
11
+ "../../Gemfile", Pathname.new(__FILE__).realpath
12
+ )
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rspec-core", "rspec")
18
+