metanorma-plateau 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f8e1f42a81f5dd4e4bd6d068002e4499e15c467d1961331ff42555588b1c776
4
+ data.tar.gz: e760543b322da439d2115e7600482c4b942896d428be685cbed845444a7c61c0
5
+ SHA512:
6
+ metadata.gz: 574d4e9c2e8c9160a7ef8244d04faff7f8c2ea9d6280fc4ca3fdadc326ad859954361c7f21fdaf87e365fef58c4496d089b39650a78c1cb488a4288d672dace7
7
+ data.tar.gz: b15a8dca0976d5a6360b15da39d33934eeca5dedcba5b36e19c224cd4b885b65eb96358fb346a39c40e46f3d0a0370fe03365da1e629b49675f6c55292312a08
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ inherit_from:
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
5
+
6
+ # local repo-specific modifications
7
+ # ...
8
+
9
+ AllCops:
10
+ TargetRubyVersion: 3.4
@@ -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
+ gem "gem-release"
10
+
11
+ eval_gemfile("Gemfile.devel") rescue nil
data/LICENSE ADDED
@@ -0,0 +1,2 @@
1
+ Copyright (c) 2024, Ribose
2
+ All rights reserved.
data/README.adoc ADDED
@@ -0,0 +1,82 @@
1
+ = metanorma-plateau: Metanorma processor for Plateau project, Japanese Ministry of Land, Infrastructure, Transport and Tourism
2
+
3
+ image:https://img.shields.io/gem/v/metanorma-plateau.svg["Gem Version", link="https://rubygems.org/gems/metanorma-plateau"]
4
+ image:https://github.com/metanorma/metanorma-plateau/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-plateau/actions?workflow=rake"]
5
+ image:https://codeclimate.com/github/metanorma/metanorma-plateau/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-plateau"]
6
+ image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-plateau.svg["Pull Requests", link="https://github.com/metanorma/metanorma-plateau/pulls"]
7
+ image:https://img.shields.io/github/commits-since/metanorma/metanorma-plateau/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-plateau/releases"]
8
+
9
+ == Functionality
10
+
11
+ This gem processes https://www.metanorma.com[Metanorma documents] following
12
+ the Metanorma model for generating MLIT Project PLATEAU documents.
13
+
14
+ Project PLATEAU documents are found at:
15
+
16
+ * https://www.mlit.go.jp/plateau/libraries
17
+
18
+ The gem is built on top of
19
+ https://github.com/metanorma/metanorma-jis[metanorma-jis] with customized
20
+ rendering to meet requirements of MLIT's Project PLATEAU.
21
+
22
+ It provides the following functions:
23
+
24
+ . Compiles Metanorma input into the Metanorma-PLATEAU XML format
25
+ . Validates XML output against the Metanorma-Plateau document model
26
+ ** Errors are reported to console against the XML, and are intended for users to
27
+ check that they have provided all necessary components of the
28
+ document.
29
+ . Metanorma-Plateau XML is then converted into desired output formats.
30
+
31
+ The following outputs are supported:
32
+
33
+ * Primary: the canonical Metanorma-PLATEAU XML representation (`.xml`).
34
+ * Secondary: the Metanorma-PLATEAU XML representation is processed to generate the following outputs
35
+ as end deliverable PLATEAU documents.
36
+ ** HTML (`.html`)
37
+ ** PDF (`.pdf`)
38
+
39
+ == Structure
40
+
41
+ This gem inherits from the
42
+ https://github.com/metanorma/metanorma-jis[metanorma-jis] gem, and aligns
43
+ closely to it.
44
+
45
+
46
+ === Quickstart
47
+
48
+ Please see https://www.metanorma.org for instructions to get started.
49
+
50
+ You will need to setup your Git credentials for bundler or for HTTPS in order
51
+ to fetch the software. Please refer to the following articles for details:
52
+
53
+ * https://depfu.com/blog/2017/08/02/bundler-and-private-dependencies[Setting up bundler for private dependencies]
54
+ * https://bundler.io/v1.16/bundle_config.html#CREDENTIALS-FOR-GEM-SOURCES[Bundler credentials for gem sources]
55
+ * https://help.github.com/articles/caching-your-github-password-in-git[GitHub - Caching your GitHub credentials in Git]
56
+
57
+
58
+ == Usage
59
+
60
+ Using the `metanorma` CLI:
61
+
62
+ [source,console]
63
+ ----
64
+ $ metanorma --type plateau a.adoc # output HTML
65
+ $ metanorma --type plateau --extensions html a.adoc # output just HTML
66
+ $ metanorma --type plateau --extensions xml a.adoc # output Metanorma XML
67
+ ----
68
+
69
+
70
+ == Authoring
71
+
72
+ Please refer to Metanorma for ISO documentation for general information.
73
+
74
+ == Documentation
75
+
76
+ See https://www.metanorma.com/author/iso/[Write ISO documents with Metanorma]
77
+
78
+ == Examples
79
+
80
+ * Example documents: https://github.com/metanorma/mn-samples-plateau[mn-samples-plateau].
81
+ * Document templates: https://github.com/metanorma/mn-templates-plateau[mn-templates-plateau].
82
+
@@ -0,0 +1,23 @@
1
+ require "isodoc"
2
+ require "metanorma-jis"
3
+ require_relative "init"
4
+
5
+ module IsoDoc
6
+ module Plateau
7
+ module BaseConvert
8
+
9
+ def para_parse(node, out)
10
+ out.p **attr_code(para_attrs(node)) do |p|
11
+ unless @termdomain.empty?
12
+ p << "&lt;#{@termdomain}&gt; "
13
+ @termdomain = ""
14
+ end
15
+ @lang == "ja" and p << "&#x3000;"
16
+ node.children.each { |n| parse(n, p) }
17
+ end
18
+ end
19
+
20
+ include Init
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ require_relative "base_convert"
2
+
3
+ module IsoDoc
4
+ module Plateau
5
+ class HtmlConvert < IsoDoc::JIS::HtmlConvert
6
+ def initialize(options)
7
+ super
8
+ @libdir = File.dirname(__FILE__)
9
+ end
10
+
11
+ include BaseConvert
12
+ include Init
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ doctype_dict:
2
+ guide: Guide
3
+ annex: Annex
4
+ technical-report: Technical Report
@@ -0,0 +1,4 @@
1
+ doctype_dict:
2
+ handbook: ガイドブック
3
+ annex: 別冊
4
+ technical-report: 技術資料
@@ -0,0 +1,19 @@
1
+ require "japanese_calendar"
2
+ require "twitter_cldr"
3
+
4
+ module IsoDoc
5
+ module Plateau
6
+ class I18n < IsoDoc::JIS::I18n
7
+ def load_file(fname)
8
+ f = File.join(File.dirname(__FILE__), fname)
9
+ File.exist?(f) ? YAML.load_file(f) : {}
10
+ end
11
+
12
+ def load_yaml1(lang, script)
13
+ y = load_file("i18n-#{yaml_lang(lang, script)}.yaml")
14
+ y.empty? ? load_file("i18n-en.yaml").merge(super) : super.deep_merge(y)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,25 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+ require_relative "i18n"
4
+ require_relative "xref"
5
+
6
+ module IsoDoc
7
+ module Plateau
8
+ module Init
9
+ def metadata_init(lang, script, locale, labels)
10
+ @meta = Metadata.new(lang, script, locale, labels)
11
+ end
12
+
13
+ def xref_init(lang, script, _klass, labels, options)
14
+ @xrefs = Xref.new(lang, script,
15
+ HtmlConvert.new(language: lang, script: script),
16
+ labels, options)
17
+ end
18
+
19
+ def i18n_init(lang, script, locale, i18nyaml = nil)
20
+ @i18n = I18n.new(lang, script, locale: locale,
21
+ i18nyaml: i18nyaml || @i18nyaml)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,12 @@
1
+ module IsoDoc
2
+ module Plateau
3
+ class Metadata < IsoDoc::JIS::Metadata
4
+ def docid(xml, _out)
5
+ id = xml.at(ns("//bibdata/docidentifier[@type = 'PLATEAU']"))&.text or
6
+ return
7
+ set(:docnumber, id)
8
+ set(:docnumber_undated, id.sub(/:\d{4}$/, ""))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module Plateau
6
+ class PdfConvert < IsoDoc::XslfoPdfConvert
7
+ def initialize(options)
8
+ @libdir = File.dirname(__FILE__)
9
+ super
10
+ end
11
+
12
+ def pdf_stylesheet(_docxml)
13
+ "plateau.international-standard.xsl"
14
+ end
15
+ end
16
+ end
17
+ end