metanorma-generic 2.5.2 → 2.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -3
- data/lib/asciidoctor/generic/deprecated.rb +4 -2
- data/lib/asciidoctor/generic/front.rb +0 -1
- data/lib/isodoc/generic.rb +0 -1
- data/lib/metanorma/generic/basicdoc.rng +56 -37
- data/lib/metanorma/generic/biblio.rng +10 -1
- data/lib/metanorma/generic/converter.rb +2 -1
- data/lib/metanorma/generic/front.rb +7 -11
- data/lib/metanorma/generic/isodoc.rng +52 -1
- data/lib/metanorma/generic/processor.rb +14 -11
- data/lib/metanorma/generic/version.rb +1 -1
- data/lib/metanorma/generic.rb +20 -15
- data/metanorma-generic.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa1e23dc1c6486303bd0801b968beb731f04ba5677ecaf740baa01594303ffb1
|
4
|
+
data.tar.gz: fcfdd41ee9495755c51efe57c7ef8502e1918b7b139fe22a2cf0f6d0c8e50fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f45b93eaacb3d8feba3ad4f73ff2a64758e2160d9836299c1308bbf9d5dfa22585835653ab21e352dc8db32372ef2510ee7f6a536c322adc9d1e91b17863e12
|
7
|
+
data.tar.gz: 6bfc7f42360a191e91000a9550ec234b85836e95aec83ed1386ce2998c76540f2b94664c3debf2e76789ac4e73e16c700b76e0b44238537abfbb214b50f3229d
|
data/Gemfile
CHANGED
@@ -4,8 +4,12 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
6
6
|
|
7
|
-
|
7
|
+
group :development, :test do
|
8
|
+
gem "rspec"
|
9
|
+
end
|
8
10
|
|
9
|
-
if File.exist?
|
10
|
-
eval File.read(
|
11
|
+
if File.exist? "Gemfile.devel"
|
12
|
+
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
11
13
|
end
|
14
|
+
|
15
|
+
gemspec
|
@@ -1,5 +1,7 @@
|
|
1
|
-
warn
|
1
|
+
warn <<~WARN
|
2
|
+
Please replace your references to Asciidoctor::Generic with Metanorma::Generic and your instances of require 'asciidoctor/generic' with require 'metanorma/generic'
|
3
|
+
WARN
|
2
4
|
|
3
|
-
exit 127 if ENV[
|
5
|
+
exit 127 if ENV["METANORMA_DEPRECATION_FAIL"]
|
4
6
|
|
5
7
|
Asciidoctor::Generic = Metanorma::Generic unless defined? Asciidoctor::Generic
|
data/lib/isodoc/generic.rb
CHANGED
@@ -346,6 +346,8 @@
|
|
346
346
|
<ref name="keyword"/>
|
347
347
|
<ref name="xref"/>
|
348
348
|
<ref name="hyperlink"/>
|
349
|
+
<ref name="index"/>
|
350
|
+
<ref name="index-xref"/>
|
349
351
|
</choice>
|
350
352
|
</oneOrMore>
|
351
353
|
</element>
|
@@ -623,6 +625,8 @@
|
|
623
625
|
<ref name="eref"/>
|
624
626
|
<ref name="xref"/>
|
625
627
|
<ref name="hyperlink"/>
|
628
|
+
<ref name="index"/>
|
629
|
+
<ref name="index-xref"/>
|
626
630
|
</choice>
|
627
631
|
</zeroOrMore>
|
628
632
|
</element>
|
@@ -636,6 +640,8 @@
|
|
636
640
|
<ref name="eref"/>
|
637
641
|
<ref name="xref"/>
|
638
642
|
<ref name="hyperlink"/>
|
643
|
+
<ref name="index"/>
|
644
|
+
<ref name="index-xref"/>
|
639
645
|
</choice>
|
640
646
|
</zeroOrMore>
|
641
647
|
</element>
|
@@ -648,6 +654,8 @@
|
|
648
654
|
<ref name="eref"/>
|
649
655
|
<ref name="xref"/>
|
650
656
|
<ref name="hyperlink"/>
|
657
|
+
<ref name="index"/>
|
658
|
+
<ref name="index-xref"/>
|
651
659
|
</choice>
|
652
660
|
</zeroOrMore>
|
653
661
|
</element>
|
@@ -655,7 +663,11 @@
|
|
655
663
|
<define name="keyword">
|
656
664
|
<element name="keyword">
|
657
665
|
<zeroOrMore>
|
658
|
-
<
|
666
|
+
<choice>
|
667
|
+
<ref name="PureTextElement"/>
|
668
|
+
<ref name="index"/>
|
669
|
+
<ref name="index-xref"/>
|
670
|
+
</choice>
|
659
671
|
</zeroOrMore>
|
660
672
|
</element>
|
661
673
|
</define>
|
@@ -676,7 +688,11 @@
|
|
676
688
|
<define name="strike">
|
677
689
|
<element name="strike">
|
678
690
|
<zeroOrMore>
|
679
|
-
<
|
691
|
+
<choice>
|
692
|
+
<ref name="PureTextElement"/>
|
693
|
+
<ref name="index"/>
|
694
|
+
<ref name="index-xref"/>
|
695
|
+
</choice>
|
680
696
|
</zeroOrMore>
|
681
697
|
</element>
|
682
698
|
</define>
|
@@ -898,44 +914,47 @@
|
|
898
914
|
-->
|
899
915
|
<define name="image">
|
900
916
|
<element name="image">
|
901
|
-
<
|
902
|
-
|
917
|
+
<ref name="Image"/>
|
918
|
+
</element>
|
919
|
+
</define>
|
920
|
+
<define name="Image">
|
921
|
+
<attribute name="id">
|
922
|
+
<data type="ID"/>
|
923
|
+
</attribute>
|
924
|
+
<attribute name="src">
|
925
|
+
<data type="anyURI"/>
|
926
|
+
</attribute>
|
927
|
+
<attribute name="mimetype"/>
|
928
|
+
<optional>
|
929
|
+
<attribute name="filename"/>
|
930
|
+
</optional>
|
931
|
+
<optional>
|
932
|
+
<attribute name="width">
|
933
|
+
<choice>
|
934
|
+
<data type="int"/>
|
935
|
+
<value>auto</value>
|
936
|
+
</choice>
|
903
937
|
</attribute>
|
904
|
-
|
938
|
+
</optional>
|
939
|
+
<optional>
|
940
|
+
<attribute name="height">
|
941
|
+
<choice>
|
942
|
+
<data type="int"/>
|
943
|
+
<value>auto</value>
|
944
|
+
</choice>
|
945
|
+
</attribute>
|
946
|
+
</optional>
|
947
|
+
<optional>
|
948
|
+
<attribute name="alt"/>
|
949
|
+
</optional>
|
950
|
+
<optional>
|
951
|
+
<attribute name="title"/>
|
952
|
+
</optional>
|
953
|
+
<optional>
|
954
|
+
<attribute name="longdesc">
|
905
955
|
<data type="anyURI"/>
|
906
956
|
</attribute>
|
907
|
-
|
908
|
-
<optional>
|
909
|
-
<attribute name="filename"/>
|
910
|
-
</optional>
|
911
|
-
<optional>
|
912
|
-
<attribute name="width">
|
913
|
-
<choice>
|
914
|
-
<data type="int"/>
|
915
|
-
<value>auto</value>
|
916
|
-
</choice>
|
917
|
-
</attribute>
|
918
|
-
</optional>
|
919
|
-
<optional>
|
920
|
-
<attribute name="height">
|
921
|
-
<choice>
|
922
|
-
<data type="int"/>
|
923
|
-
<value>auto</value>
|
924
|
-
</choice>
|
925
|
-
</attribute>
|
926
|
-
</optional>
|
927
|
-
<optional>
|
928
|
-
<attribute name="alt"/>
|
929
|
-
</optional>
|
930
|
-
<optional>
|
931
|
-
<attribute name="title"/>
|
932
|
-
</optional>
|
933
|
-
<optional>
|
934
|
-
<attribute name="longdesc">
|
935
|
-
<data type="anyURI"/>
|
936
|
-
</attribute>
|
937
|
-
</optional>
|
938
|
-
</element>
|
957
|
+
</optional>
|
939
958
|
</define>
|
940
959
|
<define name="video">
|
941
960
|
<element name="video">
|
@@ -348,6 +348,9 @@
|
|
348
348
|
<zeroOrMore>
|
349
349
|
<ref name="contact"/>
|
350
350
|
</zeroOrMore>
|
351
|
+
<optional>
|
352
|
+
<ref name="logo"/>
|
353
|
+
</optional>
|
351
354
|
</element>
|
352
355
|
</define>
|
353
356
|
<define name="orgname">
|
@@ -366,6 +369,11 @@
|
|
366
369
|
</choice>
|
367
370
|
</element>
|
368
371
|
</define>
|
372
|
+
<define name="logo">
|
373
|
+
<element name="logo">
|
374
|
+
<ref name="image"/>
|
375
|
+
</element>
|
376
|
+
</define>
|
369
377
|
<define name="NameWithVariants">
|
370
378
|
<element name="primary">
|
371
379
|
<ref name="LocalizedString"/>
|
@@ -942,6 +950,7 @@
|
|
942
950
|
<value>obsoleted</value>
|
943
951
|
<value>confirmed</value>
|
944
952
|
<value>updated</value>
|
953
|
+
<value>corrected</value>
|
945
954
|
<value>issued</value>
|
946
955
|
<value>transmitted</value>
|
947
956
|
<value>copied</value>
|
@@ -1283,7 +1292,7 @@
|
|
1283
1292
|
<value>mergedInto</value>
|
1284
1293
|
<value>splits</value>
|
1285
1294
|
<value>splitInto</value>
|
1286
|
-
<value>
|
1295
|
+
<value>instanceOf</value>
|
1287
1296
|
<value>hasInstance</value>
|
1288
1297
|
<value>exemplarOf</value>
|
1289
1298
|
<value>hasExemplar</value>
|
@@ -141,7 +141,8 @@ module Metanorma
|
|
141
141
|
|
142
142
|
def presentation_xml_converter(node)
|
143
143
|
IsoDoc::Generic::PresentationXMLConvert
|
144
|
-
.new(html_extract_attributes(node)
|
144
|
+
.new(html_extract_attributes(node)
|
145
|
+
.merge(output_formats: ::Metanorma::Generic::Processor.new.output_formats))
|
145
146
|
end
|
146
147
|
|
147
148
|
alias_method :pdf_converter, :html_converter
|
@@ -22,8 +22,7 @@ module Metanorma
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def metadata_committee(node, xml)
|
25
|
-
|
26
|
-
|
25
|
+
node.attr("committee") or return
|
27
26
|
xml.editorialgroup do |a|
|
28
27
|
a.committee node.attr("committee"),
|
29
28
|
**attr_code(type: node.attr("committee-type"))
|
@@ -73,8 +72,7 @@ module Metanorma
|
|
73
72
|
|
74
73
|
def metadata_ext_hash(node, ext, hash)
|
75
74
|
hash.each do |k, v|
|
76
|
-
|
77
|
-
|
75
|
+
EXT_STRUCT.include?(k) || (!v.is_a?(Hash) && !node.attr(k)) and next
|
78
76
|
if v.is_a?(Hash) && v["_list"]
|
79
77
|
csv_split(node.attr(k), ",").each do |val|
|
80
78
|
metadata_ext_hash1(k, val, ext, v, node)
|
@@ -86,13 +84,11 @@ module Metanorma
|
|
86
84
|
end
|
87
85
|
|
88
86
|
def metadata_ext_hash1(key, value, ext, hash, node)
|
89
|
-
|
90
|
-
|
91
|
-
is_hash = hash.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
name = hash.is_a?(Hash) ? (hash["_output"] || key) : key
|
87
|
+
h = hash.is_a?(Hash)
|
88
|
+
h && hash["_attribute"] and return
|
89
|
+
is_hash = h && !hash.keys.reject { |n| EXT_STRUCT.include?(n) }.empty?
|
90
|
+
!is_hash && (value.nil? || value.empty?) and return
|
91
|
+
name = h ? (hash["_output"] || key) : key
|
96
92
|
ext.send name, **attr_code(metadata_ext_attrs(hash, node)) do |e|
|
97
93
|
is_hash ? metadata_ext_hash(node, e, hash) : (e << value)
|
98
94
|
end
|
@@ -17,7 +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.
|
20
|
+
<!-- VERSION v1.2.8 -->
|
21
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">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -485,6 +485,8 @@
|
|
485
485
|
<choice>
|
486
486
|
<text/>
|
487
487
|
<ref name="callout"/>
|
488
|
+
<ref name="xref"/>
|
489
|
+
<ref name="eref"/>
|
488
490
|
</choice>
|
489
491
|
</oneOrMore>
|
490
492
|
<zeroOrMore>
|
@@ -865,6 +867,7 @@
|
|
865
867
|
<ref name="PureTextElement"/>
|
866
868
|
<ref name="stem"/>
|
867
869
|
<ref name="index"/>
|
870
|
+
<ref name="index-xref"/>
|
868
871
|
<ref name="eref"/>
|
869
872
|
<ref name="erefstack"/>
|
870
873
|
<ref name="xref"/>
|
@@ -880,6 +883,7 @@
|
|
880
883
|
<ref name="PureTextElement"/>
|
881
884
|
<ref name="stem"/>
|
882
885
|
<ref name="index"/>
|
886
|
+
<ref name="index-xref"/>
|
883
887
|
<ref name="eref"/>
|
884
888
|
<ref name="erefstack"/>
|
885
889
|
<ref name="xref"/>
|
@@ -894,6 +898,7 @@
|
|
894
898
|
<choice>
|
895
899
|
<ref name="PureTextElement"/>
|
896
900
|
<ref name="index"/>
|
901
|
+
<ref name="index-xref"/>
|
897
902
|
<ref name="eref"/>
|
898
903
|
<ref name="erefstack"/>
|
899
904
|
<ref name="xref"/>
|
@@ -908,6 +913,7 @@
|
|
908
913
|
<choice>
|
909
914
|
<ref name="PureTextElement"/>
|
910
915
|
<ref name="index"/>
|
916
|
+
<ref name="index-xref"/>
|
911
917
|
</choice>
|
912
918
|
</zeroOrMore>
|
913
919
|
</element>
|
@@ -918,6 +924,7 @@
|
|
918
924
|
<choice>
|
919
925
|
<ref name="PureTextElement"/>
|
920
926
|
<ref name="index"/>
|
927
|
+
<ref name="index-xref"/>
|
921
928
|
</choice>
|
922
929
|
</zeroOrMore>
|
923
930
|
</element>
|
@@ -928,6 +935,7 @@
|
|
928
935
|
<choice>
|
929
936
|
<ref name="PureTextElement"/>
|
930
937
|
<ref name="index"/>
|
938
|
+
<ref name="index-xref"/>
|
931
939
|
</choice>
|
932
940
|
</zeroOrMore>
|
933
941
|
</element>
|
@@ -938,6 +946,7 @@
|
|
938
946
|
<choice>
|
939
947
|
<ref name="PureTextElement"/>
|
940
948
|
<ref name="index"/>
|
949
|
+
<ref name="index-xref"/>
|
941
950
|
</choice>
|
942
951
|
</zeroOrMore>
|
943
952
|
</element>
|
@@ -1004,6 +1013,14 @@
|
|
1004
1013
|
</oneOrMore>
|
1005
1014
|
</element>
|
1006
1015
|
</define>
|
1016
|
+
<define name="BasicBlock" combine="choice">
|
1017
|
+
<ref name="columnbreak"/>
|
1018
|
+
</define>
|
1019
|
+
<define name="columnbreak">
|
1020
|
+
<element name="columnbreak">
|
1021
|
+
<empty/>
|
1022
|
+
</element>
|
1023
|
+
</define>
|
1007
1024
|
<define name="MultilingualRenderingType">
|
1008
1025
|
<choice>
|
1009
1026
|
<value>common</value>
|
@@ -1037,6 +1054,17 @@
|
|
1037
1054
|
<ref name="date_inline"/>
|
1038
1055
|
</choice>
|
1039
1056
|
</define>
|
1057
|
+
<define name="PureTextElement" combine="choice">
|
1058
|
+
<ref name="passthrough_inline"/>
|
1059
|
+
</define>
|
1060
|
+
<define name="passthrough_inline">
|
1061
|
+
<element name="passthrough">
|
1062
|
+
<optional>
|
1063
|
+
<attribute name="formats"/>
|
1064
|
+
</optional>
|
1065
|
+
<text/>
|
1066
|
+
</element>
|
1067
|
+
</define>
|
1040
1068
|
<define name="add">
|
1041
1069
|
<element name="add">
|
1042
1070
|
<choice>
|
@@ -1047,6 +1075,8 @@
|
|
1047
1075
|
<ref name="keyword"/>
|
1048
1076
|
<ref name="xref"/>
|
1049
1077
|
<ref name="hyperlink"/>
|
1078
|
+
<ref name="index"/>
|
1079
|
+
<ref name="index-xref"/>
|
1050
1080
|
</choice>
|
1051
1081
|
</element>
|
1052
1082
|
</define>
|
@@ -1060,6 +1090,8 @@
|
|
1060
1090
|
<ref name="keyword"/>
|
1061
1091
|
<ref name="xref"/>
|
1062
1092
|
<ref name="hyperlink"/>
|
1093
|
+
<ref name="index"/>
|
1094
|
+
<ref name="index-xref"/>
|
1063
1095
|
</choice>
|
1064
1096
|
</element>
|
1065
1097
|
</define>
|
@@ -1071,6 +1103,9 @@
|
|
1071
1103
|
<optional>
|
1072
1104
|
<attribute name="style"/>
|
1073
1105
|
</optional>
|
1106
|
+
<optional>
|
1107
|
+
<attribute name="custom-charset"/>
|
1108
|
+
</optional>
|
1074
1109
|
<oneOrMore>
|
1075
1110
|
<ref name="TextElement"/>
|
1076
1111
|
</oneOrMore>
|
@@ -1126,6 +1161,8 @@
|
|
1126
1161
|
<choice>
|
1127
1162
|
<ref name="PureTextElement"/>
|
1128
1163
|
<ref name="stem"/>
|
1164
|
+
<ref name="index"/>
|
1165
|
+
<ref name="index-xref"/>
|
1129
1166
|
</choice>
|
1130
1167
|
</zeroOrMore>
|
1131
1168
|
</element>
|
@@ -1136,6 +1173,8 @@
|
|
1136
1173
|
<choice>
|
1137
1174
|
<ref name="PureTextElement"/>
|
1138
1175
|
<ref name="stem"/>
|
1176
|
+
<ref name="index"/>
|
1177
|
+
<ref name="index-xref"/>
|
1139
1178
|
</choice>
|
1140
1179
|
</zeroOrMore>
|
1141
1180
|
</element>
|
@@ -1369,6 +1408,9 @@
|
|
1369
1408
|
<optional>
|
1370
1409
|
<attribute name="number"/>
|
1371
1410
|
</optional>
|
1411
|
+
<optional>
|
1412
|
+
<attribute name="branch-number"/>
|
1413
|
+
</optional>
|
1372
1414
|
<optional>
|
1373
1415
|
<attribute name="obligation">
|
1374
1416
|
<choice>
|
@@ -1592,6 +1634,9 @@
|
|
1592
1634
|
<optional>
|
1593
1635
|
<attribute name="number"/>
|
1594
1636
|
</optional>
|
1637
|
+
<optional>
|
1638
|
+
<attribute name="branch-number"/>
|
1639
|
+
</optional>
|
1595
1640
|
<optional>
|
1596
1641
|
<attribute name="type"/>
|
1597
1642
|
</optional>
|
@@ -1643,6 +1688,9 @@
|
|
1643
1688
|
<optional>
|
1644
1689
|
<attribute name="number"/>
|
1645
1690
|
</optional>
|
1691
|
+
<optional>
|
1692
|
+
<attribute name="branch-number"/>
|
1693
|
+
</optional>
|
1646
1694
|
<optional>
|
1647
1695
|
<ref name="section-title"/>
|
1648
1696
|
</optional>
|
@@ -1740,6 +1788,9 @@
|
|
1740
1788
|
<optional>
|
1741
1789
|
<attribute name="number"/>
|
1742
1790
|
</optional>
|
1791
|
+
<optional>
|
1792
|
+
<attribute name="branch-number"/>
|
1793
|
+
</optional>
|
1743
1794
|
<optional>
|
1744
1795
|
<attribute name="obligation">
|
1745
1796
|
<choice>
|
@@ -7,10 +7,11 @@ module Metanorma
|
|
7
7
|
Metanorma::Generic.configuration
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize
|
11
|
-
|
10
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
11
|
+
n = configuration&.metanorma_name&.to_sym
|
12
|
+
@short = n || :generic
|
12
13
|
@input_format = :asciidoc
|
13
|
-
@asciidoctor_backend =
|
14
|
+
@asciidoctor_backend = n || :generic
|
14
15
|
end
|
15
16
|
|
16
17
|
def output_formats
|
@@ -32,22 +33,24 @@ module Metanorma
|
|
32
33
|
ulstyle olstyle htmlstylesheet-override sectionsplit
|
33
34
|
wordstylesheet-override).each_with_object({}) do |w, acc|
|
34
35
|
m = /\n:#{w}: ([^\n]+)\n/.match(head) or next
|
35
|
-
acc[w.sub(
|
36
|
+
acc[w.sub("-", "_").to_sym] = m[1]
|
36
37
|
end
|
37
38
|
super.merge(ret)
|
38
39
|
end
|
39
40
|
|
40
|
-
def output(isodoc_node, inname, outname, format, options={})
|
41
|
+
def output(isodoc_node, inname, outname, format, options = {})
|
42
|
+
options_preprocess(options)
|
41
43
|
case format
|
42
44
|
when :html
|
43
|
-
IsoDoc::Generic::HtmlConvert.new(options)
|
45
|
+
IsoDoc::Generic::HtmlConvert.new(options)
|
46
|
+
.convert(inname, isodoc_node, nil, outname)
|
44
47
|
when :doc
|
45
|
-
IsoDoc::Generic::WordConvert.new(options)
|
48
|
+
IsoDoc::Generic::WordConvert.new(options)
|
49
|
+
.convert(inname, isodoc_node, nil, outname)
|
46
50
|
when :presentation
|
47
|
-
IsoDoc::Generic::PresentationXMLConvert.new(options)
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
+
IsoDoc::Generic::PresentationXMLConvert.new(options)
|
52
|
+
.convert(inname, isodoc_node, nil, outname)
|
53
|
+
else super end
|
51
54
|
end
|
52
55
|
end
|
53
56
|
end
|
data/lib/metanorma/generic.rb
CHANGED
@@ -88,6 +88,10 @@ module Metanorma
|
|
88
88
|
self.organization_name_short ||= ORGANIZATION_NAME_SHORT
|
89
89
|
self.organization_name_long ||= ORGANIZATION_NAME_LONG
|
90
90
|
self.document_namespace ||= DOCUMENT_NAMESPACE
|
91
|
+
default_titles
|
92
|
+
end
|
93
|
+
|
94
|
+
def default_titles
|
91
95
|
self.termsdefs_titles ||=
|
92
96
|
["Terms and definitions", "Terms, definitions, symbols and abbreviated terms",
|
93
97
|
"Terms, definitions, symbols and abbreviations", "Terms, definitions and symbols",
|
@@ -101,23 +105,26 @@ module Metanorma
|
|
101
105
|
end
|
102
106
|
|
103
107
|
def set_default_values_from_yaml_file(config_file)
|
108
|
+
root_path, default_config_options =
|
109
|
+
set_default_values_from_yaml_file_prep(config_file)
|
110
|
+
CONFIG_ATTRS.each do |attr_name|
|
111
|
+
value = default_config_options[attr_name.to_s]
|
112
|
+
value && filepath_attrs.include?(attr_name) and
|
113
|
+
value = absolute_path(value, root_path)
|
114
|
+
instance_variable_set("@#{attr_name}", value)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def set_default_values_from_yaml_file_prep(config_file)
|
104
119
|
root_path = File.dirname(self.class::_file || __FILE__)
|
105
120
|
default_config_options =
|
106
121
|
YAML.safe_load(File.read(config_file, encoding: "UTF-8"))
|
107
|
-
|
122
|
+
default_config_options["doctypes"].is_a? Array and
|
108
123
|
default_config_options["doctypes"] =
|
109
124
|
default_config_options["doctypes"].each_with_object({}) do |k, m|
|
110
125
|
m[k] = nil
|
111
126
|
end
|
112
|
-
|
113
|
-
CONFIG_ATTRS.each do |attr_name|
|
114
|
-
value = default_config_options[attr_name.to_s]
|
115
|
-
if value && filepath_attrs.include?(attr_name)
|
116
|
-
value = absolute_path(value, root_path)
|
117
|
-
end
|
118
|
-
|
119
|
-
instance_variable_set("@#{attr_name}", value)
|
120
|
-
end
|
127
|
+
[root_path, default_config_options]
|
121
128
|
end
|
122
129
|
|
123
130
|
def blank?(val)
|
@@ -132,15 +139,13 @@ module Metanorma
|
|
132
139
|
end
|
133
140
|
elsif value.is_a?(String) && !value.empty?
|
134
141
|
File.join(root_path, "..", "..", value)
|
135
|
-
else
|
136
|
-
value
|
142
|
+
else value
|
137
143
|
end
|
138
144
|
end
|
139
145
|
|
140
146
|
def absolute_path1(hash, pref)
|
141
|
-
hash.reject { |_k, v| blank?(v) }
|
142
|
-
|
143
|
-
g[k] = absolute_path(v, pref)
|
147
|
+
hash.reject { |_k, v| blank?(v) }.transform_values do |v|
|
148
|
+
absolute_path(v, pref)
|
144
149
|
end
|
145
150
|
end
|
146
151
|
end
|
data/metanorma-generic.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
29
29
|
|
30
30
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
31
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
31
|
+
spec.add_dependency "metanorma-standoc", "~> 2.7.0"
|
32
32
|
spec.add_dependency "ruby-jing"
|
33
33
|
|
34
34
|
spec.add_development_dependency "debug"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-generic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.4
|
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-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ruby-jing
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|