metanorma-standoc 3.1.4 → 3.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/html/htmlstyle.css +27 -31
- data/lib/metanorma/standoc/base.rb +1 -1
- data/lib/metanorma/standoc/cleanup.rb +13 -1
- data/lib/metanorma/standoc/cleanup_boilerplate.rb +20 -11
- data/lib/metanorma/standoc/cleanup_section_names.rb +8 -8
- data/lib/metanorma/standoc/cleanup_terms_boilerplate.rb +5 -4
- data/lib/metanorma/standoc/converter.rb +2 -3
- data/lib/metanorma/standoc/front.rb +21 -60
- data/lib/metanorma/standoc/front_committee.rb +4 -2
- data/lib/metanorma/standoc/front_contributor.rb +12 -3
- data/lib/metanorma/standoc/front_ext.rb +50 -0
- data/lib/metanorma/standoc/isodoc.rng +44 -19
- data/lib/metanorma/standoc/macros.rb +1 -3
- data/lib/metanorma/standoc/ref.rb +14 -13
- data/lib/metanorma/standoc/ref_queue.rb +1 -1
- data/lib/metanorma/standoc/ref_sect.rb +9 -3
- data/lib/metanorma/standoc/regex.rb +6 -3
- data/lib/metanorma/standoc/utils.rb +16 -4
- data/lib/metanorma/standoc/validate.rb +1 -1
- data/lib/metanorma/standoc/validate_section.rb +12 -2
- data/lib/metanorma/standoc/validate_table.rb +3 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -0
- metadata +17 -12
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +0 -3
- data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +0 -3
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +0 -8
- data/lib/asciidoctor/standoc/macros_plantuml.rb +0 -2
- data/lib/metanorma/standoc/datamodel/attributes_table_preprocessor.rb +0 -57
- data/lib/metanorma/standoc/datamodel/diagram_preprocessor.rb +0 -103
- data/lib/metanorma/standoc/datamodel/plantuml_renderer.rb +0 -409
- data/lib/metanorma/standoc/macros_plantuml.rb +0 -143
- data/lib/metanorma/standoc/views/datamodel/model_representation.adoc.erb +0 -30
- data/lib/metanorma/standoc/views/datamodel/plantuml_representation.adoc.erb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bc2bfaaaf9871ba417d1d455867a0d67b6df3f219886aa290a6195583eacafc
|
4
|
+
data.tar.gz: 3f2a6511903492d4853334fc0780143a7b01d13e8d8f6d27630631208fc10b5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3485d18dfbe8b3474770f3e97d80652225539cca579b06cf1f0ca9a2ebe414c8ba1663a9b099eabecdea30cd3c630c2bebc54dfc1eb7dd954ffe89155d9d1da4
|
7
|
+
data.tar.gz: 8953152a143fbc28f9117e1f593b47e26f06b54eebd6498b71b98c5b5ea91a2240e41fae83af96d5f0a1ae618ebf0cb0d55b6f787db68d4ceb3509937493413c
|
@@ -145,16 +145,6 @@ div.document-stage-band, div.document-type-band {
|
|
145
145
|
background-color: #333333;
|
146
146
|
}
|
147
147
|
|
148
|
-
a.FootnoteRef + a.FootnoteRef::before {
|
149
|
-
content: ", ";
|
150
|
-
vertical-align: super;
|
151
|
-
}
|
152
|
-
|
153
|
-
a.TableFootnoteRef + a.TableFootnoteRef::before {
|
154
|
-
content: ", ";
|
155
|
-
vertical-align: super;
|
156
|
-
}
|
157
|
-
|
158
148
|
a.TableFootnoteRef, span.TableFootnoteRef,
|
159
149
|
a.FootnoteRef, span.FootnoteRef {
|
160
150
|
vertical-align: super;
|
@@ -477,11 +467,13 @@ body {
|
|
477
467
|
line-height: 1.4em;
|
478
468
|
color: #1d1d1d;
|
479
469
|
background-color: #ffffff;
|
480
|
-
font-weight: 400;
|
481
470
|
}
|
482
471
|
body main {
|
483
472
|
margin: 0 3em 0 6em;
|
484
473
|
}
|
474
|
+
body {
|
475
|
+
font-weight: 400;
|
476
|
+
}
|
485
477
|
body pre * {
|
486
478
|
font-family: {{bodyfont}} !important;
|
487
479
|
}
|
@@ -489,10 +481,6 @@ body pre * {
|
|
489
481
|
/*
|
490
482
|
2. Responsive navigation layout
|
491
483
|
*/
|
492
|
-
#toc, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) {
|
493
|
-
font-family: {{bodyfont}};
|
494
|
-
font-weight: 400;
|
495
|
-
}
|
496
484
|
#toc ul, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) ul {
|
497
485
|
margin: 0;
|
498
486
|
padding: 0;
|
@@ -544,6 +532,10 @@ body pre * {
|
|
544
532
|
color: black;
|
545
533
|
}
|
546
534
|
}
|
535
|
+
#toc, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) {
|
536
|
+
font-family: {{bodyfont}};
|
537
|
+
font-weight: 400;
|
538
|
+
}
|
547
539
|
@media screen and (max-width: 768px) {
|
548
540
|
#toc, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) {
|
549
541
|
padding: 0 1.5em;
|
@@ -632,12 +624,6 @@ body pre * {
|
|
632
624
|
}
|
633
625
|
}
|
634
626
|
|
635
|
-
div.figure {
|
636
|
-
line-height: 1.6em;
|
637
|
-
padding: 1.5em;
|
638
|
-
margin: 2em 0 1em 0;
|
639
|
-
overflow: auto;
|
640
|
-
}
|
641
627
|
div.figure .FigureTitle, div.figure .figure-title {
|
642
628
|
font-weight: 700;
|
643
629
|
font-size: 1em;
|
@@ -650,6 +636,12 @@ div.figure > img, div.figure > svg {
|
|
650
636
|
max-width: 100%;
|
651
637
|
height: auto;
|
652
638
|
}
|
639
|
+
div.figure {
|
640
|
+
line-height: 1.6em;
|
641
|
+
padding: 1.5em;
|
642
|
+
margin: 2em 0 1em 0;
|
643
|
+
overflow: auto;
|
644
|
+
}
|
653
645
|
|
654
646
|
/*
|
655
647
|
Document types + stages
|
@@ -969,6 +961,13 @@ p.Biblio, p.NormRef {
|
|
969
961
|
/*
|
970
962
|
3.6 Source Code + figures
|
971
963
|
*/
|
964
|
+
.figure .SourceTitle,
|
965
|
+
pre .SourceTitle,
|
966
|
+
.pseudocode .SourceTitle {
|
967
|
+
font-weight: 700;
|
968
|
+
font-size: 1em;
|
969
|
+
text-align: center;
|
970
|
+
}
|
972
971
|
.figure,
|
973
972
|
pre,
|
974
973
|
.pseudocode {
|
@@ -979,13 +978,6 @@ pre,
|
|
979
978
|
margin: 2em 0 1em 0;
|
980
979
|
overflow: auto;
|
981
980
|
}
|
982
|
-
.figure .SourceTitle,
|
983
|
-
pre .SourceTitle,
|
984
|
-
.pseudocode .SourceTitle {
|
985
|
-
font-weight: 700;
|
986
|
-
font-size: 1em;
|
987
|
-
text-align: center;
|
988
|
-
}
|
989
981
|
|
990
982
|
pre {
|
991
983
|
font-family: {{monospacefont}};
|
@@ -1032,12 +1024,14 @@ pre {
|
|
1032
1024
|
padding: 1.2em;
|
1033
1025
|
margin: 2em 0 1em 0;
|
1034
1026
|
text-align: left;
|
1035
|
-
color: #424242;
|
1036
|
-
padding-left: 2.7em;
|
1037
1027
|
}
|
1038
1028
|
.example p {
|
1039
1029
|
margin: 0;
|
1040
1030
|
}
|
1031
|
+
.example {
|
1032
|
+
color: #424242;
|
1033
|
+
padding-left: 2.7em;
|
1034
|
+
}
|
1041
1035
|
.example .example-title {
|
1042
1036
|
font-weight: 700;
|
1043
1037
|
text-transform: uppercase;
|
@@ -1318,7 +1312,6 @@ To top button
|
|
1318
1312
|
cursor: pointer;
|
1319
1313
|
padding: 10px 15px 10px 15px;
|
1320
1314
|
border-radius: 4px;
|
1321
|
-
text-transform: uppercase;
|
1322
1315
|
}
|
1323
1316
|
#myBtn:hover {
|
1324
1317
|
opacity: 1;
|
@@ -1328,6 +1321,9 @@ To top button
|
|
1328
1321
|
display: none;
|
1329
1322
|
}
|
1330
1323
|
}
|
1324
|
+
#myBtn {
|
1325
|
+
text-transform: uppercase;
|
1326
|
+
}
|
1331
1327
|
#myBtn a.anchorjs-link:hover {
|
1332
1328
|
background: none;
|
1333
1329
|
color: #485094;
|
@@ -139,7 +139,7 @@ module Metanorma
|
|
139
139
|
%w(presentation semantic).each do |t|
|
140
140
|
/^#{t}-metadata-/.match?(k) or next
|
141
141
|
k = k.sub(/^#{t}-metadata-/, "")
|
142
|
-
|
142
|
+
csv_split(v.gsub("&#", "&#"), ",", encode: false)&.each do |c|
|
143
143
|
ret << "<#{t}-metadata><#{k}>#{c}</#{k}></#{t}-metadata>"
|
144
144
|
end
|
145
145
|
end
|
@@ -83,7 +83,9 @@ module Metanorma
|
|
83
83
|
ext_contributor_cleanup(xmldoc) # feeds: bibdata_cleanup
|
84
84
|
ext_dochistory_cleanup(xmldoc) # feeds: bibdata_cleanup
|
85
85
|
bibdata_cleanup(xmldoc) # feeds: boilerplate_cleanup
|
86
|
-
boilerplate_cleanup(xmldoc) # feeds: xref_cleanup for new <<>>
|
86
|
+
boilerplate_cleanup(xmldoc) # feeds: xref_cleanup for new <<>>
|
87
|
+
# introduced, pres_metadata_cleanup
|
88
|
+
pres_metadata_cleanup(xmldoc)
|
87
89
|
xref_cleanup(xmldoc)
|
88
90
|
svgmap_cleanup(xmldoc) # feeds: img_cleanup
|
89
91
|
review_cleanup(xmldoc)
|
@@ -209,6 +211,16 @@ module Metanorma
|
|
209
211
|
ins = add_misc_container(xmldoc)
|
210
212
|
ins << @metadata_attrs
|
211
213
|
end
|
214
|
+
|
215
|
+
def pres_metadata_cleanup(xmldoc)
|
216
|
+
@isodoc ||= isodoc(@lang, @script, @locale)
|
217
|
+
isodoc_bibdata_parse(xmldoc)
|
218
|
+
xmldoc.xpath("//presentation-metadata/* | //semantic-metadata/*")
|
219
|
+
.each do |x|
|
220
|
+
/\{\{|\{%/.match?(x) or next
|
221
|
+
x.children = @isodoc.populate_template(to_xml(x.children), nil)
|
222
|
+
end
|
223
|
+
end
|
212
224
|
end
|
213
225
|
end
|
214
226
|
end
|
@@ -3,7 +3,7 @@ require_relative "cleanup_terms_boilerplate"
|
|
3
3
|
module Metanorma
|
4
4
|
module Standoc
|
5
5
|
module Cleanup
|
6
|
-
def norm_ref_preface(ref)
|
6
|
+
def norm_ref_preface(ref, isodoc)
|
7
7
|
ins = norm_ref_boilerplate_insert_location(ref)
|
8
8
|
ins2 = norm_ref_process_boilerplate_note(ref)
|
9
9
|
ins2 == :populated and return
|
@@ -12,7 +12,7 @@ module Metanorma
|
|
12
12
|
%w(references bibitem).include? e.name
|
13
13
|
end
|
14
14
|
pref = refs.empty? ? @i18n.norm_empty_pref : @i18n.norm_with_refs_pref
|
15
|
-
ins.next = boilerplate_snippet_convert(pref)
|
15
|
+
ins.next = boilerplate_snippet_convert(pref, isodoc)
|
16
16
|
end
|
17
17
|
|
18
18
|
def norm_ref_process_boilerplate_note(ref)
|
@@ -40,18 +40,27 @@ module Metanorma
|
|
40
40
|
"//bibliography/references[@normative = 'true'][not(@hidden)] | " \
|
41
41
|
"//bibliography/clause[.//references[@normative = 'true']]".freeze
|
42
42
|
|
43
|
+
def dup_with_namespace(elem)
|
44
|
+
ret = elem.dup
|
45
|
+
ret.add_namespace(nil, xml_namespace)
|
46
|
+
ret
|
47
|
+
end
|
48
|
+
|
43
49
|
def boilerplate_isodoc(xmldoc)
|
44
50
|
# prevent infinite recursion of asciidoc boilerplate processing
|
45
51
|
# in termdef_boilerplate_insert and initial_boilerplate
|
46
52
|
xmldoc.at("//metanorma-extension/semantic-metadata/" \
|
47
53
|
"headless[text() = 'true']") and return nil
|
48
|
-
x = xmldoc.dup
|
49
|
-
x.root.add_namespace(nil, xml_namespace)
|
50
|
-
xml = Nokogiri::XML(x.to_xml)
|
51
54
|
@isodoc ||= isodoc(@lang, @script, @locale)
|
55
|
+
isodoc_bibdata_parse(xmldoc)
|
56
|
+
@isodoc
|
57
|
+
end
|
58
|
+
|
59
|
+
def isodoc_bibdata_parse(xmldoc)
|
52
60
|
# initialise @isodoc.xrefs, for @isodoc.xrefs.info
|
61
|
+
x = dup_with_namespace(xmldoc.root)
|
62
|
+
xml = Nokogiri::XML(x.to_xml)
|
53
63
|
@isodoc.bibdata(xml) # do i18n
|
54
|
-
@isodoc
|
55
64
|
end
|
56
65
|
|
57
66
|
def unwrap_boilerplate_clauses(xmldoc, xpath)
|
@@ -71,7 +80,7 @@ module Metanorma
|
|
71
80
|
termdef_boilerplate_insert(xmldoc, isodoc)
|
72
81
|
unwrap_boilerplate_clauses(xmldoc, self.class::TERM_CLAUSE)
|
73
82
|
if f = xmldoc.at(self.class::NORM_REF)
|
74
|
-
norm_ref_preface(f)
|
83
|
+
norm_ref_preface(f, isodoc)
|
75
84
|
unwrap_boilerplate_clauses(f, ".")
|
76
85
|
end
|
77
86
|
initial_boilerplate(xmldoc, isodoc)
|
@@ -210,16 +219,16 @@ module Metanorma
|
|
210
219
|
/\.adoc(\.liquid)?$/.match?(file) or return ret
|
211
220
|
|
212
221
|
# Split content into macro and non-macro parts
|
213
|
-
parts = ret.split(/(#{ADOC_MACRO_PATTERN})/)
|
222
|
+
parts = ret.split(/(#{ADOC_MACRO_PATTERN})/o)
|
214
223
|
|
215
224
|
parts.map.with_index do |part, index|
|
216
|
-
if index.odd? &&
|
225
|
+
if index.odd? && valid_macro?(part)
|
217
226
|
# This is a macro - leave unchanged
|
218
227
|
part
|
219
228
|
else
|
220
229
|
# Not a macro - wrap {{ }} patterns
|
221
230
|
part.gsub(/(?<!\{)(\{\{[^{}]+\}\})(?!\})/,
|
222
|
-
|
231
|
+
"pass-format:metanorma[++\\1++]")
|
223
232
|
end
|
224
233
|
end.join
|
225
234
|
end
|
@@ -240,7 +249,7 @@ module Metanorma
|
|
240
249
|
|
241
250
|
private
|
242
251
|
|
243
|
-
def
|
252
|
+
def valid_macro?(text)
|
244
253
|
# Simple validation - does it look like a macro?
|
245
254
|
text.match?(/^\S+:[^\[]*\[.*\]$/)
|
246
255
|
end
|
@@ -51,9 +51,9 @@ module Metanorma
|
|
51
51
|
NO_SYMABBR = "[.//definitions[not(@type)]]".freeze
|
52
52
|
SYMABBR = "[.//definitions[@type = 'symbols']]" \
|
53
53
|
"[.//definitions[@type = 'abbreviated_terms']]".freeze
|
54
|
-
|
54
|
+
SYM_NO_ABBR = "[.//definitions[@type = 'symbols']]" \
|
55
55
|
"[not(.//definitions[@type = 'abbreviated_terms'])]".freeze
|
56
|
-
|
56
|
+
ABBR_NO_SYM = "[.//definitions[@type = 'abbreviated_terms']]" \
|
57
57
|
"[not(.//definitions[@type = 'symbols'])]".freeze
|
58
58
|
|
59
59
|
def section_names_terms_cleanup(xml)
|
@@ -81,9 +81,9 @@ module Metanorma
|
|
81
81
|
|
82
82
|
def section_names_terms1_cleanup(xml)
|
83
83
|
auto_name_terms(xml) or return
|
84
|
-
replace_title(xml, "//terms#{
|
84
|
+
replace_title(xml, "//terms#{SYM_NO_ABBR} | //clause[@type = 'terms']#{SYM_NO_ABBR}",
|
85
85
|
@i18n&.termsdefsymbols, true)
|
86
|
-
replace_title(xml, "//terms#{
|
86
|
+
replace_title(xml, "//terms#{ABBR_NO_SYM} | //clause[@type = 'terms']#{ABBR_NO_SYM}",
|
87
87
|
@i18n&.termsdefabbrev, true)
|
88
88
|
replace_title(xml, "//terms#{SYMABBR} | //clause[@type = 'terms']#{SYMABBR}",
|
89
89
|
@i18n&.termsdefsymbolsabbrev, true)
|
@@ -124,12 +124,12 @@ module Metanorma
|
|
124
124
|
unless acc[:parent] == :term # don't count Term > Term twice
|
125
125
|
:term
|
126
126
|
end
|
127
|
-
elsif hasterm && node.at("./self::*#{
|
128
|
-
elsif hasterm && node.at("./self::*#{
|
127
|
+
elsif hasterm && node.at("./self::*#{SYM_NO_ABBR}") then :tsna
|
128
|
+
elsif hasterm && node.at("./self::*#{ABBR_NO_SYM}") then :tans
|
129
129
|
elsif hasterm && node.at("./self::*#{SYMABBR}") then :tsa
|
130
130
|
elsif hasterm && node.at("./self::*#{NO_SYMABBR}") then :tnsa
|
131
|
-
elsif node.at("./self::*#{
|
132
|
-
elsif node.at("./self::*#{
|
131
|
+
elsif node.at("./self::*#{SYM_NO_ABBR}") then :sna
|
132
|
+
elsif node.at("./self::*#{ABBR_NO_SYM}") then :ans
|
133
133
|
elsif node.at("./self::*#{SYMABBR}") then :sa
|
134
134
|
elsif node.at("./self::*#{NO_SYMABBR}") then :nsa
|
135
135
|
elsif node.name == "definitions" # ignore
|
@@ -11,19 +11,20 @@ module Metanorma
|
|
11
11
|
e.gsub(/%(?=\p{P}|\p{Z}|$)/, sources || "??")
|
12
12
|
end
|
13
13
|
|
14
|
-
def boilerplate_snippet_convert(adoc)
|
15
|
-
|
14
|
+
def boilerplate_snippet_convert(adoc, isodoc)
|
15
|
+
b = isodoc.populate_template(adoc, nil)
|
16
|
+
ret = boilerplate_xml_cleanup(adoc2xml(b, backend.to_sym))
|
16
17
|
@i18n.l10n(ret.children.to_xml, @lang, @script)
|
17
18
|
end
|
18
19
|
|
19
20
|
def term_defs_boilerplate(div, source, term, _preface, isodoc)
|
20
21
|
verify_term_defs_source(source)
|
21
22
|
a = @i18n.term_def_boilerplate and
|
22
|
-
div.next = boilerplate_snippet_convert(a)
|
23
|
+
div.next = boilerplate_snippet_convert(a, isodoc)
|
23
24
|
a = if source.empty? && term.nil? then @i18n.no_terms_boilerplate
|
24
25
|
else term_defs_boilerplate_cont(source, term, isodoc)
|
25
26
|
end
|
26
|
-
a and div.next = boilerplate_snippet_convert(a)
|
27
|
+
a and div.next = boilerplate_snippet_convert(a, isodoc)
|
27
28
|
end
|
28
29
|
|
29
30
|
def verify_term_defs_source(source)
|
@@ -34,11 +34,11 @@ module Metanorma
|
|
34
34
|
block Metanorma::Plugin::Lutaml::LutamlGmlDictionaryBlock
|
35
35
|
block_macro Metanorma::Plugin::Lutaml::LutamlKlassTableBlockMacro
|
36
36
|
block_macro Metanorma::Plugin::Lutaml::LutamlEnumTableBlockMacro
|
37
|
+
block Metanorma::Plugin::Plantuml::BlockProcessor
|
38
|
+
block_macro Metanorma::Plugin::Plantuml::ImageBlockMacroProcessor
|
37
39
|
preprocessor Metanorma::Standoc::EmbedIncludeProcessor
|
38
40
|
preprocessor Metanorma::Standoc::LinkProtectPreprocessor
|
39
41
|
preprocessor Metanorma::Standoc::PassProtectPreprocessor
|
40
|
-
preprocessor Metanorma::Standoc::Datamodel::AttributesTablePreprocessor
|
41
|
-
preprocessor Metanorma::Standoc::Datamodel::DiagramPreprocessor
|
42
42
|
preprocessor Metanorma::Plugin::Lutaml::Json2TextPreprocessor
|
43
43
|
preprocessor Metanorma::Plugin::Lutaml::Yaml2TextPreprocessor
|
44
44
|
preprocessor Metanorma::Plugin::Lutaml::Data2TextPreprocessor
|
@@ -81,7 +81,6 @@ module Metanorma
|
|
81
81
|
inline_macro Metanorma::Standoc::SourceIncludeInlineMacro
|
82
82
|
block Metanorma::Standoc::ToDoAdmonitionBlock
|
83
83
|
block Metanorma::Standoc::EditorAdmonitionBlock
|
84
|
-
block Metanorma::Standoc::PlantUMLBlockMacro
|
85
84
|
block Metanorma::Standoc::PseudocodeBlockMacro
|
86
85
|
block_macro Metanorma::Standoc::ColumnBreakBlockMacro
|
87
86
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "date"
|
2
2
|
require "pathname"
|
3
3
|
require_relative "./front_contributor"
|
4
|
+
require_relative "./front_ext"
|
4
5
|
require "isoics"
|
5
6
|
|
6
7
|
module Metanorma
|
@@ -53,17 +54,6 @@ module Metanorma
|
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
|
-
def metadata_ics(node, xml)
|
57
|
-
ics = node.attr("library-ics")
|
58
|
-
ics&.split(/,\s*/)&.each do |i|
|
59
|
-
xml.ics do |elem|
|
60
|
-
elem.code i
|
61
|
-
icsdata = Isoics.fetch i
|
62
|
-
elem.text_ icsdata.description
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
57
|
def metadata_source(node, xml)
|
68
58
|
node.attr("uri") && xml.uri(node.attr("uri"))
|
69
59
|
%w(xml html pdf doc relaton).each do |t|
|
@@ -183,66 +173,37 @@ module Metanorma
|
|
183
173
|
end
|
184
174
|
end
|
185
175
|
|
186
|
-
def metadata_ext(node, ext)
|
187
|
-
metadata_doctype(node, ext)
|
188
|
-
metadata_subdoctype(node, ext)
|
189
|
-
metadata_flavor(node, ext)
|
190
|
-
metadata_ics(node, ext)
|
191
|
-
structured_id(node, ext)
|
192
|
-
metadata_coverpage_images(node, ext)
|
193
|
-
end
|
194
|
-
|
195
|
-
def structured_id(node, xml); end
|
196
|
-
|
197
|
-
def metadata_doctype(node, xml)
|
198
|
-
xml.doctype doctype(node)
|
199
|
-
end
|
200
|
-
|
201
|
-
def metadata_subdoctype(node, xml)
|
202
|
-
s = node.attr("docsubtype") and xml.subdoctype s
|
203
|
-
end
|
204
|
-
|
205
|
-
def metadata_flavor(_node, ext)
|
206
|
-
ext.flavor processor.new.asciidoctor_backend
|
207
|
-
end
|
208
|
-
|
209
176
|
def metadata_note(node, xml); end
|
210
177
|
|
211
178
|
def metadata_series(node, xml); end
|
212
179
|
|
213
180
|
def title(node, xml)
|
214
|
-
|
215
|
-
|
216
|
-
end
|
217
|
-
|
218
|
-
def title_english(node, xml)
|
219
|
-
["en"].each do |lang|
|
220
|
-
at = { language: lang, format: "text/plain" }
|
221
|
-
xml.title **attr_code(at) do |t|
|
222
|
-
title = Metanorma::Utils::asciidoc_sub(
|
223
|
-
node.attr("title") || node.attr("title-en") || node.attr("doctitle"),
|
224
|
-
)
|
225
|
-
t << title
|
226
|
-
end
|
227
|
-
end
|
181
|
+
title_main(node, xml)
|
182
|
+
title_other(node, xml)
|
228
183
|
end
|
229
184
|
|
230
|
-
|
185
|
+
# English plain title: :title: or implicit, typed as main
|
186
|
+
def title_main(node, xml)
|
187
|
+
title = node.attr("title") || node.attr("doctitle")
|
188
|
+
node.attr("title-en") and return
|
189
|
+
add_title_xml(xml, title, "en", "main")
|
190
|
+
end
|
191
|
+
|
192
|
+
def title_other(node, xml)
|
231
193
|
node.attributes.each do |k, v|
|
232
|
-
/^title-(?<
|
233
|
-
|
234
|
-
|
194
|
+
/^title-(?<remainder>.+)$/ =~ k or next
|
195
|
+
type, language = remainder.split("-", 2)
|
196
|
+
if language.nil?
|
197
|
+
language = type
|
198
|
+
type = "main"
|
199
|
+
end
|
200
|
+
add_title_xml(xml, v, language, type)
|
235
201
|
end
|
236
202
|
end
|
237
203
|
|
238
|
-
def
|
239
|
-
|
240
|
-
|
241
|
-
if a = node.attr(n)
|
242
|
-
xml.send n do |c|
|
243
|
-
a.split(",").each { |x| c.image src: x }
|
244
|
-
end
|
245
|
-
end
|
204
|
+
def add_title_xml(xml, content, language, type)
|
205
|
+
xml.title **attr_code(language: language, type: type) do |t|
|
206
|
+
t << Metanorma::Utils::asciidoc_sub(content)
|
246
207
|
end
|
247
208
|
end
|
248
209
|
end
|
@@ -90,11 +90,13 @@ module Metanorma
|
|
90
90
|
agency_abbrev: opts.dig(:agency_abbrev, i), abbr: opts[:abbr],
|
91
91
|
committee: opts[:committee], default_org: opts[:default_org])
|
92
92
|
end
|
93
|
-
|
93
|
+
if !opts_orig[:groups] || opts_orig[:groups].empty? then ret.first
|
94
|
+
else org_attrs_add_committees(node, ret, opts, opts_orig)
|
95
|
+
end
|
94
96
|
end
|
95
97
|
|
96
98
|
def org_attrs_add_committees(node, ret, opts, opts_orig)
|
97
|
-
opts_orig[:groups]
|
99
|
+
opts_orig[:groups].each_with_index do |g, i|
|
98
100
|
i.zero? and next
|
99
101
|
contributors_committees_pad_multiples(ret.first, node, g)
|
100
102
|
opts = committee_contrib_org_prep(node, g, nil, opts_orig)
|
@@ -5,13 +5,22 @@ module Metanorma
|
|
5
5
|
module Standoc
|
6
6
|
module Front
|
7
7
|
def metadata_author(node, xml)
|
8
|
-
|
9
|
-
{ source: ["publisher", "pub"], role: "author",
|
10
|
-
default: default_publisher })
|
8
|
+
org_author(node, xml)
|
11
9
|
personal_author(node, xml)
|
12
10
|
committee_contributors(node, xml, default_publisher, {})
|
13
11
|
end
|
14
12
|
|
13
|
+
def org_author(node, xml)
|
14
|
+
if node.attr("corporate-author")
|
15
|
+
org_contributor(node, xml, { source: ["corporate-author"],
|
16
|
+
role: "author" })
|
17
|
+
else
|
18
|
+
org_contributor(node, xml,
|
19
|
+
{ source: ["publisher", "pub"], role: "author",
|
20
|
+
default: default_publisher })
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
15
24
|
def personal_author(node, xml)
|
16
25
|
(node.attr("fullname") || node.attr("surname")) and
|
17
26
|
personal_author1(node, xml, "")
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Metanorma
|
2
|
+
module Standoc
|
3
|
+
module Front
|
4
|
+
def metadata_ics(node, xml)
|
5
|
+
ics = node.attr("library-ics")
|
6
|
+
ics&.split(/,\s*/)&.each do |i|
|
7
|
+
xml.ics do |elem|
|
8
|
+
elem.code i
|
9
|
+
icsdata = Isoics.fetch i
|
10
|
+
elem.text_ icsdata.description
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def metadata_ext(node, ext)
|
16
|
+
metadata_doctype(node, ext)
|
17
|
+
metadata_subdoctype(node, ext)
|
18
|
+
metadata_flavor(node, ext)
|
19
|
+
metadata_ics(node, ext)
|
20
|
+
structured_id(node, ext)
|
21
|
+
metadata_coverpage_images(node, ext)
|
22
|
+
end
|
23
|
+
|
24
|
+
def structured_id(node, xml); end
|
25
|
+
|
26
|
+
def metadata_doctype(node, xml)
|
27
|
+
xml.doctype doctype(node)
|
28
|
+
end
|
29
|
+
|
30
|
+
def metadata_subdoctype(node, xml)
|
31
|
+
s = node.attr("docsubtype") and xml.subdoctype s
|
32
|
+
end
|
33
|
+
|
34
|
+
def metadata_flavor(_node, ext)
|
35
|
+
ext.flavor processor.new.asciidoctor_backend
|
36
|
+
end
|
37
|
+
|
38
|
+
def metadata_coverpage_images(node, xml)
|
39
|
+
%w(coverpage-image innercoverpage-image tocside-image
|
40
|
+
backpage-image).each do |n|
|
41
|
+
if a = node.attr(n)
|
42
|
+
xml.send n do |c|
|
43
|
+
a.split(",").each { |x| c.image src: x }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|