metanorma-bipm 2.2.8 → 2.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/bipm.brochure.xsl +794 -243
- data/lib/isodoc/bipm/bipm.guide.xsl +794 -243
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +794 -243
- data/lib/isodoc/bipm/bipm.rapport.xsl +794 -243
- data/lib/isodoc/bipm/html/html_bipm_intro.html +0 -1
- data/lib/isodoc/bipm/init.rb +1 -1
- data/lib/isodoc/bipm/jcgm.standard.xsl +772 -238
- data/lib/isodoc/bipm/presentation_xml_convert.rb +5 -3
- data/lib/metanorma/bipm/bipm.rng +3 -8
- data/lib/metanorma/bipm/converter.rb +11 -3
- data/lib/metanorma/bipm/isodoc.rng +16 -7
- data/lib/metanorma/bipm/version.rb +1 -1
- data/lib/relaton/render/config.yml +47 -0
- data/lib/relaton/render/general.rb +23 -0
- data/lib/relaton/render/parse.rb +20 -0
- metadata +5 -2
@@ -4,6 +4,7 @@ require "metanorma-iso"
|
|
4
4
|
require_relative "init"
|
5
5
|
require_relative "index"
|
6
6
|
require_relative "doccontrol"
|
7
|
+
require_relative "../../relaton/render/general"
|
7
8
|
|
8
9
|
module IsoDoc
|
9
10
|
module BIPM
|
@@ -182,10 +183,7 @@ module IsoDoc
|
|
182
183
|
def note1(elem)
|
183
184
|
return if elem.parent.name == "bibitem" || elem["notag"] == "true"
|
184
185
|
|
185
|
-
# n = @xrefs.get[elem["id"]]
|
186
186
|
lbl = l10n(note_label(elem))
|
187
|
-
# (n.nil? || n[:label].nil? || n[:label].empty?) or
|
188
|
-
# lbl = l10n("#{lbl} #{n[:label]}")
|
189
187
|
prefix_name(elem, "", lbl, "name")
|
190
188
|
end
|
191
189
|
|
@@ -226,6 +224,10 @@ module IsoDoc
|
|
226
224
|
ret
|
227
225
|
end
|
228
226
|
|
227
|
+
def bibrenderer
|
228
|
+
::Relaton::Render::BIPM::General.new(language: @lang)
|
229
|
+
end
|
230
|
+
|
229
231
|
include Init
|
230
232
|
end
|
231
233
|
end
|
data/lib/metanorma/bipm/bipm.rng
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<grammar ns=
|
2
|
+
<grammar ns='https://www.metanorma.org/ns/bipm' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
3
|
<!--
|
4
|
+
VERSION v1.2.1
|
4
5
|
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
|
5
6
|
we cannot have a new default namespace: we will end up with a grammar with two different
|
6
7
|
namespaces, one for isostandard and one for csand additions. And we do not want that.
|
@@ -196,13 +197,7 @@
|
|
196
197
|
</include>
|
197
198
|
<define name="bipm-standard">
|
198
199
|
<element name="bipm-standard">
|
199
|
-
<
|
200
|
-
<attribute name="type">
|
201
|
-
<choice>
|
202
|
-
<value>semantic</value>
|
203
|
-
<value>presentation</value>
|
204
|
-
</choice>
|
205
|
-
</attribute>
|
200
|
+
<ref name="Root-Attributes"/>
|
206
201
|
<ref name="bibdata"/>
|
207
202
|
<zeroOrMore>
|
208
203
|
<ref name="termdocsource"/>
|
@@ -51,9 +51,9 @@ module Metanorma
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def date_range(date)
|
54
|
-
from = date.at(
|
55
|
-
to = date.at(
|
56
|
-
on = date.at(
|
54
|
+
from = date.at("./from")
|
55
|
+
to = date.at("./to")
|
56
|
+
on = date.at("./on")
|
57
57
|
return date.text unless from || on || to
|
58
58
|
return on.text.sub(/-.*$/, "") if on
|
59
59
|
|
@@ -125,6 +125,14 @@ module Metanorma
|
|
125
125
|
lowergreek: false, lowerroman: true }
|
126
126
|
end
|
127
127
|
|
128
|
+
def xref_to_eref(elem, name)
|
129
|
+
if elem.at("//bibitem[@id = '#{elem['target']}']/" \
|
130
|
+
"docidentifier[@type = 'BIPM-long']")
|
131
|
+
elem["style"] = "BIPM-long"
|
132
|
+
end
|
133
|
+
super
|
134
|
+
end
|
135
|
+
|
128
136
|
def document(node)
|
129
137
|
@jcgm = node.attr("committee-acronym") == "JCGM"
|
130
138
|
super
|
@@ -17,6 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
+
<!-- VERSION v1.2.2 -->
|
20
21
|
<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">
|
21
22
|
<include href="reqt.rng"/>
|
22
23
|
<include href="basicdoc.rng">
|
@@ -210,6 +211,9 @@
|
|
210
211
|
<data type="boolean"/>
|
211
212
|
</attribute>
|
212
213
|
</optional>
|
214
|
+
<optional>
|
215
|
+
<attribute name="style"/>
|
216
|
+
</optional>
|
213
217
|
<ref name="CitationType"/>
|
214
218
|
<oneOrMore>
|
215
219
|
<ref name="PureTextElement"/>
|
@@ -1349,15 +1353,19 @@
|
|
1349
1353
|
</choice>
|
1350
1354
|
</element>
|
1351
1355
|
</define>
|
1356
|
+
<define name="Root-Attributes">
|
1357
|
+
<attribute name="version"/>
|
1358
|
+
<attribute name="schema-version"/>
|
1359
|
+
<attribute name="type">
|
1360
|
+
<choice>
|
1361
|
+
<value>semantic</value>
|
1362
|
+
<value>presentation</value>
|
1363
|
+
</choice>
|
1364
|
+
</attribute>
|
1365
|
+
</define>
|
1352
1366
|
<define name="standard-document">
|
1353
1367
|
<element name="standard-document">
|
1354
|
-
<
|
1355
|
-
<attribute name="type">
|
1356
|
-
<choice>
|
1357
|
-
<value>semantic</value>
|
1358
|
-
<value>presentation</value>
|
1359
|
-
</choice>
|
1360
|
-
</attribute>
|
1368
|
+
<ref name="Root-Attributes"/>
|
1361
1369
|
<ref name="bibdata"/>
|
1362
1370
|
<optional>
|
1363
1371
|
<ref name="misccontainer"/>
|
@@ -2131,6 +2139,7 @@
|
|
2131
2139
|
<choice>
|
2132
2140
|
<value>identical</value>
|
2133
2141
|
<value>modified</value>
|
2142
|
+
<value>adapted</value>
|
2134
2143
|
<value>restyled</value>
|
2135
2144
|
<value>context-added</value>
|
2136
2145
|
<value>generalisation</value>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
nametemplate:
|
2
|
+
one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0] | join: ' ' | remove: '.' | remove: '_' }}{% endif %}"
|
3
|
+
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0] | join: ' ' | remove: '.' | remove: '_' }}{% endif %} {{ labels['and'] }} {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{ initials[1] | join: ' ' | remove: '.' | remove: '_' }}{% endif %}"
|
4
|
+
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0] | join: ' ' | remove: '.' | remove: '_' }} {% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{ initials[1] | join: ' ' | remove: '.' | remove: '_' }} {% endif %} {{ labels['and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2]}} {{initials[2] | join: ' ' | remove: '.' | remove: '_' }}{% endif %}"
|
5
|
+
seriestemplate: "{% if series_formatted %}{{ series_formatted }}{% else %}{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{series_num}}|.{{series_partnumber}}{% endif %}"
|
6
|
+
extenttemplate:
|
7
|
+
book: "<strong>{{ volume }}</strong> ({{issue}}) {{ page }}"
|
8
|
+
booklet: book
|
9
|
+
proceedings: book
|
10
|
+
journal: "<strong>{{ volume_raw }}</strong> ({{issue_raw}}) {{ page_raw }}"
|
11
|
+
article: journal
|
12
|
+
standard: book
|
13
|
+
techreport: "<strong>{{ volume }}</strong> ({{issue}}) {{ page }}"
|
14
|
+
inbook: "{{ volume }}: {{ page }}"
|
15
|
+
misc: "<strong>{{ volume }}</strong> ({{issue}}) {{ page }}, {{ duration }}"
|
16
|
+
template:
|
17
|
+
book: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ,_{{ edition | capitalize_first }}. [{{medium}}] ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}) {{draft}} ({{ series }}) {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. {{size}}. {{extent}}."
|
18
|
+
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, rights metadata, distributor, item attributes, relationships
|
19
|
+
booklet: book
|
20
|
+
manual: book
|
21
|
+
proceedings: book
|
22
|
+
inbook: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{ title }} . {{ authoritative_identifier | join: '. ' }}. {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role | capitalize}}) <em>{{host_title}}</em> [{{medium}}] ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}) {{draft}} ({{ series }}) . {{size}}. {{extent}}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
23
|
+
inproceedings: inbook
|
24
|
+
incollection: inbook
|
25
|
+
# TODO: omitted: author ids, additional info for component part, subsidiary titles of host resource, rights metadata, distributor, relationships
|
26
|
+
journal: "<em>{{ title}}</em> [{{medium}}] . ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}). ({{date}}). {{size}}. {{extent}}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
27
|
+
# TODO subsidiary titles, rights metadata, item attributes, relationships
|
28
|
+
article: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{ series }}. [{{medium}}] {{draft}} . {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
29
|
+
# TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, item attributes, relationships; newspapers
|
30
|
+
software: "{{ creatornames }} ({{ role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }} {{draft}} . [{{medium | capitalize}}]. ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}). {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{size}}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
31
|
+
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, copyright, license, distributor, system requirements, relationships
|
32
|
+
electronic resource: software
|
33
|
+
standard: "{% if home_standard %}<em>{{title}}</em>, _{{extent}}{%else%}{% if creatornames %}{{ creatornames }} ({{ role | capitalize}}){%else%}{{ publisher}}{%endif%} . ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ({{nistpublisher}}), {{draft }} {{ series }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}].{%endif%}"
|
34
|
+
# TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, persistent identifier, item attributes, relationships
|
35
|
+
techreport: "{% if creatornames %}{{ creatornames }} ({{ role | capitalize}}){%else%}{{ publisher}}{%endif%} . ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ({{nistpublisher}}), {{draft }} {{ series }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
36
|
+
dataset: "{{ creatornames }} ({{ role | capitalize }}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }} [{{medium }}]. {{ labels['in'] | capitalize }}:_{{series}}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ size }}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
37
|
+
# TODO: omitted: author ids, system requirements, host archive, copyright, license, data source, distributor, usage instructions, relationships, provenance
|
38
|
+
website: "{{ creatornames }} ({{ role | capitalize }}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }} [{{medium }}] ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}) {{ draft }} . {{ authoritative_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
39
|
+
# TODO: omitted: author ids, page title, system requirements, subsidiary creator, rights metadata, distributor, persistent identifier, archive location, archive date and time, relationships
|
40
|
+
webresource: website
|
41
|
+
# TODO: component part
|
42
|
+
unpublished: "{{ creatornames }} ({{ role | capitalize }}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> [{{ medium }}] {{ draft }} . {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
43
|
+
misc: unpublished
|
44
|
+
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, host archive, item attributes, relationships
|
45
|
+
presentation: unpublished
|
46
|
+
thesis: "{{ creatornames }} ({{ role | capitalize }}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> [{{ medium }}] ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}). {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
47
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "relaton-render"
|
2
|
+
|
3
|
+
module Relaton
|
4
|
+
module Render
|
5
|
+
module BIPM
|
6
|
+
class General < ::Relaton::Render::IsoDoc::General
|
7
|
+
def config_loc
|
8
|
+
YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
|
9
|
+
end
|
10
|
+
|
11
|
+
def klass_initialize(_options)
|
12
|
+
@nametemplateklass = Relaton::Render::Template::Name
|
13
|
+
@seriestemplateklass = Relaton::Render::Template::Series
|
14
|
+
@extenttemplateklass = Relaton::Render::Template::Extent
|
15
|
+
@sizetemplateklass = Relaton::Render::Template::Size
|
16
|
+
@generaltemplateklass = Relaton::Render::Template::General
|
17
|
+
@fieldsklass = Relaton::Render::Fields
|
18
|
+
@parseklass = Relaton::Render::Parse
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Relaton
|
2
|
+
module Render
|
3
|
+
module BIPM
|
4
|
+
class Parse < ::Relaton::Render::Parse
|
5
|
+
def simple_or_host_xml2hash(doc, host)
|
6
|
+
ret = super
|
7
|
+
ret.merge(home_standard: home_standard(doc, ret[:publisher_raw]))
|
8
|
+
end
|
9
|
+
|
10
|
+
def home_standard(_doc, pubs)
|
11
|
+
pubs&.any? do |r|
|
12
|
+
["International Organization for Standardization", "ISO",
|
13
|
+
"International Electrotechnical Commission", "IEC"]
|
14
|
+
.include?(r[:nonpersonal])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-bipm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-generic
|
@@ -276,6 +276,9 @@ files:
|
|
276
276
|
- lib/metanorma/bipm/relaton-bipm.rng
|
277
277
|
- lib/metanorma/bipm/reqt.rng
|
278
278
|
- lib/metanorma/bipm/version.rb
|
279
|
+
- lib/relaton/render/config.yml
|
280
|
+
- lib/relaton/render/general.rb
|
281
|
+
- lib/relaton/render/parse.rb
|
279
282
|
- metanorma-bipm.gemspec
|
280
283
|
- metanorma.yml
|
281
284
|
homepage: https://github.com/metanorma/metanorma-bipm
|