metanorma-jis 0.3.2 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,20 +1,27 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
3
  <!--
4
4
  Presupposes isodoc.rnc, is included in it
5
5
  include "isodoc.rnc" { }
6
+
7
+ This is the Metanorma default provisions model; it is overridden by other provisions models,
8
+ such as Modspec
6
9
  -->
7
10
  <define name="requirement">
11
+ <a:documentation>Specification of an attribute of a subject that is required.
12
+ NOTE: A requirement can contain other requirements</a:documentation>
8
13
  <element name="requirement">
9
14
  <ref name="RequirementType"/>
10
15
  </element>
11
16
  </define>
12
17
  <define name="recommendation">
18
+ <a:documentation>Specification of an attribute of a subject that is recommended</a:documentation>
13
19
  <element name="recommendation">
14
20
  <ref name="RequirementType"/>
15
21
  </element>
16
22
  </define>
17
23
  <define name="permission">
24
+ <a:documentation>Specification of an attribute of a subject that is permitted</a:documentation>
18
25
  <element name="permission">
19
26
  <ref name="RequirementType"/>
20
27
  </element>
@@ -22,80 +29,101 @@
22
29
  <define name="RequirementType">
23
30
  <optional>
24
31
  <attribute name="obligation">
25
- <ref name="ObligationType"/>
26
- </attribute>
27
- </optional>
28
- <optional>
29
- <attribute name="unnumbered">
30
- <data type="boolean"/>
31
- </attribute>
32
- </optional>
33
- <optional>
34
- <attribute name="number"/>
35
- </optional>
36
- <optional>
37
- <attribute name="subsequence"/>
38
- </optional>
39
- <optional>
40
- <attribute name="keep-with-next">
41
- <data type="boolean"/>
42
- </attribute>
43
- </optional>
44
- <optional>
45
- <attribute name="keep-lines-together">
46
- <data type="boolean"/>
32
+ <a:documentation>An attribute that may be used to override the obligation represented in
33
+ the tag name of the top level containers</a:documentation>
34
+ <ref name="ReqtObligationType"/>
47
35
  </attribute>
48
36
  </optional>
49
37
  <attribute name="id">
50
38
  <data type="ID"/>
51
39
  </attribute>
40
+ <ref name="NumberingAttributes"/>
41
+ <ref name="BlockAttributes"/>
52
42
  <optional>
53
- <attribute name="filename"/>
54
- </optional>
55
- <optional>
56
- <attribute name="model"/>
43
+ <attribute name="filename">
44
+ <a:documentation>File name of the requirement model when exported</a:documentation>
45
+ </attribute>
57
46
  </optional>
58
47
  <optional>
59
- <attribute name="type"/>
48
+ <attribute name="model">
49
+ <a:documentation>Model of requirements realised by this requirement, e.g. "ogc" for Modspec</a:documentation>
50
+ </attribute>
60
51
  </optional>
61
52
  <optional>
62
- <attribute name="tag"/>
53
+ <attribute name="type">
54
+ <a:documentation>Type of requirement; does not override labelling, unlike `class`</a:documentation>
55
+ </attribute>
63
56
  </optional>
64
57
  <optional>
65
- <attribute name="multilingual-rendering">
66
- <ref name="MultilingualRenderingType"/>
58
+ <attribute name="class">
59
+ <a:documentation>Class of provision, used to sequence and label that class separately.
60
+ By default, provisions are sequenced and labelled as requirements, recommendations, or
61
+ permissions, by obligation; the class overrides that</a:documentation>
67
62
  </attribute>
68
63
  </optional>
69
64
  <optional>
70
- <ref name="reqtitle"/>
65
+ <ref name="reqtitle">
66
+ <a:documentation>Human-readable title of the requirement</a:documentation>
67
+ </ref>
71
68
  </optional>
72
69
  <optional>
73
- <ref name="label"/>
70
+ <ref name="reqtlabel">
71
+ <a:documentation>Formal identifier with which the requirement is referenced</a:documentation>
72
+ </ref>
74
73
  </optional>
75
74
  <zeroOrMore>
76
- <ref name="subject"/>
75
+ <ref name="subject">
76
+ <a:documentation>The party subject to the obligation stated in the requirement</a:documentation>
77
+ </ref>
77
78
  </zeroOrMore>
78
79
  <zeroOrMore>
79
- <ref name="reqinherit"/>
80
+ <ref name="reqinherit">
81
+ <a:documentation>Reference to the identifier of another requirement, of which this requirement
82
+ is a subclass, and from which it inherits attributes</a:documentation>
83
+ </ref>
80
84
  </zeroOrMore>
81
85
  <zeroOrMore>
82
- <ref name="classification"/>
86
+ <ref name="classification">
87
+ <a:documentation>Key/Value pairs of metadata used to describe the requirement.
88
+ A key can be associated with multiple values</a:documentation>
89
+ </ref>
83
90
  </zeroOrMore>
84
91
  <zeroOrMore>
85
92
  <choice>
86
- <ref name="measurementtarget"/>
87
- <ref name="specification"/>
88
- <ref name="verification"/>
89
- <ref name="import"/>
90
- <ref name="description"/>
91
- <ref name="component"/>
93
+ <ref name="measurementtarget">
94
+ <a:documentation>Quantitative statement of metrics that the requirement realises</a:documentation>
95
+ </ref>
96
+ <ref name="specification">
97
+ <a:documentation>Formal specification of the requirement. Expected to be machine-readable</a:documentation>
98
+ </ref>
99
+ <ref name="verification">
100
+ <a:documentation>Processes or code used to verify that the requirement is being complied
101
+ with. Can be a test (including test code), or a compliance statement</a:documentation>
102
+ </ref>
103
+ <ref name="import">
104
+ <a:documentation>A reference to source code or a statement of prerequisites which is defined elsewhere</a:documentation>
105
+ </ref>
106
+ <ref name="description">
107
+ <a:documentation>Descriptive statement of the content of the requirement. Is expected to
108
+ be human-readable, and to contain formatting markup following Metanorma
109
+ conventions. Is expected to be discursive, and be resumed after
110
+ interruption by other sub-containers</a:documentation>
111
+ </ref>
112
+ <ref name="component">
113
+ <a:documentation>Provisions nested within this provision, which cannot be referenced autonomously and have
114
+ subclasses specific to the parent provision. Not expressed with provision metadata</a:documentation>
115
+ </ref>
92
116
  </choice>
93
117
  </zeroOrMore>
94
118
  <optional>
95
- <ref name="reqt_references"/>
119
+ <ref name="reqt_references">
120
+ <a:documentation>A list of references for the requirement, following the Relaton model</a:documentation>
121
+ </ref>
96
122
  </optional>
97
123
  <zeroOrMore>
98
124
  <choice>
125
+ <a:documentation>Provisions nested within this provision, which are self-standing and do not have
126
+ subclasses specific to the parent provision</a:documentation>
99
127
  <ref name="requirement"/>
100
128
  <ref name="recommendation"/>
101
129
  <ref name="permission"/>
@@ -104,10 +132,10 @@
104
132
  </define>
105
133
  <define name="reqtitle">
106
134
  <element name="title">
107
- <ref name="FormattedString"/>
135
+ <ref name="LocalizedMarkedUpString"/>
108
136
  </element>
109
137
  </define>
110
- <define name="label">
138
+ <define name="reqtlabel">
111
139
  <element name="identifier">
112
140
  <oneOrMore>
113
141
  <ref name="TextElement"/>
@@ -155,7 +183,9 @@
155
183
  </define>
156
184
  <define name="component">
157
185
  <element name="component">
158
- <attribute name="class"/>
186
+ <attribute name="class">
187
+ <a:documentation>Class of component</a:documentation>
188
+ </attribute>
159
189
  <ref name="RequirementSubpart"/>
160
190
  </element>
161
191
  </define>
@@ -167,44 +197,36 @@
167
197
  </element>
168
198
  </define>
169
199
  <define name="RequirementSubpart">
170
- <optional>
171
- <attribute name="type"/>
172
- </optional>
173
- <optional>
174
- <attribute name="exclude">
175
- <data type="boolean"/>
200
+ <a:documentation>A subcontainer can be either machine-readable or human-readable, or a
201
+ mixture of the two.
202
+ A machine-readable component can be included as source code with
203
+ nomination of the language</a:documentation>
204
+ <optional>
205
+ <attribute name="type">
206
+ <a:documentation>Type of sub-container.
207
+ For example a `verification[@type = "unit-test"]` contains a unit test of a single
208
+ feature, and is to be treated differently from
209
+ `verification[@type = "comprehensive"]`, which represents a comprehensive test suite</a:documentation>
176
210
  </attribute>
177
211
  </optional>
178
212
  <optional>
179
- <attribute name="keep-with-next">
180
- <data type="boolean"/>
181
- </attribute>
182
- </optional>
183
- <optional>
184
- <attribute name="keep-lines-together">
213
+ <attribute name="exclude">
214
+ <a:documentation>Indicates that the current sub-container is only intended to be
215
+ machine-readable, and is not to be rendered as document output</a:documentation>
185
216
  <data type="boolean"/>
186
217
  </attribute>
187
218
  </optional>
188
- <optional>
189
- <attribute name="tag"/>
190
- </optional>
191
- <optional>
192
- <attribute name="multilingual-rendering">
193
- <ref name="MultilingualRenderingType"/>
194
- </attribute>
195
- </optional>
219
+ <ref name="BlockAttributes"/>
196
220
  <oneOrMore>
197
221
  <choice>
222
+ <a:documentation>Content of subpart: blocks, rather than provisions</a:documentation>
198
223
  <ref name="BasicBlock"/>
199
224
  <ref name="component"/>
200
225
  </choice>
201
226
  </oneOrMore>
202
227
  </define>
203
- <define name="ObligationType">
204
- <choice>
205
- <value>requirement</value>
206
- <value>recommendation</value>
207
- <value>permission</value>
208
- </choice>
228
+ <define name="ReqtObligationType">
229
+ <a:documentation>Values are "requirement", "recommendation", "permission"; multiple values can be comma-delimited</a:documentation>
230
+ <text/>
209
231
  </define>
210
232
  </grammar>
@@ -20,6 +20,10 @@ module Metanorma
20
20
  schema_validate(formattedstr_strip(doc.dup),
21
21
  File.join(File.dirname(__FILE__), "jis.rng"))
22
22
  end
23
+
24
+ def image_name_validate(xmldoc); end
25
+ def norm_bibitem_style(xmldoc); end
26
+ def xrefs_mandate_validate(root); end
23
27
  end
24
28
  end
25
29
  end
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.3.2".freeze
3
+ VERSION = "0.3.4".freeze
4
4
  end
5
5
  end
6
6
 
@@ -0,0 +1,57 @@
1
+ extenttemplate:
2
+ book: "{{ volume }} {{ page }}"
3
+ booklet: book
4
+ proceedings: book
5
+ journal: book
6
+ standard: book
7
+ techreport: book
8
+ inbook: "{{ volume }} {{ page }}"
9
+ misc: "{{ volume }} {{issue}} {{ page }}, {{ duration }}"
10
+ nametemplate:
11
+ one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0]}} {{initials[0] | join: ''}}.{% endif %}"
12
+ two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0]}} {{initials[0] | join: ''}}.{% endif %} , & {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{initials[1] | join: ''}}.{% endif %}"
13
+ more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0]}} {{initials[0] | join: ''}}.{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{initials[1] | join: ''}}. {% endif %} , & {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2]}} {{initials[2] | join: ''}}.{% endif %}"
14
+ # disabled the following: they should be provided in inheriting calls
15
+ # etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} <em>et al.</em>"
16
+ # etal_count: 5
17
+ seriestemplate: "{% if series_formatted %}{{ series_formatted }}{%else%}{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{series_num}}|({{series_partnumber}}){%endif%}"
18
+ journaltemplate: "{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{ labels['volume'] }}_{{series_num}} {{ labels['part'] }}_{{series_partnumber}}"
19
+ template:
20
+ # skip standardidentifier, it is inserted in front of formattedref within metanorma
21
+ standard: "{% if home_standard %}<span_class='stddocTitle'>{{ title }}</span> ,_{{ extent }}{% else %}{{ creatornames }}. <span_class='stddocTitle'>{{ title }}</span> ,_{{ extent }} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{labels['updated'] | capitalize }}_{{date_updated}}. {{status | capitalize}}. {{ authorizer }}. {{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>.{% endif %}"
22
+ website: "{{ creatornames }} ({{ role }}) . <span_class='stddocTitle'>{{ title }}</span> [{{ labels['website'] }}]. {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{place}}: {{ publisher }}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
23
+ book: "{{ creatornames }} ({{role}}) . {{ title }} . {{ edition | capitalize_first }}. ({{ series }}). {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
24
+ booklet: book
25
+ manual: book
26
+ techreport: book
27
+ proceedings: book
28
+ inbook: "{{ creatornames }} ({{role}}) . {{ title }} . {{host_title}} ({{host_role}} {{ host_creatornames}}). {{ edition | capitalize_first }}. ({{ series }}). {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
29
+ inproceedings: inbook
30
+ incollection: inbook
31
+ journal: "{{ title}} . {{ edition | capitalize_first }}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
32
+ article: "{{ creatornames }} ({{role}}) . {{ title }}. {{ series }} . {{date}}, {{ extent }}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
33
+ software: "{{ creatornames }} ({{ role}}) . {{ title }} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize}}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
34
+ electronic resource: software
35
+ dataset: "{{ creatornames }} ({{ role }}) . {{ title }} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize }}. {{ labels['in'] | capitalize }}:_{{series}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join '. ' }}. {{ other_identifier | join '. ' }}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ size }}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
36
+ webresource: website
37
+ unpublished: "{{ creatornames }} ({{ role }}) . {{ title }} . {{ medium | capitalize }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]."
38
+ presentation: unpublished
39
+ thesis: "{{ creatornames }} ({{ role }}) . {{ title }} . {{ medium | capitalize }}. {{place}}: {{ publisher }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]."
40
+ misc: "{{ creatornames }} ({{ role }}) . {{ title }} . {{ date }}."
41
+ # following are # unsupported types:
42
+ map: misc
43
+ audiovisual: misc
44
+ film: misc
45
+ video: misc
46
+ broadcast: misc
47
+ graphic_work: misc
48
+ music: misc
49
+ performance: misc
50
+ patent: misc
51
+ archival: misc
52
+ social_media: misc
53
+ alert: misc
54
+ message: misc
55
+ conversation: misc
56
+ internal: misc
57
+
@@ -7,14 +7,27 @@ module Relaton
7
7
  module Render
8
8
  module JIS
9
9
  class General < ::Relaton::Render::Iso::General
10
- #def config_loc
11
- # YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
12
- #end
10
+ def config_loc
11
+ YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
12
+ end
13
13
 
14
14
  def klass_initialize(_options)
15
15
  super
16
16
  @parseklass = Relaton::Render::JIS::Parse
17
17
  end
18
+
19
+ def render1(doc)
20
+ r = doc.relation.select { |x| x.type == "hasRepresentation" }
21
+ .map { |x| @i18n.also_pub_as + render_single_bibitem(x.bibitem) }
22
+ out = [render_single_bibitem(doc)] + r
23
+ @i18n.l10n(out.join(". ").gsub(".. ", ". ").sub(/\.\s*$/, ""))
24
+ end
25
+
26
+ def render_all(bib, type: "author-date")
27
+ ret = super
28
+ ret&.each_value { |k| k[:formattedref]&.sub!(/[.。]\s*$/, "") }
29
+ ret
30
+ end
18
31
  end
19
32
  end
20
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-19 00:00:00.000000000 Z
11
+ date: 2024-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar
@@ -314,6 +314,7 @@ files:
314
314
  - lib/metanorma/jis/reqt.rng
315
315
  - lib/metanorma/jis/validate.rb
316
316
  - lib/metanorma/jis/version.rb
317
+ - lib/relaton/render-jis/config.yml
317
318
  - lib/relaton/render-jis/general.rb
318
319
  - lib/relaton/render-jis/parse.rb
319
320
  - metanorma-jis.gemspec