metanorma-un 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +39 -0
  3. data/.github/workflows/ubuntu.yml +39 -0
  4. data/.github/workflows/windows.yml +42 -0
  5. data/.gitignore +1 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.yml +10 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +11 -0
  10. data/LICENSE +25 -0
  11. data/README.adoc +141 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +14 -0
  14. data/bin/rspec +17 -0
  15. data/bin/setup +8 -0
  16. data/lib/asciidoctor/un.rb +7 -0
  17. data/lib/asciidoctor/un/basicdoc.rng +1059 -0
  18. data/lib/asciidoctor/un/biblio.rng +1142 -0
  19. data/lib/asciidoctor/un/boilerplate.xml +57 -0
  20. data/lib/asciidoctor/un/converter.rb +209 -0
  21. data/lib/asciidoctor/un/isodoc.rng +1028 -0
  22. data/lib/asciidoctor/un/reqt.rng +171 -0
  23. data/lib/asciidoctor/un/un.rng +242 -0
  24. data/lib/asciidoctor/un/validate.rb +22 -0
  25. data/lib/isodoc/un.rb +10 -0
  26. data/lib/isodoc/un/base_convert.rb +227 -0
  27. data/lib/isodoc/un/html/header.html +225 -0
  28. data/lib/isodoc/un/html/html_unece_intro.html +15 -0
  29. data/lib/isodoc/un/html/html_unece_plenary_titlepage.html +100 -0
  30. data/lib/isodoc/un/html/html_unece_titlepage.html +81 -0
  31. data/lib/isodoc/un/html/htmlstyle.scss +1174 -0
  32. data/lib/isodoc/un/html/logo.jpg +0 -0
  33. data/lib/isodoc/un/html/scripts.html +84 -0
  34. data/lib/isodoc/un/html/scripts.pdf.html +72 -0
  35. data/lib/isodoc/un/html/unece.scss +801 -0
  36. data/lib/isodoc/un/html/word_unece_intro.html +15 -0
  37. data/lib/isodoc/un/html/word_unece_plenary_titlepage.html +160 -0
  38. data/lib/isodoc/un/html/word_unece_titlepage.html +30 -0
  39. data/lib/isodoc/un/html/wordstyle.scss +1141 -0
  40. data/lib/isodoc/un/html_convert.rb +121 -0
  41. data/lib/isodoc/un/metadata.rb +115 -0
  42. data/lib/isodoc/un/pdf_convert.rb +133 -0
  43. data/lib/isodoc/un/word_convert.rb +180 -0
  44. data/lib/metanorma-un.rb +8 -0
  45. data/lib/metanorma/un.rb +12 -0
  46. data/lib/metanorma/un/UN_emblem_blue.svg +193 -0
  47. data/lib/metanorma/un/input.rb +18 -0
  48. data/lib/metanorma/un/processor.rb +43 -0
  49. data/lib/metanorma/un/version.rb +5 -0
  50. data/metanorma-unece.gemspec +48 -0
  51. metadata +334 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ca6423742e73f915cfe6fed182931dde2237f2d7b5d23bf2ce356113ec4c4ebb
4
+ data.tar.gz: 256e00b7357d4f839f48690132f20ba0265c1c13ccd2e4f49a7d5135c01109f8
5
+ SHA512:
6
+ metadata.gz: 17758698e986a248570200ff0802717ecc0ab688136c2b76e9cf610fd65d375d04ad4ec436a3ce998080507a106dcdefaed7b4c0119b6525595edae0865ec549
7
+ data.tar.gz: 2f00c75f5cbfbea77427026ef8b9583eb3709708ea83522dd5ef272b728763f8aad5e5b0f7483d9a55fedf53caf1fb41e0670431b2cc4055facf60b4d2608a13
@@ -0,0 +1,39 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: macos
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
10
+
11
+ jobs:
12
+ test-macos:
13
+ name: Test on Ruby ${{ matrix.ruby }} macOS
14
+ runs-on: macos-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ steps:
20
+ - uses: actions/checkout@master
21
+ - name: Use Ruby
22
+ uses: actions/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ architecture: 'x64'
26
+ - name: Update gems
27
+ run: |
28
+ sudo gem install bundler --force
29
+ bundle install --jobs 4 --retry 3
30
+ - name: Use Node
31
+ uses: actions/setup-node@v1
32
+ with:
33
+ node-version: '8'
34
+ - name: Install Puppeteer
35
+ run: |
36
+ npm install -g puppeteer
37
+ - name: Run specs
38
+ run: |
39
+ bundle exec rake
@@ -0,0 +1,39 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: ubuntu
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
10
+
11
+ jobs:
12
+ test-linux:
13
+ name: Test on Ruby ${{ matrix.ruby }} Ubuntu
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ steps:
20
+ - uses: actions/checkout@master
21
+ - name: Use Ruby
22
+ uses: actions/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ architecture: 'x64'
26
+ - name: Update gems
27
+ run: |
28
+ gem install bundler
29
+ bundle install --jobs 4 --retry 3
30
+ - name: Use Node
31
+ uses: actions/setup-node@v1
32
+ with:
33
+ node-version: '8'
34
+ - name: Install Puppeteer
35
+ run: |
36
+ npm install -g puppeteer
37
+ - name: Run specs
38
+ run: |
39
+ bundle exec rake
@@ -0,0 +1,42 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: windows
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
10
+
11
+ jobs:
12
+ test-windows:
13
+ name: Test on Ruby ${{ matrix.ruby }} Windows
14
+ runs-on: windows-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ steps:
20
+ - uses: actions/checkout@master
21
+ - name: Use Ruby
22
+ uses: actions/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ architecture: 'x64'
26
+ - name: Update gems
27
+ shell: pwsh
28
+ run: |
29
+ gem install bundler
30
+ bundle config --local path vendor/bundle
31
+ bundle update
32
+ bundle install --jobs 4 --retry 3
33
+ - name: Use Node
34
+ uses: actions/setup-node@v1
35
+ with:
36
+ node-version: '8'
37
+ - name: Install Puppeteer
38
+ run: |
39
+ npm install -g puppeteer
40
+ - name: Run specs
41
+ run: |
42
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .DS_Store
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
+ AllCops:
8
+ TargetRubyVersion: 2.3
9
+ Rails:
10
+ Enabled: true
@@ -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.
data/README.adoc ADDED
@@ -0,0 +1,141 @@
1
+ = Metanorma processor for UN documents
2
+
3
+ (Formerly known as metanorma-unece)
4
+
5
+ https://github.com/metanorma/metanorma-un[metanorma-un] image:https://img.shields.io/gem/v/metanorma-un.svg["Gem Version", link="https://rubygems.org/gems/metanorma-un"]::
6
+ image:https://github.com/metanorma/metanorma-un/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-un/actions?workflow=macos"]
7
+ image:https://github.com/metanorma/metanorma-un/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-un/actions?workflow=windows"]
8
+ image:https://github.com/metanorma/metanorma-un/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/metanorma/metanorma-un/actions?workflow=ubuntu"]
9
+ image:https://codeclimate.com/github/metanorma/metanorma-un/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-un"]
10
+ image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-un.svg["Pull Requests", link="https://github.com/metanorma/metanorma-un/pulls"]
11
+ image:https://img.shields.io/github/commits-since/metanorma/metanorma-un/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-un/releases"]
12
+
13
+ == Functionality
14
+
15
+ This gem processes http://asciidoctor.org/[Asciidoctor] documents following
16
+ a template for generating UN International Standards.
17
+
18
+ The gem currently inherits from the https://github.com/metanorma/metanorma-standoc[Metanorma-Standoc]
19
+ gem, and aligns closely to it. Refer to the ISO gem documentation
20
+ for guidance, including https://github.com/metanorma/metanorma-iso/wiki/Guidance-for-authoring[the Authoring Guide].
21
+
22
+ The following outputs are generated.
23
+
24
+ * an XML representation of the document, intended as a document model for UN
25
+ International Standards.
26
+ * The XML representation is processed in turn to generate the following outputs
27
+ as end deliverable UN standard drafts.
28
+ ** HTML
29
+ ** Word
30
+
31
+ NOTE: http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
32
+ The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
33
+ which is syntactically stricter than the common MathJax processor;
34
+ if you do not get expected results, try bracketing terms your in AsciiMathML
35
+ expressions.
36
+
37
+ == Usage
38
+
39
+ The preferred way to invoke this gem is via the `metanorma` script:
40
+
41
+ [source,console]
42
+ ----
43
+ $ metanorma --type un a.adoc # output HTML and PDF
44
+ $ metanorma --type un --extensions html a.adoc # output just HTML
45
+ $ metanorma --type un --extensions pdf a.adoc # output just PDF
46
+ $ metanorma --type un --extensions xml a.adoc # output UN Metanorma XML
47
+ ----
48
+
49
+ The gem translates the document into UN Metanorma XML format, and then
50
+ validates its output against the UN Metanorma XML document model; errors are
51
+ reported to console against the XML, and are intended for users to
52
+ check that they have provided all necessary components of the
53
+ document.
54
+
55
+ The gem then converts the XML into HTML and PDF.
56
+
57
+ ////
58
+ The gem can also be invoked directly within asciidoctor, though this is deprecated:
59
+
60
+ [source,console]
61
+ ----
62
+ $ asciidoctor -b un -r 'metanorma-un' a.adoc
63
+ ----
64
+ ////
65
+
66
+ == Installation
67
+
68
+ === Quick start
69
+
70
+ https://www.metanorma.com/overview/getting-started/
71
+
72
+ === macOS
73
+
74
+ If you are using macOS, the https://github.com/metanorma/metanorma-macos-setup
75
+ repository has instructions on setting up your machine to run Metanorma
76
+ scripts such as this one. You need only run the following in a Terminal console:
77
+
78
+ [source,console]
79
+ ----
80
+ $ bash <(curl -s https://raw.githubusercontent.com/metanorma/metanorma-macos-setup/master/metanorma-setup)
81
+ $ gem install metanorma-un
82
+ $ gem install metanorma-cli
83
+ ----
84
+
85
+ === Testing
86
+
87
+ Since this software is still in development it is not yet as mature as the other standards we support. We plan to fully complete support if there is interest.
88
+
89
+ The easiest way to try out is using a Mac. It takes a little bit more work on a Windows machine through the platform-independent Docker container (see the https://www.metanorma.com/overview/getting-started/#docker-setup[Metanorma Quickstart guide]) , but it is doable.
90
+
91
+ The current examples of UN documents encoded using Metanorma is provided in https://github.com/metanorma/mn-samples-un
92
+
93
+ (Please run the 2-line macOS setup script prior to the following)
94
+
95
+ First, use Git to clone the code and documents:
96
+
97
+ [source,console]
98
+ --
99
+ git clone https://github.com/metanorma/mn-samples-un/
100
+ --
101
+
102
+ Then, install all dependencies with this command:
103
+
104
+ [source,console]
105
+ --
106
+ bundle
107
+ --
108
+
109
+ Next, run the compilation toolchain:
110
+
111
+ [source,console]
112
+ --
113
+ make all
114
+ --
115
+
116
+ Then you will see the files generated, including HTML and Word Doc.
117
+
118
+ The easiest way to start a new document is to copy one of the two samples and modify them.
119
+
120
+ == Documentation
121
+
122
+ See https://www.metanorma.com/author/un/[The UN flavor of Metanorma]
123
+
124
+
125
+ == Data Models
126
+
127
+ The UN Standard Document format is an instance of the
128
+ https://github.com/metanorma/metanorma-model-standoc[StandardDocument model]. Details of
129
+ this general model can be found on its page.
130
+
131
+ Details of the UN modifications to this general model can be found in the
132
+ https://github.com/metanorma/metanorma-model-un[UN model]
133
+ repository.
134
+
135
+ == Examples
136
+
137
+ * Example documents are avalable at the https://github.com/metanorma/mn-samples-un[mn-samples-un] repository.
138
+
139
+ ////
140
+ * Document templates are available at the https://github.com/metanorma/mn-templates-un[mn-templates-un] repository.
141
+ ////
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "metanorma/unece"
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__)
data/bin/rspec ADDED
@@ -0,0 +1,17 @@
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")