metanorma-bipm 2.5.8 → 2.5.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 +262 -118
- data/lib/isodoc/bipm/bipm.guide.xsl +262 -118
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +262 -118
- data/lib/isodoc/bipm/bipm.rapport.xsl +262 -118
- data/lib/isodoc/bipm/jcgm.standard.xsl +189 -89
- data/lib/isodoc/bipm/presentation_xml_convert.rb +18 -24
- data/lib/isodoc/bipm/xref.rb +4 -27
- data/lib/metanorma/bipm/biblio.rng +12 -6
- data/lib/metanorma/bipm/version.rb +1 -1
- data/lib/relaton/render/config.yml +3 -3
- metadata +5 -6
- data/lib/isodoc/bipm/index.rb +0 -163
@@ -25,14 +25,14 @@ template:
|
|
25
25
|
# TODO: omitted: author ids, additional info for component part, subsidiary titles of host resource, rights metadata, distributor, relationships
|
26
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
27
|
# TODO subsidiary titles, rights metadata, item attributes, relationships
|
28
|
-
article: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{
|
28
|
+
article: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{ title }}. <em>{{ series }}</em>. [{{medium}}] {{draft}} . {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
29
29
|
# TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, item attributes, relationships; newspapers
|
30
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
31
|
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, copyright, license, distributor, system requirements, relationships
|
32
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 }}
|
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 }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}].{%endif%}"
|
34
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 }}
|
35
|
+
techreport: "{% if creatornames %}{{ creatornames }} ({{ role | capitalize}}){%else%}{{ publisher}}{%endif%} . ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ({{nistpublisher}}), {{draft }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
36
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
37
|
# TODO: omitted: author ids, system requirements, host archive, copyright, license, data source, distributor, usage instructions, relationships, provenance
|
38
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}}]. "
|
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.5.
|
4
|
+
version: 2.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-generic
|
@@ -266,7 +266,6 @@ files:
|
|
266
266
|
- lib/isodoc/bipm/i18n-en.yaml
|
267
267
|
- lib/isodoc/bipm/i18n-fr.yaml
|
268
268
|
- lib/isodoc/bipm/i18n.rb
|
269
|
-
- lib/isodoc/bipm/index.rb
|
270
269
|
- lib/isodoc/bipm/init.rb
|
271
270
|
- lib/isodoc/bipm/jcgm.standard.xsl
|
272
271
|
- lib/isodoc/bipm/metadata.rb
|
@@ -301,7 +300,7 @@ homepage: https://github.com/metanorma/metanorma-bipm
|
|
301
300
|
licenses:
|
302
301
|
- BSD-2-Clause
|
303
302
|
metadata: {}
|
304
|
-
post_install_message:
|
303
|
+
post_install_message:
|
305
304
|
rdoc_options: []
|
306
305
|
require_paths:
|
307
306
|
- lib
|
@@ -317,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
316
|
version: '0'
|
318
317
|
requirements: []
|
319
318
|
rubygems_version: 3.3.27
|
320
|
-
signing_key:
|
319
|
+
signing_key:
|
321
320
|
specification_version: 4
|
322
321
|
summary: metanorma-bipm lets you write BIPM standards in Metanorma.
|
323
322
|
test_files: []
|
data/lib/isodoc/bipm/index.rb
DELETED
@@ -1,163 +0,0 @@
|
|
1
|
-
require "twitter_cldr"
|
2
|
-
require "sterile"
|
3
|
-
|
4
|
-
module IsoDoc
|
5
|
-
module Bipm
|
6
|
-
class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
|
7
|
-
def add_id
|
8
|
-
%(id="_#{UUIDTools::UUID.random_create}")
|
9
|
-
end
|
10
|
-
|
11
|
-
def index(docxml)
|
12
|
-
unless docxml.at(ns("//index"))
|
13
|
-
docxml.xpath(ns("//indexsect")).each(&:remove)
|
14
|
-
return
|
15
|
-
end
|
16
|
-
i = docxml.at(ns("//indexsect")) ||
|
17
|
-
docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}" \
|
18
|
-
"</title></indexsect>").first
|
19
|
-
index = sort_indexterms(
|
20
|
-
docxml.xpath(ns("//index")),
|
21
|
-
docxml.xpath(ns("//index-xref[@also = 'false']")),
|
22
|
-
docxml.xpath(ns("//index-xref[@also = 'true']")),
|
23
|
-
)
|
24
|
-
index1(docxml, i, index)
|
25
|
-
end
|
26
|
-
|
27
|
-
def index1(docxml, i, index)
|
28
|
-
index.keys.sort.each do |k|
|
29
|
-
c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
|
30
|
-
words = index[k].keys.each_with_object({}) do |w, v|
|
31
|
-
v[sortable(w).downcase] = w
|
32
|
-
end
|
33
|
-
words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
34
|
-
c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
|
38
|
-
@xrefs.bookmark_anchor_names(docxml)
|
39
|
-
end
|
40
|
-
|
41
|
-
def sortable(str)
|
42
|
-
HTMLEntities.new.decode(Nokogiri::XML.fragment(str).text)
|
43
|
-
end
|
44
|
-
|
45
|
-
def index_entries_opt
|
46
|
-
{ xref_lbl: ", ", see_lbl: ", #{see_lbl}", also_lbl: ", #{also_lbl}" }
|
47
|
-
end
|
48
|
-
|
49
|
-
def index_entries(words, index, primary)
|
50
|
-
ret = index_entries_head(words[primary],
|
51
|
-
index.dig(words[primary], nil, nil),
|
52
|
-
index_entries_opt)
|
53
|
-
words2 = index[words[primary]]&.keys&.compact
|
54
|
-
&.each_with_object({}) { |w, v| v[w.downcase] = w }
|
55
|
-
unless words2.empty?
|
56
|
-
ret += "<ul>"
|
57
|
-
words2.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
58
|
-
ret += index_entries2(words2, index[words[primary]], w)
|
59
|
-
end
|
60
|
-
ret += "</ul>"
|
61
|
-
end
|
62
|
-
"#{ret}</li>"
|
63
|
-
end
|
64
|
-
|
65
|
-
def index_entries2(words, index, secondary)
|
66
|
-
ret = index_entries_head(words[secondary],
|
67
|
-
index.dig(words[secondary], nil),
|
68
|
-
index_entries_opt)
|
69
|
-
words3 = index[words[secondary]]&.keys&.reject(&:nil?)
|
70
|
-
&.each_with_object({}) { |w, v| v[w.downcase] = w }
|
71
|
-
unless words3.empty?
|
72
|
-
ret += "<ul>"
|
73
|
-
words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
74
|
-
ret += (index_entries_head(words3[w],
|
75
|
-
index[words[secondary]][words3[w]], index_entries_opt) + "</li>")
|
76
|
-
end
|
77
|
-
ret += "</ul>"
|
78
|
-
end
|
79
|
-
"#{ret}</li>"
|
80
|
-
end
|
81
|
-
|
82
|
-
def index_entries_head(head, entries, opt)
|
83
|
-
ret = "<li>#{head}"
|
84
|
-
xref = entries&.dig(:xref)&.join(", ")
|
85
|
-
see_sort = entries&.dig(:see)&.each_with_object({}) do |w, v|
|
86
|
-
v[sortable(w).downcase] = w
|
87
|
-
end
|
88
|
-
see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
|
89
|
-
see_sort[k]
|
90
|
-
end&.join(", ")
|
91
|
-
also_sort = entries&.dig(:also)&.each_with_object({}) do |w, v|
|
92
|
-
v[sortable(w).downcase] = w
|
93
|
-
end
|
94
|
-
also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
|
95
|
-
also_sort[k]
|
96
|
-
end&.join(", ")
|
97
|
-
ret += "#{opt[:xref_lbl]} #{xref}" if xref
|
98
|
-
ret += "#{opt[:see_lbl]} #{see}" if see
|
99
|
-
ret += "#{opt[:also_lbl]} #{also}" if also
|
100
|
-
ret
|
101
|
-
end
|
102
|
-
|
103
|
-
def see_lbl
|
104
|
-
@lang == "en" ? @i18n.see : "<em>#{@i18n.see}</em>"
|
105
|
-
end
|
106
|
-
|
107
|
-
def also_lbl
|
108
|
-
@lang == "en" ? @i18n.see_also : "<em>#{@i18n.see_also}</em>"
|
109
|
-
end
|
110
|
-
|
111
|
-
def sort_indexterms(terms, see, also)
|
112
|
-
index = extract_indexterms(terms)
|
113
|
-
index = extract_indexsee(index, see, :see)
|
114
|
-
index = extract_indexsee(index, also, :also)
|
115
|
-
index.keys.sort.each_with_object({}) do |k, v|
|
116
|
-
v[sortable(k)[0].upcase.transliterate] ||= {}
|
117
|
-
v[sortable(k)[0].upcase.transliterate][k] = index[k]
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def extract_indexsee(idx, terms, label)
|
122
|
-
terms.each_with_object(idx) do |t, v|
|
123
|
-
term = to_xml(t.at(ns("./primary"))&.children)
|
124
|
-
term2 = to_xml(t.at(ns("./secondary"))&.children)
|
125
|
-
term3 = to_xml(t.at(ns("./tertiary"))&.children)
|
126
|
-
v[term] ||= {}
|
127
|
-
v[term][term2] ||= {}
|
128
|
-
v[term][term2][term3] ||= {}
|
129
|
-
v[term][term2][term3][label] ||= []
|
130
|
-
v[term][term2][term3][label] << to_xml(t.at(ns("./target"))&.children)
|
131
|
-
t.remove
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def xml_encode_attr(str)
|
136
|
-
HTMLEntities.new.encode(str, :basic, :hexadecimal)
|
137
|
-
.gsub(/&#x([^;]+);/) { |_x| "&#x#{$1.upcase};" }
|
138
|
-
end
|
139
|
-
|
140
|
-
# attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
|
141
|
-
def extract_indexterms(terms)
|
142
|
-
terms.each_with_object({}) do |t, v|
|
143
|
-
term = to_xml(t.at(ns("./primary"))&.children)
|
144
|
-
term2 = to_xml(t.at(ns("./secondary"))&.children)
|
145
|
-
term3 = to_xml(t.at(ns("./tertiary"))&.children)
|
146
|
-
index2bookmark(t)
|
147
|
-
v[term] ||= {}
|
148
|
-
v[term][term2] ||= {}
|
149
|
-
v[term][term2][term3] ||= {}
|
150
|
-
v[term][term2][term3][:xref] ||= []
|
151
|
-
to = t["to"] ? "to='#{t['to']}' " : ""
|
152
|
-
v[term][term2][term3][:xref] << "<xref target='#{t['id']}' #{to}pagenumber='true'/>"
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def index2bookmark(node)
|
157
|
-
node.name = "bookmark"
|
158
|
-
node.children.each(&:remove)
|
159
|
-
node["id"] = "_#{UUIDTools::UUID.random_create}"
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|