metanorma-gb 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.hound.yml +3 -0
  4. data/.oss-guides.rubocop.yml +1077 -0
  5. data/.rubocop.ribose.yml +65 -0
  6. data/.rubocop.tb.yml +650 -0
  7. data/.rubocop.yml +15 -0
  8. data/.travis.yml +15 -0
  9. data/CODE_OF_CONDUCT.md +74 -0
  10. data/Gemfile +9 -0
  11. data/LICENSE +25 -0
  12. data/README.adoc +369 -0
  13. data/Rakefile +6 -0
  14. data/asciidoctor-gb.gemspec.old +47 -0
  15. data/bin/console +14 -0
  16. data/bin/rspec +18 -0
  17. data/bin/setup +8 -0
  18. data/lib/asciidoctor-gb.rb +11 -0
  19. data/lib/asciidoctor/gb.rb +7 -0
  20. data/lib/asciidoctor/gb/biblio.rng +836 -0
  21. data/lib/asciidoctor/gb/converter.rb +224 -0
  22. data/lib/asciidoctor/gb/front.rb +228 -0
  23. data/lib/asciidoctor/gb/gbstandard.rng +409 -0
  24. data/lib/asciidoctor/gb/html/blank.png +0 -0
  25. data/lib/asciidoctor/gb/html/footer.png +0 -0
  26. data/lib/asciidoctor/gb/html/gb-logos/gb-issuer-default.png +0 -0
  27. data/lib/asciidoctor/gb/html/gb-logos/gb-issuer-default.svg +980 -0
  28. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-db.gif +0 -0
  29. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-db.png +0 -0
  30. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-db.svg +1 -0
  31. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gb.gif +0 -0
  32. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gb.png +0 -0
  33. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gb.svg +1 -0
  34. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gjb.gif +0 -0
  35. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gjb.png +0 -0
  36. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gjb.svg +1 -0
  37. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gm.gif +0 -0
  38. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gm.png +0 -0
  39. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-gm.svg +1 -0
  40. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-jjf.gif +0 -0
  41. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-jjf.png +0 -0
  42. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-jjf.svg +1 -0
  43. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-zb.gif +0 -0
  44. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-zb.png +0 -0
  45. data/lib/asciidoctor/gb/html/gb-logos/gb-standard-zb.svg +13 -0
  46. data/lib/asciidoctor/gb/html/gb.scss +556 -0
  47. data/lib/asciidoctor/gb/html/header.html +216 -0
  48. data/lib/asciidoctor/gb/html/html_gb_intro.html +9 -0
  49. data/lib/asciidoctor/gb/html/html_gb_titlepage.html +99 -0
  50. data/lib/asciidoctor/gb/html/htmlstyle.scss +269 -0
  51. data/lib/asciidoctor/gb/html/logo.png +0 -0
  52. data/lib/asciidoctor/gb/html/word_gb_intro.html +3 -0
  53. data/lib/asciidoctor/gb/html/word_gb_titlepage.html +388 -0
  54. data/lib/asciidoctor/gb/html/wordstyle.scss +2543 -0
  55. data/lib/asciidoctor/gb/isodoc.rng +1059 -0
  56. data/lib/asciidoctor/gb/isostandard.rng +1001 -0
  57. data/lib/asciidoctor/gb/section_input.rb +150 -0
  58. data/lib/asciidoctor/gb/validate.rb +115 -0
  59. data/lib/asciidoctor/gb/version.rb +5 -0
  60. data/lib/isodoc/gb/gbcleanup.rb +90 -0
  61. data/lib/isodoc/gb/gbconvert.rb +66 -0
  62. data/lib/isodoc/gb/gbhtmlconvert.rb +84 -0
  63. data/lib/isodoc/gb/gbhtmlrender.rb +208 -0
  64. data/lib/isodoc/gb/gbwordconvert.rb +136 -0
  65. data/lib/isodoc/gb/gbwordrender.rb +206 -0
  66. data/lib/isodoc/gb/html/blank.png +0 -0
  67. data/lib/isodoc/gb/html/footer.png +0 -0
  68. data/lib/isodoc/gb/html/gb-logos/gb-issuer-default.png +0 -0
  69. data/lib/isodoc/gb/html/gb-logos/gb-issuer-default.svg +980 -0
  70. data/lib/isodoc/gb/html/gb-logos/gb-standard-db.gif +0 -0
  71. data/lib/isodoc/gb/html/gb-logos/gb-standard-db.png +0 -0
  72. data/lib/isodoc/gb/html/gb-logos/gb-standard-db.svg +1 -0
  73. data/lib/isodoc/gb/html/gb-logos/gb-standard-gb.gif +0 -0
  74. data/lib/isodoc/gb/html/gb-logos/gb-standard-gb.png +0 -0
  75. data/lib/isodoc/gb/html/gb-logos/gb-standard-gb.svg +1 -0
  76. data/lib/isodoc/gb/html/gb-logos/gb-standard-gjb.gif +0 -0
  77. data/lib/isodoc/gb/html/gb-logos/gb-standard-gjb.png +0 -0
  78. data/lib/isodoc/gb/html/gb-logos/gb-standard-gjb.svg +1 -0
  79. data/lib/isodoc/gb/html/gb-logos/gb-standard-gm.gif +0 -0
  80. data/lib/isodoc/gb/html/gb-logos/gb-standard-gm.png +0 -0
  81. data/lib/isodoc/gb/html/gb-logos/gb-standard-gm.svg +1 -0
  82. data/lib/isodoc/gb/html/gb-logos/gb-standard-jjf.gif +0 -0
  83. data/lib/isodoc/gb/html/gb-logos/gb-standard-jjf.png +0 -0
  84. data/lib/isodoc/gb/html/gb-logos/gb-standard-jjf.svg +1 -0
  85. data/lib/isodoc/gb/html/gb-logos/gb-standard-zb.gif +0 -0
  86. data/lib/isodoc/gb/html/gb-logos/gb-standard-zb.png +0 -0
  87. data/lib/isodoc/gb/html/gb-logos/gb-standard-zb.svg +13 -0
  88. data/lib/isodoc/gb/html/gb.scss +556 -0
  89. data/lib/isodoc/gb/html/header.html +216 -0
  90. data/lib/isodoc/gb/html/html_compliant_gb_titlepage.html +116 -0
  91. data/lib/isodoc/gb/html/html_gb_intro.html +6 -0
  92. data/lib/isodoc/gb/html/html_gb_titlepage.html +94 -0
  93. data/lib/isodoc/gb/html/htmlcompliantstyle.scss +1220 -0
  94. data/lib/isodoc/gb/html/htmlstyle.scss +1007 -0
  95. data/lib/isodoc/gb/html/logo.png +0 -0
  96. data/lib/isodoc/gb/html/scripts.html +71 -0
  97. data/lib/isodoc/gb/html/word_gb_intro.html +3 -0
  98. data/lib/isodoc/gb/html/word_gb_titlepage.html +388 -0
  99. data/lib/isodoc/gb/html/wordstyle.scss +2543 -0
  100. data/lib/isodoc/gb/i18n-en.yaml +12 -0
  101. data/lib/isodoc/gb/i18n-zh-Hans.yaml +12 -0
  102. data/lib/isodoc/gb/metadata.rb +232 -0
  103. data/lib/metanorma/gb.rb +7 -0
  104. data/lib/metanorma/gb/processor.rb +43 -0
  105. data/metanorma-gb.gemspec +48 -0
  106. metadata +380 -0
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
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
+ # Thoughtbot's style guide from: https://github.com/thoughtbot/guides
7
+ - ".rubocop.tb.yml"
8
+ # Overrides from Ribose
9
+ - ".rubocop.ribose.yml"
10
+ AllCops:
11
+ DisplayCopNames: false
12
+ StyleGuideCopsOnly: false
13
+ TargetRubyVersion: 2.4
14
+ Rails:
15
+ Enabled: true
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ dist: trusty
2
+ sudo: false
3
+ language: ruby
4
+ rvm:
5
+ - 2.5
6
+ - 2.4
7
+ - 2.3
8
+ - ruby-head
9
+ before_install:
10
+ - gem install bundler -v 1.16.1
11
+ - unset _JAVA_OPTIONS
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: ruby-head
15
+
@@ -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,9 @@
1
+ Encoding.default_external = Encoding::UTF_8
2
+ Encoding.default_internal = Encoding::UTF_8
3
+
4
+ source "https://rubygems.org"
5
+
6
+ #git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
7
+
8
+ # Specify your gem's dependencies in asciidoctor-csd.gemspec
9
+ gemspec
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,369 @@
1
+ = metanorma-gb: Authoring Chinese standards (GuoBiao, sector...) in AsciiDoc
2
+
3
+ image:https://img.shields.io/gem/v/metanorma-gb.svg["Gem Version", link="https://rubygems.org/gems/metanorma-gb"]
4
+ image:https://img.shields.io/travis/riboseinc/metanorma-gb/master.svg["Build Status", link="https://travis-ci.org/riboseinc/metanorma-gb"]
5
+ image:https://codeclimate.com/github/riboseinc/metanorma-gb/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/metanorma-gb"]
6
+
7
+ == Functionality
8
+
9
+ This gem generates
10
+ https://en.wikipedia.org/wiki/Guobiao_standards[Guibiao standards]
11
+ (Chinese national standards), using AsciiDoc.
12
+
13
+ This gem implements the https://github.com/riboseinc/gbdoc[GbDoc] data model,
14
+ which inherits from
15
+ https://github.com/riboseinc/isodoc-models[IsoDoc and StandardDocument].
16
+
17
+ The code of this gem inherits from
18
+ https://github.com/riboseinc/metanorma-iso[metanorma-iso], a gem used to
19
+ generate ISO standards using Asciidoc.
20
+
21
+ The two standards formats are closely aligned. Refer to the ISO gem
22
+ for guidance, including
23
+ https://github.com/riboseinc/metanorma-iso/wiki/Guidance-for-authoring[IsoDoc: Guidance for authoring]
24
+
25
+ The gem can also be used to generate Chinese local or sector standards, which
26
+ have the same format; the gem formats the title page to have the correct
27
+ metadata displayed.
28
+
29
+ The following outputs are generated.
30
+
31
+ * (Optional) An HTML preview generated directly from the Asciidoctor document,
32
+ using native Asciidoc formatting.
33
+ ** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
34
+ The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
35
+ which is syntactically stricter than the common MathJax processor;
36
+ if you do not get expected results, try bracketting terms your in AsciiMathML
37
+ expressions.
38
+ * an XML representation of the document, intended as a document model for GB
39
+ International Standards.
40
+ * The XML representation is processed in turn to generate the following outputs
41
+ as end deliverable GB standard drafts.
42
+ ** HTML
43
+ ** Word
44
+
45
+ The Word output of the gem is strictly
46
+ aligned to the GB/T 1.1 specification, including the fonts and font sizes
47
+ prescribed, and the measurements for element positioning on the page.
48
+
49
+ == Usage
50
+
51
+ The preferred way to invoke this gem is via the `metanorma` script:
52
+
53
+ [source,console]
54
+ ----
55
+ $ metanorma --type gb a.adoc # output HTML and DOC
56
+ $ metanorma --type gb --extensions html a.adoc # output just HTML
57
+ $ metanorma --type gb --extensions doc a.adoc # output just DOC
58
+ $ metanorma --type gb --extensions xml a.adoc # output GB XML
59
+ ----
60
+
61
+ The gem translates the document into GB XML format, and then
62
+ validates its output against the GB XML document model; errors are
63
+ reported to console against the XML, and are intended for users to
64
+ check that they have provided all necessary components of the
65
+ document.
66
+
67
+ The gem then converts the XML into HTML and DOC.
68
+
69
+ The gem can also be invoked directly within asciidoctor, though this is deprecated:
70
+
71
+ [source,console]
72
+ ----
73
+ $ asciidoctor -b gb -r 'metanorma-gb' a.adoc
74
+ ----
75
+
76
+ === Installation
77
+
78
+ If you are using a Mac, the https://github.com/riboseinc/metanorma-macos-setup
79
+ repository has instructions on setting up your machine to run Metanorma
80
+ scripts such as this one. You need only run the following in a Terminal console:
81
+
82
+ [source,console]
83
+ ----
84
+ $ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
85
+ $ gem install metanorma-gb
86
+ ----
87
+
88
+
89
+ == Differences from `metanorma-iso`
90
+
91
+ === Document Attributes
92
+
93
+ In the following, "GB standard" should be read to refer to any Chinese
94
+ national, sector or local standard. Asterisked document attributes are
95
+ mandatory.
96
+
97
+ `:title-intro-zh:`, `:title-main-zh:`*, `:title-part-zh:`::
98
+ These are the title introduction, main title, and part title in Chinese.
99
+ The intro and part titles are optional.
100
+ (They replace their French counterparts in
101
+ https://github.com/riboseinc/metanorma-iso[metanorma-iso].)
102
+
103
+ `:title-intro-en:`, `:title-main-en:`*, `:title-part-en:`::
104
+ These are the title introduction, main title, and part title in English.
105
+ The intro and part titles are optional.
106
+ (They form the document subtitle, instead of the document title as in
107
+ https://github.com/riboseinc/metanorma-iso[metanorma-iso].)
108
+
109
+ `:technical-committee-type:`::
110
+ The type of the technical committee (`technical` or `provisional`).
111
+
112
+ `:iso-standard:`::
113
+ (optional) A corresponding ISO standard that the GB standard relates to. Format
114
+ is full document code, then optionally comma followed by document title;
115
+ e.g. `ISO/IEC 27001:2013, Information security management systems`
116
+
117
+ `:equivalence:`::
118
+ (optional, only valid if there is a corresponding `:iso-standard:`)
119
+ The relation of the GB standard to the corresponding ISO standard
120
+ (`equivalent`, `identical`, `nonequivalent`). Defaults to `equivalent`.
121
+
122
+ `:obsoletes:`::
123
+ (optional)
124
+ A corresponding GB standard that this GB standard obsoletes. Format is full
125
+ document code, then optionally comma followed by document title;
126
+ e.g. `GB/T 22080-2008`
127
+
128
+ `:obsoletes-parts:`::
129
+ A list of bibliographic localities in the corresponding GB standard that this
130
+ GB standard obsoletes. These are formatted the same way as the localities in
131
+ citations; e.g. `clause 7-9, clause 11`
132
+
133
+ `:scope:`::
134
+ The scope of the GB standard (`national`, `sector`, `professional`, `local`,
135
+ `enterprise`, `social-group`). Defaults to `national`.
136
+
137
+ `:mandate:`::
138
+ The mandate of the GB standard (`mandatory`, `recommended`, `guidelines`).
139
+ Defaults to `mandatory`.
140
+
141
+ `:topic:`::
142
+ The topic of the GB standard (`basic`, `health-and-safety`, `environment-protection`, `engineering-and-construction`, `product`, `method`, `management-techniques`, `other`). Defaults to `basic`.
143
+
144
+ `:prefix:`::
145
+ The prefix classifying the GB standard.
146
+ (Refer to
147
+ https://github.com/riboseinc/gbdoc/blob/master/models/gb-standard-national-prefix.adoc[GB National Standard Prefixes],
148
+ https://github.com/riboseinc/gbdoc/blob/master/models/gb-standard-sector-prefix.adoc[GB Sector Standard Prefixes],
149
+ https://github.com/riboseinc/gbdoc/blob/master/models/gb-standard-local-prefix.adoc[GB Local Standard Prefixes],
150
+ https://github.com/riboseinc/metanorma-gb/issues/54[GB Social and Enterprise Standard Prefixes].)
151
+ Any `/Z` or `/T` suffix (indicating "recommended" and "guidelines" mandate) is
152
+ ignored unless the `:mandate:` attribute is not given. Any `Q/` or `T/` prefix for social and enterprise
153
+ standards is ignored unless the `:scope:` attribute is not given.
154
+
155
+ `:issued-date:`::
156
+ The date on which the GB standard was issued (authorised for publication by the issuing authority).
157
+
158
+ `:published-date:`::
159
+ The date on which the GB standard was published (distributed by the publisher).
160
+
161
+ `:implemented-date:`::
162
+ The date on which the GB standard became active.
163
+
164
+ `:created-date:`::
165
+ The date on which the first version of the GB standard was created.
166
+
167
+ `:updated-date:`::
168
+ The date on which the current version of the GB standard was updated.
169
+
170
+ `:obsoleted-date:`::
171
+ The date on which the GB standard was obsoleted/revoked.
172
+
173
+ `:confirmed-date:`::
174
+ The date on which the GB standard was reviewed and approved by the issuing authority.
175
+
176
+ `:library-ics:`::
177
+ The ICS (International Categorization for Standards) number for the GB standard. There may be more than one ICS for a document; if so, they should be comma-delimited. (Unlike the case for ISO, the ICS identifier is output to the front page of the GB standard.)
178
+
179
+ `:library-ccs:`::
180
+ The CCS (Chinese Categorization Scheme) code for the GB standard. See https://github.com/riboseinc/cn-ccs-codes
181
+
182
+ `:plan-number:`::
183
+ The Plan Number (计划单号) for the GB standard.
184
+
185
+ `:issuer:`::
186
+ The issuer of the standard. This is the authority which authors, manages, and issues the standard. For social standards, this is the social group; for enterprise standards, this is the company. The issuer appears on the standard frontispiece. By default, the issuer is inferred from the prefix of the standard; this attribute overrides the value inferred from the prefix. It is required for social and entperprise standards.
187
+
188
+ `:publisher:`::
189
+ The publisher of the standard, which distributes the standard. This is distinct from the issuer, the authority which authors, manages, and issues the standard.
190
+
191
+ `:proposer:`::
192
+ The party which proposed the standard.
193
+
194
+ `:authority:`::
195
+ The authority which sponsored the standard.
196
+
197
+ `:author:`::
198
+ The individuals who drafted the standard.
199
+
200
+ `:author-committee:`::
201
+ The committees which drafted the standard.
202
+
203
+ `:title-font:`::
204
+ The font to use for the standard class and issuer on the (Word) cover page; described in GB/T 1.1 as
205
+ "custom font". If not provided, the font is inferred from the scope of the standard, aligning
206
+ with existing practice: SimSun for national scope, SimHei for all other scopes.
207
+
208
+ `:keep-boilerplate:`::
209
+
210
+ If absent (default), any paragraphs supplied at the start of the Terms and Definitions
211
+ section are deleted, and replaced with standard boilerplate. If present, any such
212
+ paragraphs in the text are retained.
213
+
214
+ === Language macros
215
+
216
+ In Terms and Definitions, preferred terms, alternate terms and deprecated terms
217
+ are expected to be given in both Chinese and English. By default, the gem does
218
+ this by detecting space-delimited runs of Han or Latin script text:
219
+
220
+ [source,asciidoc]
221
+ --
222
+ alt:[rough rice 糙米]
223
+ --
224
+
225
+ [source,xml]
226
+ --
227
+ <admitted language="zh">糙米</admitted> <admitted language="en">rough rice</admitted>
228
+ --
229
+
230
+ However if there is script mixing in a term -- if the Chinese term contains
231
+ a Latin script acronym or a mathematical expression, for example -- the
232
+ Chinese term will not be detected correctly. To address this, the formatting macros
233
+ `+[zh]#...#+` and `+[en]#...#+` are used. If they are present, then the content
234
+ of those macros is treated as the Chinese and English equivalents of the
235
+ parent node instead:
236
+
237
+ [source,asciidoc]
238
+ --
239
+ === [en]#XYZ paddy# [zh]#水稻XY#]
240
+ alt:[[en]#rough rice# [zh]#糙米#]
241
+ --
242
+
243
+ [source,xml]
244
+ --
245
+ <preferred language="en">XYZ paddy</preferred> <preferred language="zh">水稻XYZ</preferred>
246
+ <admitted language="zh">糙米</admitted> <admitted language="en">rough rice</admitted>
247
+ --
248
+
249
+ Unfortunately no further markup is permitted within the `+[zh]#...#+` and
250
+ `+[en]#...#+` macros by Asciidoctor, and Asciidoctor does not correctly nest
251
+ inline macros within other inline macros (so `+alt:[en:[_xyz_] zh:[xyz]+`
252
+ would not give correct behaviour either.)
253
+
254
+ Localisation strings can be used anywhere else in the document where the
255
+ grammar permits localised strings (notably in bibliographic data). For example,
256
+ a bibliographic title can be given in two languages as follows. (Note that formatting appears outside the language macros.)
257
+
258
+ [source,asciidoc]
259
+ --
260
+ [[[ISO7301,ISO 7301:2011]]], _[zh]#大米 - 规格# [en]#Rice -- Specification#_
261
+ --
262
+
263
+ [source,xml]
264
+ --
265
+ <bibitem id="ISO7301" type="standard">
266
+ <title language="zh">大米 - 规格</title> <title language="en">Rice&#x2011;Specification</title>
267
+ <docidentifier>ISO 7301</docidentifier>
268
+ <date type="published">
269
+ <from>2011</from>
270
+ </date>
271
+ <contributor>
272
+ <role type="publisher"/>
273
+ <organization>
274
+ <name>International Organization for Standardization</name>
275
+ <abbreviation>ISO</abbreviation>
276
+ </organization>
277
+ </contributor>
278
+ </bibitem>
279
+ --
280
+
281
+ The gem also supports `+[zh-Hant]#...#+` and `+[zh-Hans]#...#+` to
282
+ differentiate traditional and simplified script in ISOXML; `zh-Hant` is
283
+ provisionally supported through changing font in the output.
284
+
285
+ == Caveats
286
+
287
+ === Microsoft Word
288
+
289
+ The Word output is meticulously aligned to the GB/T 1.1 specification, which is highly
290
+ prescriptive on the positioning of elements on the page. This means that the Word output
291
+ uses http://www.addbalance.com/word/frames_textboxes.htm[frames] and
292
+ https://en.wikipedia.org/wiki/Vector_Markup_Language[VML] extensively, as the best mechanism
293
+ Word HTNL has to ensure precise positioning of elements. However, the use of frames
294
+ makes Word documents more cumbersome to edit; it is envisaged that the bulk of document
295
+ editing should be happening in Asciidoctor, with Word treated as a write-only output format.
296
+
297
+ The use of VML and frames is mostly confined to the cover page, which is the most heavily
298
+ prescribed by GB/T 1.1. However, Word as of 2016 suppresses space before a paragraph
299
+ after a page break (though not a section break--which means that the Foreword, Introduction,
300
+ Document Title, Annex and Bibliography titles would all either lose their mandated initial
301
+ space in Word, or else would all have to be treated as separate sections. For that reason,
302
+ those headings are instead treated by this gem as frames (in-line with their following text),
303
+ which preserve their initial spacing.
304
+
305
+ === GB/T 1.1 Compliance
306
+
307
+ GB/T 1.1-2009 prescribes the format of GB standards meticulously, and is based on ISO/IEC DIR 2-2004
308
+ (though it is not equivalent, and ISO/EIC DIR 2 is less prescriptive about layout).
309
+ GB issued a template program for generating compliant Word documents
310
+ in 2010; this program no longer executes on Windows. (This gem has extracted its stylesheet for
311
+ use in formatting output, but the stylesheet itself had to be modified in places to comply with
312
+ GB/T 1.1.)
313
+
314
+ Compliance of GB standards with GB/T 1.1 has been patchy. This has been exacerbated by the fact that
315
+ ISO/IEC DIR 2 was substantially revised in 2011 and again in 2016. Although GB/T 1.1 has not been
316
+ updated to align with ISO/IEC DIR 2-2016, published GB standards increasingly are formatted according
317
+ to ISO in most areas where ISO and GB now conflict.
318
+
319
+ This gem attempts to align with current best practice of GB standards, and does so in consultation with
320
+ GB. GB/T 19018-2017 has been used as the exemplar standard.
321
+
322
+ The following area the areas where the gem's Word output aligns with or deviates from GB/T 1.1-2009.
323
+
324
+ * https://github.com/riboseinc/metanorma-gb/issues/58[Measurements (GB/T 1.1 Annex I.)] The gem
325
+ scrupulously aligns with the measurements prescribed in GB/T, to a greater extent than the 2010
326
+ template tool. As already noted, it makes extensive use of frames to ensure correct vertical positioning
327
+ of headers, and of elements on the cover page.
328
+
329
+ * https://github.com/riboseinc/metanorma-gb/issues/56[Fonts (GB/T 1.1 Annex J.)] The gem aligns
330
+ with the fonts and font sizes prescribed in GB/T. (The only exception is the standard name, for which a
331
+ point size of 72 is quite unrealistic: 26pt is used instead, in compliance with the preexisting Word
332
+ template.) For Simplified Chinese script, the gem uses by default SimSun as its "serif" font, and SimHei
333
+ has its "sans-serif" font; this reflects practice in the
334
+ Word templates used for GB. For Latin script, it uses Cambria as its serif font, and Calibri as its
335
+ sans-serif font; this is to minimise disruption moving between scripts. (Note that the stylesheets
336
+ make minimal use of boldface and italics, as these are not well-matched with Chinese typography;
337
+ the sans-serif font occupies the niche that boldface occupies in ISO Latin-script documents.)
338
+ +
339
+ GB/T 1.1 prescribes a "custom font" for the standard class and standard issuer on the cover page.
340
+ By default, this is the serif font for standards with national scope, and the sans-serif font for
341
+ all other scopes. All font selections can be overriden in the document attributes (`:bodyfont:`,
342
+ `:headerfont:`, `:titlefont:`.)`
343
+
344
+ * https://github.com/riboseinc/metanorma-gb/issues/57[Layout (GB/T 1.1 Clause 9.)]. The gem complies
345
+ with GB/T 1.1, with the following exceptions where it follows ISO/IEC DIR 2-2016 practice instead:
346
+
347
+ ** 9.3: There are no separate tables of figures, tables of tables, or tables of annexes. Table of Contents
348
+ indentation in the 2010 stylesheet did not comply with GB/T 1.1.
349
+
350
+ ** 9.5.2: Normal references and Bibliography references are indented like normal paragraphs, instead of
351
+ having a hanging indent ("on overflow they should be indented to the top level"); in fact, GB/T 1.1
352
+ does not follow this in its own references list.
353
+
354
+ ** 9.5.3: Terms and Definitions is aligned with ISO/IEC DIR 2: there is provision for alternate and
355
+ deprecated terms, and term sources are notated in brackets whether they are modified or direct citations
356
+ from the source document, instead of being treated as a note in the latter case.
357
+ (https://github.com/riboseinc/metanorma-gb/issues/67) Clauses numbers are separated from the term
358
+ source reference by a dash. References to terms defined elsewhere in the Terms and Definitions clause
359
+ are accompanied with clause references.
360
+
361
+ ** 9.9.3: Figure footnotes are not longer treated as footnotes, but are instead merged into the figure
362
+ key, as is done in ISO/IEC DIR 2. Footnote indentation and note indentation in the 2010 stylesheet
363
+ did not comply with GB/T 1.1.
364
+
365
+ ** 9.9.4: Example labels do not appear on a separate line. Examples like notes have a hanging indent,
366
+ so that their content is left-aligned.
367
+
368
+ ** 9.9.5: Formulas are centered in the page, but are not connected with the formula number with a
369
+ dotted tab.