metanorma-bipm 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.rubocop.yml +0 -2
- data/Gemfile +2 -2
- data/Rakefile +2 -2
- data/lib/asciidoctor/bipm/converter.rb +7 -0
- data/lib/asciidoctor/bipm/isodoc.rng +174 -0
- data/lib/isodoc/bipm/base_convert.rb +25 -11
- data/lib/isodoc/bipm/bipm.brochure.xsl +65 -0
- data/lib/isodoc/bipm/bipm.guide.xsl +65 -0
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +65 -0
- data/lib/isodoc/bipm/bipm.rapport.xsl +65 -0
- data/lib/isodoc/bipm/i18n-en.yaml +2 -0
- data/lib/isodoc/bipm/i18n-fr.yaml +2 -0
- data/lib/isodoc/bipm/index.rb +20 -16
- data/lib/isodoc/bipm/init.rb +1 -2
- data/lib/isodoc/bipm/jcgm.standard.xsl +74 -1
- data/lib/isodoc/bipm/presentation_xml_convert.rb +93 -34
- data/lib/isodoc/bipm/xref.rb +30 -7
- data/lib/metanorma-bipm.rb +4 -4
- data/lib/metanorma/bipm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc4887a20e51de45b5d3caaaf643031ae87fc6e1856a52dc686a419ef6927f44
|
4
|
+
data.tar.gz: 72c3c2058fd5f61dc26e7c3f911c595e095acd69bca7aea3a998073092c18d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1030c749fb1377c3c187b910c00569f986060dfe61e76f76089d67b471a85127b1166a702dc8ea494a1b98d1e666031ac9fcc80b8e469ee796f9f81a425152e
|
7
|
+
data.tar.gz: 28478e4d92e1978c3e5f1ac86162ddeccfd581949bea1694fe5b82e9b368c74907841ddf81eaa9000a9f487a1fcdf80a53007ea63ef2d05e0038dfd7abbf2da0
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -6,6 +6,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}" }
|
|
6
6
|
|
7
7
|
gemspec
|
8
8
|
|
9
|
-
if File.exist?
|
10
|
-
eval File.read(
|
9
|
+
if File.exist? "Gemfile.devel"
|
10
|
+
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
11
11
|
end
|
data/Rakefile
CHANGED
@@ -138,6 +138,13 @@ module Asciidoctor
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
+
def sectiontype(node, level = true)
|
142
|
+
ret = sectiontype1(node)
|
143
|
+
return ret if ret == "terms and definitions"
|
144
|
+
|
145
|
+
super
|
146
|
+
end
|
147
|
+
|
141
148
|
def inline_anchor_xref_attrs(node)
|
142
149
|
flags = %w(pagenumber nosee nopage).each_with_object({}) do |w, m|
|
143
150
|
if /#{w}%/.match?(node.text)
|
@@ -876,6 +876,18 @@
|
|
876
876
|
</zeroOrMore>
|
877
877
|
</element>
|
878
878
|
</define>
|
879
|
+
<define name="pagebreak">
|
880
|
+
<element name="pagebreak">
|
881
|
+
<optional>
|
882
|
+
<attribute name="orientation">
|
883
|
+
<choice>
|
884
|
+
<value>landscape</value>
|
885
|
+
<value>portrait</value>
|
886
|
+
</choice>
|
887
|
+
</attribute>
|
888
|
+
</optional>
|
889
|
+
</element>
|
890
|
+
</define>
|
879
891
|
</include>
|
880
892
|
<!-- end overrides -->
|
881
893
|
<define name="colgroup">
|
@@ -943,8 +955,170 @@
|
|
943
955
|
<ref name="permission"/>
|
944
956
|
<ref name="imagemap"/>
|
945
957
|
<ref name="svgmap"/>
|
958
|
+
<ref name="inputform"/>
|
959
|
+
</choice>
|
960
|
+
</define>
|
961
|
+
<define name="inputform">
|
962
|
+
<element name="form">
|
963
|
+
<attribute name="id">
|
964
|
+
<data type="ID"/>
|
965
|
+
</attribute>
|
966
|
+
<attribute name="name"/>
|
967
|
+
<attribute name="action"/>
|
968
|
+
<zeroOrMore>
|
969
|
+
<choice>
|
970
|
+
<ref name="TextElement"/>
|
971
|
+
<ref name="FormInput"/>
|
972
|
+
</choice>
|
973
|
+
</zeroOrMore>
|
974
|
+
</element>
|
975
|
+
</define>
|
976
|
+
<define name="FormInput">
|
977
|
+
<choice>
|
978
|
+
<ref name="input"/>
|
979
|
+
<ref name="formlabel"/>
|
980
|
+
<ref name="select"/>
|
981
|
+
<ref name="textarea"/>
|
982
|
+
</choice>
|
983
|
+
</define>
|
984
|
+
<define name="InputType">
|
985
|
+
<choice>
|
986
|
+
<value>button</value>
|
987
|
+
<value>checkbox</value>
|
988
|
+
<value>date</value>
|
989
|
+
<value>file</value>
|
990
|
+
<value>password</value>
|
991
|
+
<value>radio</value>
|
992
|
+
<value>submit</value>
|
993
|
+
<value>text</value>
|
946
994
|
</choice>
|
947
995
|
</define>
|
996
|
+
<define name="input">
|
997
|
+
<element name="input">
|
998
|
+
<attribute name="type">
|
999
|
+
<ref name="InputType"/>
|
1000
|
+
</attribute>
|
1001
|
+
<optional>
|
1002
|
+
<attribute name="checked">
|
1003
|
+
<data type="boolean"/>
|
1004
|
+
</attribute>
|
1005
|
+
</optional>
|
1006
|
+
<optional>
|
1007
|
+
<attribute name="disabled">
|
1008
|
+
<data type="boolean"/>
|
1009
|
+
</attribute>
|
1010
|
+
</optional>
|
1011
|
+
<optional>
|
1012
|
+
<attribute name="readonly">
|
1013
|
+
<data type="boolean"/>
|
1014
|
+
</attribute>
|
1015
|
+
</optional>
|
1016
|
+
<optional>
|
1017
|
+
<attribute name="maxlength">
|
1018
|
+
<data type="int"/>
|
1019
|
+
</attribute>
|
1020
|
+
</optional>
|
1021
|
+
<optional>
|
1022
|
+
<attribute name="minlength">
|
1023
|
+
<data type="int"/>
|
1024
|
+
</attribute>
|
1025
|
+
</optional>
|
1026
|
+
<optional>
|
1027
|
+
<attribute name="name"/>
|
1028
|
+
</optional>
|
1029
|
+
<optional>
|
1030
|
+
<attribute name="value"/>
|
1031
|
+
</optional>
|
1032
|
+
<optional>
|
1033
|
+
<attribute name="id">
|
1034
|
+
<data type="ID"/>
|
1035
|
+
</attribute>
|
1036
|
+
</optional>
|
1037
|
+
</element>
|
1038
|
+
</define>
|
1039
|
+
<define name="formlabel">
|
1040
|
+
<element name="label">
|
1041
|
+
<attribute name="for">
|
1042
|
+
<data type="IDREF"/>
|
1043
|
+
</attribute>
|
1044
|
+
<zeroOrMore>
|
1045
|
+
<ref name="PureTextElement"/>
|
1046
|
+
</zeroOrMore>
|
1047
|
+
</element>
|
1048
|
+
</define>
|
1049
|
+
<define name="select">
|
1050
|
+
<element name="select">
|
1051
|
+
<optional>
|
1052
|
+
<attribute name="name"/>
|
1053
|
+
</optional>
|
1054
|
+
<optional>
|
1055
|
+
<attribute name="value"/>
|
1056
|
+
</optional>
|
1057
|
+
<optional>
|
1058
|
+
<attribute name="id">
|
1059
|
+
<data type="ID"/>
|
1060
|
+
</attribute>
|
1061
|
+
</optional>
|
1062
|
+
<optional>
|
1063
|
+
<attribute name="disabled">
|
1064
|
+
<data type="boolean"/>
|
1065
|
+
</attribute>
|
1066
|
+
</optional>
|
1067
|
+
<optional>
|
1068
|
+
<attribute name="multiple">
|
1069
|
+
<data type="boolean"/>
|
1070
|
+
</attribute>
|
1071
|
+
</optional>
|
1072
|
+
<optional>
|
1073
|
+
<attribute name="size">
|
1074
|
+
<data type="int"/>
|
1075
|
+
</attribute>
|
1076
|
+
</optional>
|
1077
|
+
<oneOrMore>
|
1078
|
+
<ref name="option"/>
|
1079
|
+
</oneOrMore>
|
1080
|
+
</element>
|
1081
|
+
</define>
|
1082
|
+
<define name="option">
|
1083
|
+
<element name="option">
|
1084
|
+
<optional>
|
1085
|
+
<attribute name="disabled">
|
1086
|
+
<data type="boolean"/>
|
1087
|
+
</attribute>
|
1088
|
+
</optional>
|
1089
|
+
<optional>
|
1090
|
+
<attribute name="value"/>
|
1091
|
+
</optional>
|
1092
|
+
<zeroOrMore>
|
1093
|
+
<ref name="PureTextElement"/>
|
1094
|
+
</zeroOrMore>
|
1095
|
+
</element>
|
1096
|
+
</define>
|
1097
|
+
<define name="textarea">
|
1098
|
+
<element name="textarea">
|
1099
|
+
<optional>
|
1100
|
+
<attribute name="name"/>
|
1101
|
+
</optional>
|
1102
|
+
<optional>
|
1103
|
+
<attribute name="value"/>
|
1104
|
+
</optional>
|
1105
|
+
<optional>
|
1106
|
+
<attribute name="id">
|
1107
|
+
<data type="ID"/>
|
1108
|
+
</attribute>
|
1109
|
+
</optional>
|
1110
|
+
<optional>
|
1111
|
+
<attribute name="rows">
|
1112
|
+
<data type="int"/>
|
1113
|
+
</attribute>
|
1114
|
+
</optional>
|
1115
|
+
<optional>
|
1116
|
+
<attribute name="cols">
|
1117
|
+
<data type="int"/>
|
1118
|
+
</attribute>
|
1119
|
+
</optional>
|
1120
|
+
</element>
|
1121
|
+
</define>
|
948
1122
|
<define name="bibliography">
|
949
1123
|
<element name="bibliography">
|
950
1124
|
<oneOrMore>
|
@@ -39,33 +39,47 @@ module IsoDoc
|
|
39
39
|
ret
|
40
40
|
end
|
41
41
|
|
42
|
-
def nonstd_bibitem(list,
|
43
|
-
list.p **attr_code(iso_bibitem_entry_attrs(
|
44
|
-
ids = bibitem_ref_code(
|
42
|
+
def nonstd_bibitem(list, bibitem, ordinal, biblio)
|
43
|
+
list.p **attr_code(iso_bibitem_entry_attrs(bibitem, biblio)) do |ref|
|
44
|
+
ids = bibitem_ref_code(bibitem)
|
45
45
|
identifiers = render_identifier(ids)
|
46
46
|
if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
|
47
47
|
else
|
48
|
-
ref <<
|
48
|
+
ref << identifiers[0] || identifiers[1]
|
49
49
|
ref << " #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
50
50
|
end
|
51
51
|
ref << " " unless biblio && !identifiers[1]
|
52
|
-
reference_format(
|
52
|
+
reference_format(bibitem, ref)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def std_bibitem_entry(list,
|
57
|
-
list.p **attr_code(iso_bibitem_entry_attrs(
|
58
|
-
identifiers = render_identifier(bibitem_ref_code(
|
56
|
+
def std_bibitem_entry(list, bibitem, ordinal, biblio)
|
57
|
+
list.p **attr_code(iso_bibitem_entry_attrs(bibitem, biblio)) do |ref|
|
58
|
+
identifiers = render_identifier(bibitem_ref_code(bibitem))
|
59
59
|
if biblio then ref_entry_code(ref, ordinal, identifiers, nil)
|
60
60
|
else
|
61
|
-
ref <<
|
61
|
+
ref << identifiers[0] || identifiers[1]
|
62
62
|
ref << " #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
63
63
|
end
|
64
|
-
date_note_process(
|
64
|
+
date_note_process(bibitem, ref)
|
65
65
|
ref << " " unless biblio && !identifiers[1]
|
66
|
-
reference_format(
|
66
|
+
reference_format(bibitem, ref)
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
def term_cleanup(docxml)
|
71
|
+
@jcgm ? docxml : super
|
72
|
+
end
|
73
|
+
|
74
|
+
def termref_cleanup(docxml)
|
75
|
+
docxml
|
76
|
+
.gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/,
|
77
|
+
l10n(", #{@i18n.modified} [/TERMREF]"))
|
78
|
+
.gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ")
|
79
|
+
.gsub(/\[TERMREF\]\s*/, l10n("[#{@i18n.source} "))
|
80
|
+
.gsub(%r{\s*\[/TERMREF\]\s*}, l10n("]"))
|
81
|
+
.gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} — "))
|
82
|
+
end
|
69
83
|
end
|
70
84
|
end
|
71
85
|
end
|
@@ -5485,6 +5485,7 @@
|
|
5485
5485
|
|
5486
5486
|
|
5487
5487
|
|
5488
|
+
|
5488
5489
|
<xsl:attribute name="border">solid 0pt white</xsl:attribute>
|
5489
5490
|
<xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
|
5490
5491
|
<xsl:if test="$rownum = 1">
|
@@ -8178,6 +8179,70 @@
|
|
8178
8179
|
<xsl:value-of select="substring(.,1,1)"/>
|
8179
8180
|
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
8180
8181
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
8182
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']">
|
8183
|
+
<fo:block>
|
8184
|
+
<xsl:apply-templates/>
|
8185
|
+
</fo:block>
|
8186
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
|
8187
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
8188
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
|
8189
|
+
<fo:inline>
|
8190
|
+
<xsl:call-template name="text_input"/>
|
8191
|
+
</fo:inline>
|
8192
|
+
</xsl:template><xsl:template name="text_input">
|
8193
|
+
<xsl:variable name="count">
|
8194
|
+
<xsl:choose>
|
8195
|
+
<xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
|
8196
|
+
<xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
|
8197
|
+
<xsl:otherwise>10</xsl:otherwise>
|
8198
|
+
</xsl:choose>
|
8199
|
+
</xsl:variable>
|
8200
|
+
<xsl:call-template name="repeat">
|
8201
|
+
<xsl:with-param name="char" select="'_'"/>
|
8202
|
+
<xsl:with-param name="count" select="$count"/>
|
8203
|
+
</xsl:call-template>
|
8204
|
+
<xsl:text> </xsl:text>
|
8205
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
|
8206
|
+
<xsl:variable name="caption">
|
8207
|
+
<xsl:choose>
|
8208
|
+
<xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
|
8209
|
+
<xsl:otherwise>BUTTON</xsl:otherwise>
|
8210
|
+
</xsl:choose>
|
8211
|
+
</xsl:variable>
|
8212
|
+
<fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
|
8213
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
|
8214
|
+
<fo:inline padding-right="1mm">
|
8215
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8216
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8217
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8218
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8219
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8220
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8221
|
+
<polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
|
8222
|
+
</svg>
|
8223
|
+
</fo:instream-foreign-object>
|
8224
|
+
</fo:inline>
|
8225
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
|
8226
|
+
<fo:inline padding-right="1mm">
|
8227
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8228
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8229
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8230
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8231
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8232
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8233
|
+
<circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
|
8234
|
+
<circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
|
8235
|
+
</svg>
|
8236
|
+
</fo:instream-foreign-object>
|
8237
|
+
</fo:inline>
|
8238
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
|
8239
|
+
<fo:inline>
|
8240
|
+
<xsl:call-template name="text_input"/>
|
8241
|
+
</fo:inline>
|
8242
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
|
8243
|
+
<fo:block-container border="1pt solid black" width="50%">
|
8244
|
+
<fo:block> </fo:block>
|
8245
|
+
</fo:block-container>
|
8181
8246
|
</xsl:template><xsl:template name="convertDate">
|
8182
8247
|
<xsl:param name="date"/>
|
8183
8248
|
<xsl:param name="format" select="'short'"/>
|
@@ -5485,6 +5485,7 @@
|
|
5485
5485
|
|
5486
5486
|
|
5487
5487
|
|
5488
|
+
|
5488
5489
|
<xsl:attribute name="border">solid 0pt white</xsl:attribute>
|
5489
5490
|
<xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
|
5490
5491
|
<xsl:if test="$rownum = 1">
|
@@ -8178,6 +8179,70 @@
|
|
8178
8179
|
<xsl:value-of select="substring(.,1,1)"/>
|
8179
8180
|
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
8180
8181
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
8182
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']">
|
8183
|
+
<fo:block>
|
8184
|
+
<xsl:apply-templates/>
|
8185
|
+
</fo:block>
|
8186
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
|
8187
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
8188
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
|
8189
|
+
<fo:inline>
|
8190
|
+
<xsl:call-template name="text_input"/>
|
8191
|
+
</fo:inline>
|
8192
|
+
</xsl:template><xsl:template name="text_input">
|
8193
|
+
<xsl:variable name="count">
|
8194
|
+
<xsl:choose>
|
8195
|
+
<xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
|
8196
|
+
<xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
|
8197
|
+
<xsl:otherwise>10</xsl:otherwise>
|
8198
|
+
</xsl:choose>
|
8199
|
+
</xsl:variable>
|
8200
|
+
<xsl:call-template name="repeat">
|
8201
|
+
<xsl:with-param name="char" select="'_'"/>
|
8202
|
+
<xsl:with-param name="count" select="$count"/>
|
8203
|
+
</xsl:call-template>
|
8204
|
+
<xsl:text> </xsl:text>
|
8205
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
|
8206
|
+
<xsl:variable name="caption">
|
8207
|
+
<xsl:choose>
|
8208
|
+
<xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
|
8209
|
+
<xsl:otherwise>BUTTON</xsl:otherwise>
|
8210
|
+
</xsl:choose>
|
8211
|
+
</xsl:variable>
|
8212
|
+
<fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
|
8213
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
|
8214
|
+
<fo:inline padding-right="1mm">
|
8215
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8216
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8217
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8218
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8219
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8220
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8221
|
+
<polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
|
8222
|
+
</svg>
|
8223
|
+
</fo:instream-foreign-object>
|
8224
|
+
</fo:inline>
|
8225
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
|
8226
|
+
<fo:inline padding-right="1mm">
|
8227
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8228
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8229
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8230
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8231
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8232
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8233
|
+
<circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
|
8234
|
+
<circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
|
8235
|
+
</svg>
|
8236
|
+
</fo:instream-foreign-object>
|
8237
|
+
</fo:inline>
|
8238
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
|
8239
|
+
<fo:inline>
|
8240
|
+
<xsl:call-template name="text_input"/>
|
8241
|
+
</fo:inline>
|
8242
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
|
8243
|
+
<fo:block-container border="1pt solid black" width="50%">
|
8244
|
+
<fo:block> </fo:block>
|
8245
|
+
</fo:block-container>
|
8181
8246
|
</xsl:template><xsl:template name="convertDate">
|
8182
8247
|
<xsl:param name="date"/>
|
8183
8248
|
<xsl:param name="format" select="'short'"/>
|
@@ -5485,6 +5485,7 @@
|
|
5485
5485
|
|
5486
5486
|
|
5487
5487
|
|
5488
|
+
|
5488
5489
|
<xsl:attribute name="border">solid 0pt white</xsl:attribute>
|
5489
5490
|
<xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
|
5490
5491
|
<xsl:if test="$rownum = 1">
|
@@ -8178,6 +8179,70 @@
|
|
8178
8179
|
<xsl:value-of select="substring(.,1,1)"/>
|
8179
8180
|
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
8180
8181
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
8182
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']">
|
8183
|
+
<fo:block>
|
8184
|
+
<xsl:apply-templates/>
|
8185
|
+
</fo:block>
|
8186
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
|
8187
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
8188
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
|
8189
|
+
<fo:inline>
|
8190
|
+
<xsl:call-template name="text_input"/>
|
8191
|
+
</fo:inline>
|
8192
|
+
</xsl:template><xsl:template name="text_input">
|
8193
|
+
<xsl:variable name="count">
|
8194
|
+
<xsl:choose>
|
8195
|
+
<xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
|
8196
|
+
<xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
|
8197
|
+
<xsl:otherwise>10</xsl:otherwise>
|
8198
|
+
</xsl:choose>
|
8199
|
+
</xsl:variable>
|
8200
|
+
<xsl:call-template name="repeat">
|
8201
|
+
<xsl:with-param name="char" select="'_'"/>
|
8202
|
+
<xsl:with-param name="count" select="$count"/>
|
8203
|
+
</xsl:call-template>
|
8204
|
+
<xsl:text> </xsl:text>
|
8205
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
|
8206
|
+
<xsl:variable name="caption">
|
8207
|
+
<xsl:choose>
|
8208
|
+
<xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
|
8209
|
+
<xsl:otherwise>BUTTON</xsl:otherwise>
|
8210
|
+
</xsl:choose>
|
8211
|
+
</xsl:variable>
|
8212
|
+
<fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
|
8213
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
|
8214
|
+
<fo:inline padding-right="1mm">
|
8215
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8216
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8217
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8218
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8219
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8220
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8221
|
+
<polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
|
8222
|
+
</svg>
|
8223
|
+
</fo:instream-foreign-object>
|
8224
|
+
</fo:inline>
|
8225
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
|
8226
|
+
<fo:inline padding-right="1mm">
|
8227
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8228
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8229
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8230
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8231
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8232
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8233
|
+
<circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
|
8234
|
+
<circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
|
8235
|
+
</svg>
|
8236
|
+
</fo:instream-foreign-object>
|
8237
|
+
</fo:inline>
|
8238
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
|
8239
|
+
<fo:inline>
|
8240
|
+
<xsl:call-template name="text_input"/>
|
8241
|
+
</fo:inline>
|
8242
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
|
8243
|
+
<fo:block-container border="1pt solid black" width="50%">
|
8244
|
+
<fo:block> </fo:block>
|
8245
|
+
</fo:block-container>
|
8181
8246
|
</xsl:template><xsl:template name="convertDate">
|
8182
8247
|
<xsl:param name="date"/>
|
8183
8248
|
<xsl:param name="format" select="'short'"/>
|
@@ -5485,6 +5485,7 @@
|
|
5485
5485
|
|
5486
5486
|
|
5487
5487
|
|
5488
|
+
|
5488
5489
|
<xsl:attribute name="border">solid 0pt white</xsl:attribute>
|
5489
5490
|
<xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
|
5490
5491
|
<xsl:if test="$rownum = 1">
|
@@ -8178,6 +8179,70 @@
|
|
8178
8179
|
<xsl:value-of select="substring(.,1,1)"/>
|
8179
8180
|
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
8180
8181
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
8182
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']">
|
8183
|
+
<fo:block>
|
8184
|
+
<xsl:apply-templates/>
|
8185
|
+
</fo:block>
|
8186
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
|
8187
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
8188
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
|
8189
|
+
<fo:inline>
|
8190
|
+
<xsl:call-template name="text_input"/>
|
8191
|
+
</fo:inline>
|
8192
|
+
</xsl:template><xsl:template name="text_input">
|
8193
|
+
<xsl:variable name="count">
|
8194
|
+
<xsl:choose>
|
8195
|
+
<xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
|
8196
|
+
<xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
|
8197
|
+
<xsl:otherwise>10</xsl:otherwise>
|
8198
|
+
</xsl:choose>
|
8199
|
+
</xsl:variable>
|
8200
|
+
<xsl:call-template name="repeat">
|
8201
|
+
<xsl:with-param name="char" select="'_'"/>
|
8202
|
+
<xsl:with-param name="count" select="$count"/>
|
8203
|
+
</xsl:call-template>
|
8204
|
+
<xsl:text> </xsl:text>
|
8205
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
|
8206
|
+
<xsl:variable name="caption">
|
8207
|
+
<xsl:choose>
|
8208
|
+
<xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
|
8209
|
+
<xsl:otherwise>BUTTON</xsl:otherwise>
|
8210
|
+
</xsl:choose>
|
8211
|
+
</xsl:variable>
|
8212
|
+
<fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
|
8213
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
|
8214
|
+
<fo:inline padding-right="1mm">
|
8215
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8216
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8217
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8218
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8219
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8220
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8221
|
+
<polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
|
8222
|
+
</svg>
|
8223
|
+
</fo:instream-foreign-object>
|
8224
|
+
</fo:inline>
|
8225
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
|
8226
|
+
<fo:inline padding-right="1mm">
|
8227
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
8228
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
8229
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
8230
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8231
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
8232
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
8233
|
+
<circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
|
8234
|
+
<circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
|
8235
|
+
</svg>
|
8236
|
+
</fo:instream-foreign-object>
|
8237
|
+
</fo:inline>
|
8238
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
|
8239
|
+
<fo:inline>
|
8240
|
+
<xsl:call-template name="text_input"/>
|
8241
|
+
</fo:inline>
|
8242
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
|
8243
|
+
<fo:block-container border="1pt solid black" width="50%">
|
8244
|
+
<fo:block> </fo:block>
|
8245
|
+
</fo:block-container>
|
8181
8246
|
</xsl:template><xsl:template name="convertDate">
|
8182
8247
|
<xsl:param name="date"/>
|
8183
8248
|
<xsl:param name="format" select="'short'"/>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
annex: Appendix
|
2
2
|
appendix: Annex
|
3
|
+
iso_annex: Annex
|
3
4
|
see: see
|
4
5
|
see_also: see also
|
5
6
|
clause: Chapter
|
@@ -17,3 +18,4 @@ norm_with_refs_pref:
|
|
17
18
|
document (including any amendments) applies.
|
18
19
|
all_rights_reserved: All rights reserved
|
19
20
|
table_of_contents: Contents
|
21
|
+
source: Adapted from
|
@@ -1,5 +1,6 @@
|
|
1
1
|
annex: Annexe
|
2
2
|
appendix: Appendice
|
3
|
+
iso_annex: Annexe
|
3
4
|
see: voir
|
4
5
|
see_also: voir aussi
|
5
6
|
clause: chapître
|
@@ -40,3 +41,4 @@ norm_with_refs_pref:
|
|
40
41
|
Les documents suivants cités dans le texte sont indispensables pour l'application de ce document. Pour les références datées, seule l’édition citée s’applique. Pour les références non datées, la dernière édition du document de référence s’applique (y compris les éventuels amendements).
|
41
42
|
all_rights_reserved: Tous droits réservés
|
42
43
|
table_of_contents: Table des matières
|
44
|
+
source: Adapté de
|
data/lib/isodoc/bipm/index.rb
CHANGED
@@ -10,14 +10,17 @@ module IsoDoc
|
|
10
10
|
|
11
11
|
def index(docxml)
|
12
12
|
unless docxml.at(ns("//index"))
|
13
|
-
docxml.xpath(ns("//indexsect")).each
|
13
|
+
docxml.xpath(ns("//indexsect")).each(&:remove)
|
14
14
|
return
|
15
15
|
end
|
16
16
|
i = docxml.at(ns("//indexsect")) ||
|
17
|
-
docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
+
)
|
21
24
|
index1(docxml, i, index)
|
22
25
|
end
|
23
26
|
|
@@ -33,8 +36,8 @@ module IsoDoc
|
|
33
36
|
@xrefs.bookmark_anchor_names(docxml)
|
34
37
|
end
|
35
38
|
|
36
|
-
def sortable(
|
37
|
-
HTMLEntities.new.decode(Nokogiri::XML.fragment(
|
39
|
+
def sortable(str)
|
40
|
+
HTMLEntities.new.decode(Nokogiri::XML.fragment(str).text)
|
38
41
|
end
|
39
42
|
|
40
43
|
def index_entries_opt
|
@@ -45,7 +48,7 @@ module IsoDoc
|
|
45
48
|
ret = index_entries_head(words[primary],
|
46
49
|
index.dig(words[primary], nil, nil),
|
47
50
|
index_entries_opt)
|
48
|
-
words2 = index[words[primary]]&.keys&.
|
51
|
+
words2 = index[words[primary]]&.keys&.compact
|
49
52
|
&.each_with_object({}) { |w, v| v[w.downcase] = w }
|
50
53
|
unless words2.empty?
|
51
54
|
ret += "<ul>"
|
@@ -54,7 +57,7 @@ module IsoDoc
|
|
54
57
|
end
|
55
58
|
ret += "</ul>"
|
56
59
|
end
|
57
|
-
ret
|
60
|
+
"#{ret}</li>"
|
58
61
|
end
|
59
62
|
|
60
63
|
def index_entries2(words, index, secondary)
|
@@ -70,7 +73,7 @@ module IsoDoc
|
|
70
73
|
end
|
71
74
|
ret += "</ul>"
|
72
75
|
end
|
73
|
-
ret
|
76
|
+
"#{ret}</li>"
|
74
77
|
end
|
75
78
|
|
76
79
|
def index_entries_head(head, entries, opt)
|
@@ -118,8 +121,9 @@ module IsoDoc
|
|
118
121
|
end
|
119
122
|
end
|
120
123
|
|
121
|
-
def xml_encode_attr(
|
122
|
-
HTMLEntities.new.encode(
|
124
|
+
def xml_encode_attr(str)
|
125
|
+
HTMLEntities.new.encode(str, :basic, :hexadecimal)
|
126
|
+
.gsub(/&#x([^;]+);/) { |_x| "&#x#{$1.upcase};" }
|
123
127
|
end
|
124
128
|
|
125
129
|
# attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
|
@@ -138,10 +142,10 @@ module IsoDoc
|
|
138
142
|
end
|
139
143
|
end
|
140
144
|
|
141
|
-
def index2bookmark(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
+
def index2bookmark(node)
|
146
|
+
node.name = "bookmark"
|
147
|
+
node.children.each(&:remove)
|
148
|
+
node["id"] = "_#{UUIDTools::UUID.random_create}"
|
145
149
|
end
|
146
150
|
end
|
147
151
|
end
|
data/lib/isodoc/bipm/init.rb
CHANGED
@@ -10,7 +10,7 @@ module IsoDoc
|
|
10
10
|
@meta = Metadata.new(lang, script, labels)
|
11
11
|
end
|
12
12
|
|
13
|
-
def xref_init(lang, script,
|
13
|
+
def xref_init(lang, script, _klass, labels, options)
|
14
14
|
html = HtmlConvert.new(language: lang, script: script)
|
15
15
|
@xrefs = Xref.new(lang, script, html, labels, options)
|
16
16
|
end
|
@@ -21,4 +21,3 @@ module IsoDoc
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
@@ -1022,7 +1022,7 @@
|
|
1022
1022
|
<xsl:apply-templates select="." mode="mathml"/>
|
1023
1023
|
</xsl:variable>
|
1024
1024
|
<fo:instream-foreign-object fox:alt-text="Math">
|
1025
|
-
<xsl:if test="local-name(../..) = 'formula'">
|
1025
|
+
<xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
|
1026
1026
|
<xsl:attribute name="width">95%</xsl:attribute>
|
1027
1027
|
<xsl:attribute name="content-height">100%</xsl:attribute>
|
1028
1028
|
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
@@ -3431,6 +3431,11 @@
|
|
3431
3431
|
<xsl:attribute name="padding-top">0.5mm</xsl:attribute>
|
3432
3432
|
|
3433
3433
|
|
3434
|
+
<xsl:if test="count(*) = 1 and (local-name(*[1]) = 'stem' or local-name(*[1]) = 'figure')">
|
3435
|
+
<xsl:attribute name="padding-left">0mm</xsl:attribute>
|
3436
|
+
</xsl:if>
|
3437
|
+
|
3438
|
+
|
3434
3439
|
|
3435
3440
|
<xsl:if test="ancestor::*[local-name() = 'tfoot']">
|
3436
3441
|
<xsl:attribute name="border">solid black 0</xsl:attribute>
|
@@ -5761,6 +5766,10 @@
|
|
5761
5766
|
<xsl:call-template name="setId"/>
|
5762
5767
|
|
5763
5768
|
|
5769
|
+
<xsl:if test="@inline-header='true'">
|
5770
|
+
<xsl:attribute name="text-align">justify</xsl:attribute>
|
5771
|
+
</xsl:if>
|
5772
|
+
|
5764
5773
|
<xsl:apply-templates/>
|
5765
5774
|
</fo:block>
|
5766
5775
|
</xsl:template><xsl:template match="*[local-name() = 'definitions']">
|
@@ -6054,6 +6063,70 @@
|
|
6054
6063
|
<xsl:value-of select="substring(.,1,1)"/>
|
6055
6064
|
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
6056
6065
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
6066
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']">
|
6067
|
+
<fo:block>
|
6068
|
+
<xsl:apply-templates/>
|
6069
|
+
</fo:block>
|
6070
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
|
6071
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
6072
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
|
6073
|
+
<fo:inline>
|
6074
|
+
<xsl:call-template name="text_input"/>
|
6075
|
+
</fo:inline>
|
6076
|
+
</xsl:template><xsl:template name="text_input">
|
6077
|
+
<xsl:variable name="count">
|
6078
|
+
<xsl:choose>
|
6079
|
+
<xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
|
6080
|
+
<xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
|
6081
|
+
<xsl:otherwise>10</xsl:otherwise>
|
6082
|
+
</xsl:choose>
|
6083
|
+
</xsl:variable>
|
6084
|
+
<xsl:call-template name="repeat">
|
6085
|
+
<xsl:with-param name="char" select="'_'"/>
|
6086
|
+
<xsl:with-param name="count" select="$count"/>
|
6087
|
+
</xsl:call-template>
|
6088
|
+
<xsl:text> </xsl:text>
|
6089
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
|
6090
|
+
<xsl:variable name="caption">
|
6091
|
+
<xsl:choose>
|
6092
|
+
<xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
|
6093
|
+
<xsl:otherwise>BUTTON</xsl:otherwise>
|
6094
|
+
</xsl:choose>
|
6095
|
+
</xsl:variable>
|
6096
|
+
<fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
|
6097
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
|
6098
|
+
<fo:inline padding-right="1mm">
|
6099
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
6100
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
6101
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
6102
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6103
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
6104
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
6105
|
+
<polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
|
6106
|
+
</svg>
|
6107
|
+
</fo:instream-foreign-object>
|
6108
|
+
</fo:inline>
|
6109
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
|
6110
|
+
<fo:inline padding-right="1mm">
|
6111
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
6112
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
6113
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
6114
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6115
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
6116
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
6117
|
+
<circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
|
6118
|
+
<circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
|
6119
|
+
</svg>
|
6120
|
+
</fo:instream-foreign-object>
|
6121
|
+
</fo:inline>
|
6122
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
|
6123
|
+
<fo:inline>
|
6124
|
+
<xsl:call-template name="text_input"/>
|
6125
|
+
</fo:inline>
|
6126
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
|
6127
|
+
<fo:block-container border="1pt solid black" width="50%">
|
6128
|
+
<fo:block> </fo:block>
|
6129
|
+
</fo:block-container>
|
6057
6130
|
</xsl:template><xsl:template name="convertDate">
|
6058
6131
|
<xsl:param name="date"/>
|
6059
6132
|
<xsl:param name="format" select="'short'"/>
|
@@ -25,29 +25,46 @@ module IsoDoc
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def table1(
|
29
|
-
return if labelled_ancestor(
|
30
|
-
return if
|
28
|
+
def table1(elem)
|
29
|
+
return if labelled_ancestor(elem)
|
30
|
+
return if elem["unnumbered"]
|
31
31
|
|
32
|
-
n = @xrefs.anchor(
|
33
|
-
prefix_name(
|
32
|
+
n = @xrefs.anchor(elem["id"], :label, false)
|
33
|
+
prefix_name(elem, ".<tab/>",
|
34
|
+
l10n("#{@i18n.table.capitalize} #{n}"), "name")
|
34
35
|
end
|
35
36
|
|
36
|
-
def
|
37
|
+
def figure1(elem)
|
38
|
+
if @jcgm
|
39
|
+
@iso.xrefs = @xrefs
|
40
|
+
@iso.figure1(elem)
|
41
|
+
else super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def annex1(elem)
|
37
46
|
return super if @jcgm
|
38
|
-
return if
|
47
|
+
return if elem["unnumbered"] == "true"
|
39
48
|
|
40
|
-
lbl = @xrefs.anchor(
|
41
|
-
if t =
|
49
|
+
lbl = @xrefs.anchor(elem["id"], :label)
|
50
|
+
if t = elem.at(ns("./title"))
|
42
51
|
t.children = "<strong>#{t.children.to_xml}</strong>"
|
43
52
|
end
|
44
|
-
prefix_name(
|
53
|
+
prefix_name(elem, ".<tab/>", lbl, "title")
|
45
54
|
end
|
46
55
|
|
47
|
-
def
|
48
|
-
|
49
|
-
|
56
|
+
def clause(docxml)
|
57
|
+
super
|
58
|
+
if @jcgm
|
59
|
+
docxml.xpath(ns("//preface/introduction[clause]")).each do |f|
|
60
|
+
clause1(f)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
50
64
|
|
65
|
+
def clause1(elem)
|
66
|
+
return if elem["unnumbered"] == "true"
|
67
|
+
return if elem.at(("./ancestor::*[@unnumbered = 'true']"))
|
51
68
|
super
|
52
69
|
end
|
53
70
|
|
@@ -56,31 +73,32 @@ module IsoDoc
|
|
56
73
|
doccontrol docxml
|
57
74
|
end
|
58
75
|
|
59
|
-
def doccontrol(
|
60
|
-
return unless
|
76
|
+
def doccontrol(doc)
|
77
|
+
return unless doc.at(ns("//bibdata/relation[@type = 'supersedes']"))
|
61
78
|
|
62
|
-
clause = <<~
|
79
|
+
clause = <<~DOCCONTROL
|
63
80
|
<doccontrol>
|
64
81
|
<title>Document Control</title>
|
65
82
|
<table unnumbered="true"><tbody>
|
66
|
-
<tr><th>Authors:</th><td/><td>#{list_authors(
|
67
|
-
|
83
|
+
<tr><th>Authors:</th><td/><td>#{list_authors(doc)}</td></tr>
|
84
|
+
#{doccontrol_row1(doc)} #{doccontrol_row2(doc)} #{list_drafts(doc)}
|
68
85
|
</tbody></table></doccontrol>
|
69
|
-
|
70
|
-
|
86
|
+
DOCCONTROL
|
87
|
+
doc.root << clause
|
71
88
|
end
|
72
89
|
|
73
|
-
def doccontrol_row1(
|
74
|
-
return "" if list_draft(
|
90
|
+
def doccontrol_row1(doc)
|
91
|
+
return "" if list_draft(doc, 1) == ["", ""] && list_cochairs(doc).empty?
|
75
92
|
|
76
93
|
<<~ROW
|
77
|
-
<tr>#{list_draft(
|
78
|
-
<td>#{list_cochairs(
|
94
|
+
<tr>#{list_draft(doc, 1)&.map { |x| "<td>#{x}</td>" }&.join}
|
95
|
+
<td>#{list_cochairs(doc)}</td></tr>
|
79
96
|
ROW
|
80
97
|
end
|
81
98
|
|
82
99
|
def doccontrol_row2(docxml)
|
83
|
-
|
100
|
+
list_draft(docxml, 2) == ["", ""] && list_chairs(docxml).empty? and
|
101
|
+
return ""
|
84
102
|
|
85
103
|
<<~ROW
|
86
104
|
<tr>#{list_draft(docxml, 2)&.map { |x| "<td>#{x}</td>" }&.join}
|
@@ -99,15 +117,13 @@ module IsoDoc
|
|
99
117
|
ret
|
100
118
|
end
|
101
119
|
|
102
|
-
def list_draft(xml,
|
103
|
-
|
104
|
-
|
120
|
+
def list_draft(xml, idx)
|
121
|
+
d = xml.at(ns("//bibdata/relation[@type = 'supersedes'][#{idx}]"\
|
122
|
+
"/bibitem")) or return ["", ""]
|
105
123
|
|
106
124
|
date = d&.at(ns("./date"))&.text
|
107
|
-
draft = d&.at(ns("./version/draft"))&.text and
|
108
|
-
|
109
|
-
edn = d&.at(ns("./edition"))&.text and
|
110
|
-
edn = "Version #{edn}"
|
125
|
+
draft = d&.at(ns("./version/draft"))&.text and draft = "Draft #{draft}"
|
126
|
+
edn = d&.at(ns("./edition"))&.text and edn = "Version #{edn}"
|
111
127
|
[[draft, edn].join(" "), date]
|
112
128
|
end
|
113
129
|
|
@@ -156,8 +172,8 @@ module IsoDoc
|
|
156
172
|
fraction_group_digits: 3 }
|
157
173
|
end
|
158
174
|
|
159
|
-
def mathml1(
|
160
|
-
localize_maths(
|
175
|
+
def mathml1(elem, locale)
|
176
|
+
localize_maths(elem, locale)
|
161
177
|
end
|
162
178
|
|
163
179
|
def bibdata_i18n(bibdata)
|
@@ -175,6 +191,49 @@ module IsoDoc
|
|
175
191
|
pubdate.next.children = meta.monthyr(pubdate.text)
|
176
192
|
end
|
177
193
|
|
194
|
+
def eref(docxml)
|
195
|
+
super
|
196
|
+
jcgm_eref(docxml, "//eref")
|
197
|
+
end
|
198
|
+
|
199
|
+
def origin(docxml)
|
200
|
+
super
|
201
|
+
jcgm_eref(docxml, "//origin[not(termref)]")
|
202
|
+
end
|
203
|
+
|
204
|
+
def quotesource(docxml)
|
205
|
+
super
|
206
|
+
jcgm_eref(docxml, "//quote/source")
|
207
|
+
end
|
208
|
+
|
209
|
+
def jcgm_eref(docxml, xpath)
|
210
|
+
return unless @jcgm
|
211
|
+
|
212
|
+
docxml.xpath(ns(xpath)).each do |x|
|
213
|
+
extract_brackets(x)
|
214
|
+
end
|
215
|
+
# merge adjacent text nodes
|
216
|
+
docxml.root.replace(Nokogiri::XML(docxml.root.to_xml).root)
|
217
|
+
docxml.xpath(ns(xpath)).each do |x| # rubocop: disable Style/CombinableLoops
|
218
|
+
if x&.next&.text? && /^\],\s+\[$/.match?(x&.next&.text) &&
|
219
|
+
%w(eref origin source).include?(x&.next&.next&.name)
|
220
|
+
x.next.replace(", ")
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def extract_brackets(node)
|
226
|
+
start = node.at("./text()[1]")
|
227
|
+
finish = node.at("./text()[last()]")
|
228
|
+
if /^\[/.match?(start.text) && /\]$/.match?(finish.text)
|
229
|
+
start.replace(start.text[1..-1])
|
230
|
+
node.previous = "["
|
231
|
+
finish = node.at("./text()[last()]")
|
232
|
+
finish.replace(finish.text[0..-2])
|
233
|
+
node.next = "]"
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
178
237
|
include Init
|
179
238
|
end
|
180
239
|
end
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -5,6 +5,7 @@ module IsoDoc
|
|
5
5
|
|
6
6
|
class Xref < IsoDoc::Xref
|
7
7
|
def initialize(lang, script, klass, i18n, options = {})
|
8
|
+
@iso = IsoDoc::Iso::Xref.new(lang, script, klass, i18n, options)
|
8
9
|
super
|
9
10
|
end
|
10
11
|
|
@@ -12,10 +13,10 @@ module IsoDoc
|
|
12
13
|
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
|
13
14
|
"@acronym"))&.value == "JCGM"
|
14
15
|
@annexlbl =
|
15
|
-
if
|
16
|
+
if @jcgm then @labels["iso_annex"]
|
17
|
+
elsif docxml.at(ns("//bibdata/ext/structuredidentifier/appendix"))
|
16
18
|
@labels["appendix"]
|
17
|
-
else
|
18
|
-
@labels["annex"]
|
19
|
+
else @labels["annex"]
|
19
20
|
end
|
20
21
|
super
|
21
22
|
end
|
@@ -28,9 +29,8 @@ module IsoDoc
|
|
28
29
|
|
29
30
|
def reference_names(ref)
|
30
31
|
super
|
31
|
-
|
32
|
+
@jcgm and
|
32
33
|
@anchors[ref["id"]][:xref] = wrap_brackets(@anchors[ref["id"]][:xref])
|
33
|
-
end
|
34
34
|
end
|
35
35
|
|
36
36
|
def clause_names(docxml, sect_num)
|
@@ -109,8 +109,7 @@ module IsoDoc
|
|
109
109
|
def section_name1_anchors(clause, num, level)
|
110
110
|
lbl = @jcgm ? "" : "#{@labels['subclause']} "
|
111
111
|
@anchors[clause["id"]] =
|
112
|
-
{ label: num, level: level,
|
113
|
-
xref: l10n("#{lbl}#{num}"),
|
112
|
+
{ label: num, level: level, xref: l10n("#{lbl}#{num}"),
|
114
113
|
type: "clause" }
|
115
114
|
end
|
116
115
|
|
@@ -226,6 +225,30 @@ module IsoDoc
|
|
226
225
|
)
|
227
226
|
end
|
228
227
|
end
|
228
|
+
|
229
|
+
def initial_anchor_names(doc)
|
230
|
+
super
|
231
|
+
if @jcgm
|
232
|
+
@iso.introduction_names(doc.at(ns("//introduction")))
|
233
|
+
@anchors.merge!(@iso.get)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def sequential_figure_names(clause)
|
238
|
+
if @jcgm
|
239
|
+
@iso.sequential_figure_names(clause)
|
240
|
+
@anchors.merge!(@iso.get)
|
241
|
+
else super
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def hierarchical_figure_names(clause, num)
|
246
|
+
if @jcgm
|
247
|
+
@iso.hierarchical_figure_names(clause, num)
|
248
|
+
@anchors.merge!(@iso.get)
|
249
|
+
else super
|
250
|
+
end
|
251
|
+
end
|
229
252
|
end
|
230
253
|
end
|
231
254
|
end
|
data/lib/metanorma-bipm.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "metanorma"
|
2
|
+
require "metanorma/bipm"
|
3
3
|
require "isodoc/bipm"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "asciidoctor" unless defined? Asciidoctor::Converter
|
6
|
+
require "asciidoctor/bipm"
|
7
7
|
|
8
8
|
if defined? Metanorma
|
9
9
|
require_relative "metanorma/bipm"
|
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: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-generic
|