metanorma-mpfa 0.6.1 → 0.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cf80fd86c575baa2b2be05c6ec24b19208cb22bdc65f0ae3cfa45d91e4b3377
4
- data.tar.gz: d50a921655abc971e49a66252129cddc97ba2087361e26266070ed6436374142
3
+ metadata.gz: c45cbf2fa62763eb3dce64c4f55743c6ca4cddf98ad1829a15e09e75fc478479
4
+ data.tar.gz: 5e67fada8197ff15c52ba159d07a697f5b498261c5db01a30c878d815b17aab5
5
5
  SHA512:
6
- metadata.gz: a5ca83830fe46a0805e1fd26fcd919ce0cc5d35a3528c884298e113437ebea74fa280bf825eaecff4f0030b2cb3661bff4a118d9db54316b8190ec0e129f00df
7
- data.tar.gz: 6926cb26f467c51f33d5e27ae9e152aa6fc3ce54031674e86ebdc4c3f739c81ecda9ea7a277e55be6903c03e04aa3cb7acb9632b3093c0a5229e076b9c84708e
6
+ metadata.gz: 9894bd264e9d1b54b191753ae7772167c17ba0ca57fdef5fbc9b51a124cfead643c8f6e1052398709f520f9efbdb2baee87b9a5c85bf4133f3a3851d9fb39ed0
7
+ data.tar.gz: 9d90cdf416e91ea8f846203596bcac218ab1dfdac629f928a4f65960dc3615a6b948724f42663d682a09b294c2e2f910f3babe4f77abe28595eb3d143b8ca0e9
data/.rubocop.yml CHANGED
@@ -10,5 +10,3 @@ AllCops:
10
10
  DisplayCopNames: false
11
11
  StyleGuideCopsOnly: false
12
12
  TargetRubyVersion: 2.4
13
- Rails:
14
- Enabled: true
data/bin/manifest CHANGED
@@ -29,12 +29,13 @@ supported_gem_paths.each do |backend|
29
29
  end
30
30
  puts
31
31
 
32
- def uuid()
32
+ def uuid
33
33
  UUIDTools::UUID.random_create
34
34
  end
35
35
 
36
36
  def extract_documents(m)
37
- return [] unless m and m["sections"]
37
+ return [] unless m && m["sections"]
38
+
38
39
  ret = []
39
40
  m["sections"].each do |s|
40
41
  ret << s if s["file"]
@@ -45,22 +46,24 @@ end
45
46
 
46
47
  def hyperlink(link)
47
48
  return unless link
49
+
48
50
  link.sub(/\.adoc(?=$|#)/, ".html")
49
51
  end
50
52
 
51
53
  def iterate(sections)
52
54
  return "" unless sections
55
+
53
56
  ret = ""
54
57
  Array(sections).each do |m|
55
- ret+= "<clause id='#{uuid}'>\n"
56
- title = m["title"] && m["number"] ? "#{m['number']}. #{m['title']}" : ( m["number"] || m["title"] || "&mdash;" )
58
+ ret += "<clause id='#{uuid}'>\n"
59
+ title = m["title"] && m["number"] ? "#{m['number']}. #{m['title']}" : (m["number"] || m["title"] || "&mdash;")
57
60
  file = hyperlink(m["file"])
58
61
  title = "<link target='#{file}'>#{title}</link>" if file
59
- ret+= "<title>#{title}</title>\n"
60
- ret+= "<p>#{m['description']}</p>\n" if m["description"]
61
- ret+= "<p align='right'>#{m['revdate']}</p>\n" if m["revdate"]
62
+ ret += "<title>#{title}</title>\n"
63
+ ret += "<p>#{m['description']}</p>\n" if m["description"]
64
+ ret += "<p align='right'>#{m['revdate']}</p>\n" if m["revdate"]
62
65
  ret += iterate(m["sections"])
63
- ret+= "</clause>\n"
66
+ ret += "</clause>\n"
64
67
  end
65
68
  ret
66
69
  end
@@ -69,20 +72,19 @@ options = {}
69
72
  opt_parser = OptionParser.new do |opts|
70
73
  opts.banner += " <file>"
71
74
  opts.on(
72
- '-t',
73
- '--type TYPE',
75
+ "-t",
76
+ "--type TYPE",
74
77
  "Type of standard to generate"
75
78
  ) { |v| options[:type] = v.to_sym }
76
79
 
77
- opts.on(
78
- '-r',
79
- '--require LIBRARY',
80
- 'Require LIBRARY prior to execution'
81
- ) { |v|
80
+ opts.on(
81
+ "-r",
82
+ "--require LIBRARY",
83
+ "Require LIBRARY prior to execution"
84
+ ) do |v|
82
85
  options[:require] ||= []
83
86
  options[:require] << v
84
- }
85
-
87
+ end
86
88
 
87
89
  opts.on_tail("-h", "--help", "Show this message") do
88
90
  puts opts
@@ -98,7 +100,6 @@ if options[:require]
98
100
  end
99
101
  end
100
102
 
101
-
102
103
  manifest = YAML.load_file(ARGV.pop)
103
104
 
104
105
  documents = extract_documents(manifest)
@@ -106,41 +107,41 @@ documents = extract_documents(manifest)
106
107
  # TODO real lookup of namespaces and root elements
107
108
 
108
109
  out = <<~END
109
- <#{options[:type]}-standard xmlns="http://riboseinc.com/isoxml">
110
- <bibdata type="standard">
111
- <title>#{manifest["title"]}</title>
110
+ <#{options[:type]}-standard xmlns="http://riboseinc.com/isoxml">
111
+ <bibdata type="standard">
112
+ <title>#{manifest['title']}</title>
112
113
  END
113
114
 
114
115
  # TODO leave in anchor references?
115
116
  #
116
117
  documents.each do |d|
117
118
  out += <<~END
118
- <relation type="partOf">
119
- <bibdata type="standard">
120
- <title>#{d['title']}</title>
121
- <docidentifier>#{d['number']}</docidentifier>
122
- <abstract>#{d['description']}</abstract>
123
- </bibdata>
124
- </relation>
119
+ <relation type="partOf">
120
+ <bibdata type="standard">
121
+ <title>#{d['title']}</title>
122
+ <docidentifier>#{d['number']}</docidentifier>
123
+ <abstract>#{d['description']}</abstract>
124
+ </bibdata>
125
+ </relation>
125
126
  END
126
127
  end
127
128
 
128
129
  out += <<~END
129
- </bibdata>
130
- <sections>
130
+ </bibdata>
131
+ <sections>
131
132
  END
132
133
 
133
- out+=iterate(manifest["sections"])
134
+ out += iterate(manifest["sections"])
134
135
 
135
- out+= <<~END
136
- </sections>
137
- <#{options[:type]}-standard>
136
+ out += <<~END
137
+ </sections>
138
+ <#{options[:type]}-standard>
138
139
  END
139
- outfilename = options[:filename].sub(/\.[^.]+$/, ".xml")
140
- File.open(outfilename, "w") { |f| f.write out }
141
-
142
- processor = registry.find_processor(options[:type].to_sym)
143
- ext = :html
144
- file_extension = "html" || processor.output_formats[ext]
145
- outfilename = options[:filename].sub(/\.[^.]+$/, ".#{file_extension}")
146
- processor.output(out, outfilename, ext, {suppressheadingnumbers: true})
140
+ outfilename = options[:filename].sub(/\.[^.]+$/, ".xml")
141
+ File.open(outfilename, "w") { |f| f.write out }
142
+
143
+ processor = registry.find_processor(options[:type].to_sym)
144
+ ext = :html
145
+ file_extension = "html" || processor.output_formats[ext]
146
+ outfilename = options[:filename].sub(/\.[^.]+$/, ".#{file_extension}")
147
+ processor.output(out, outfilename, ext, { suppressheadingnumbers: true })
@@ -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>
@@ -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, klass, labels, options)
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
@@ -25,4 +25,3 @@ module IsoDoc
25
25
  end
26
26
  end
27
27
  end
28
-
@@ -2028,6 +2028,7 @@
2028
2028
 
2029
2029
 
2030
2030
 
2031
+
2031
2032
  <xsl:if test=".//*[local-name() = 'table']">
2032
2033
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2033
2034
  </xsl:if>
@@ -4580,6 +4581,70 @@
4580
4581
  <xsl:value-of select="substring(.,1,1)"/>
4581
4582
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4582
4583
  <fo:inline><xsl:apply-templates/></fo:inline>
4584
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4585
+ <fo:block>
4586
+ <xsl:apply-templates/>
4587
+ </fo:block>
4588
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4589
+ <fo:inline><xsl:apply-templates/></fo:inline>
4590
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4591
+ <fo:inline>
4592
+ <xsl:call-template name="text_input"/>
4593
+ </fo:inline>
4594
+ </xsl:template><xsl:template name="text_input">
4595
+ <xsl:variable name="count">
4596
+ <xsl:choose>
4597
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4598
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4599
+ <xsl:otherwise>10</xsl:otherwise>
4600
+ </xsl:choose>
4601
+ </xsl:variable>
4602
+ <xsl:call-template name="repeat">
4603
+ <xsl:with-param name="char" select="'_'"/>
4604
+ <xsl:with-param name="count" select="$count"/>
4605
+ </xsl:call-template>
4606
+ <xsl:text> </xsl:text>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4608
+ <xsl:variable name="caption">
4609
+ <xsl:choose>
4610
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4611
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4612
+ </xsl:choose>
4613
+ </xsl:variable>
4614
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4615
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4616
+ <fo:inline padding-right="1mm">
4617
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4618
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4619
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4620
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4621
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4622
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4623
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4624
+ </svg>
4625
+ </fo:instream-foreign-object>
4626
+ </fo:inline>
4627
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4628
+ <fo:inline padding-right="1mm">
4629
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4630
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4631
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4632
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4633
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4634
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4635
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4636
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4637
+ </svg>
4638
+ </fo:instream-foreign-object>
4639
+ </fo:inline>
4640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4641
+ <fo:inline>
4642
+ <xsl:call-template name="text_input"/>
4643
+ </fo:inline>
4644
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4645
+ <fo:block-container border="1pt solid black" width="50%">
4646
+ <fo:block> </fo:block>
4647
+ </fo:block-container>
4583
4648
  </xsl:template><xsl:template name="convertDate">
4584
4649
  <xsl:param name="date"/>
4585
4650
  <xsl:param name="format" select="'short'"/>
@@ -2028,6 +2028,7 @@
2028
2028
 
2029
2029
 
2030
2030
 
2031
+
2031
2032
  <xsl:if test=".//*[local-name() = 'table']">
2032
2033
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2033
2034
  </xsl:if>
@@ -4580,6 +4581,70 @@
4580
4581
  <xsl:value-of select="substring(.,1,1)"/>
4581
4582
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4582
4583
  <fo:inline><xsl:apply-templates/></fo:inline>
4584
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4585
+ <fo:block>
4586
+ <xsl:apply-templates/>
4587
+ </fo:block>
4588
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4589
+ <fo:inline><xsl:apply-templates/></fo:inline>
4590
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4591
+ <fo:inline>
4592
+ <xsl:call-template name="text_input"/>
4593
+ </fo:inline>
4594
+ </xsl:template><xsl:template name="text_input">
4595
+ <xsl:variable name="count">
4596
+ <xsl:choose>
4597
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4598
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4599
+ <xsl:otherwise>10</xsl:otherwise>
4600
+ </xsl:choose>
4601
+ </xsl:variable>
4602
+ <xsl:call-template name="repeat">
4603
+ <xsl:with-param name="char" select="'_'"/>
4604
+ <xsl:with-param name="count" select="$count"/>
4605
+ </xsl:call-template>
4606
+ <xsl:text> </xsl:text>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4608
+ <xsl:variable name="caption">
4609
+ <xsl:choose>
4610
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4611
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4612
+ </xsl:choose>
4613
+ </xsl:variable>
4614
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4615
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4616
+ <fo:inline padding-right="1mm">
4617
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4618
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4619
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4620
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4621
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4622
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4623
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4624
+ </svg>
4625
+ </fo:instream-foreign-object>
4626
+ </fo:inline>
4627
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4628
+ <fo:inline padding-right="1mm">
4629
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4630
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4631
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4632
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4633
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4634
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4635
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4636
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4637
+ </svg>
4638
+ </fo:instream-foreign-object>
4639
+ </fo:inline>
4640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4641
+ <fo:inline>
4642
+ <xsl:call-template name="text_input"/>
4643
+ </fo:inline>
4644
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4645
+ <fo:block-container border="1pt solid black" width="50%">
4646
+ <fo:block> </fo:block>
4647
+ </fo:block-container>
4583
4648
  </xsl:template><xsl:template name="convertDate">
4584
4649
  <xsl:param name="date"/>
4585
4650
  <xsl:param name="format" select="'short'"/>
@@ -2028,6 +2028,7 @@
2028
2028
 
2029
2029
 
2030
2030
 
2031
+
2031
2032
  <xsl:if test=".//*[local-name() = 'table']">
2032
2033
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2033
2034
  </xsl:if>
@@ -4580,6 +4581,70 @@
4580
4581
  <xsl:value-of select="substring(.,1,1)"/>
4581
4582
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4582
4583
  <fo:inline><xsl:apply-templates/></fo:inline>
4584
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4585
+ <fo:block>
4586
+ <xsl:apply-templates/>
4587
+ </fo:block>
4588
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4589
+ <fo:inline><xsl:apply-templates/></fo:inline>
4590
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4591
+ <fo:inline>
4592
+ <xsl:call-template name="text_input"/>
4593
+ </fo:inline>
4594
+ </xsl:template><xsl:template name="text_input">
4595
+ <xsl:variable name="count">
4596
+ <xsl:choose>
4597
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4598
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4599
+ <xsl:otherwise>10</xsl:otherwise>
4600
+ </xsl:choose>
4601
+ </xsl:variable>
4602
+ <xsl:call-template name="repeat">
4603
+ <xsl:with-param name="char" select="'_'"/>
4604
+ <xsl:with-param name="count" select="$count"/>
4605
+ </xsl:call-template>
4606
+ <xsl:text> </xsl:text>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4608
+ <xsl:variable name="caption">
4609
+ <xsl:choose>
4610
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4611
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4612
+ </xsl:choose>
4613
+ </xsl:variable>
4614
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4615
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4616
+ <fo:inline padding-right="1mm">
4617
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4618
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4619
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4620
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4621
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4622
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4623
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4624
+ </svg>
4625
+ </fo:instream-foreign-object>
4626
+ </fo:inline>
4627
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4628
+ <fo:inline padding-right="1mm">
4629
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4630
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4631
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4632
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4633
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4634
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4635
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4636
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4637
+ </svg>
4638
+ </fo:instream-foreign-object>
4639
+ </fo:inline>
4640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4641
+ <fo:inline>
4642
+ <xsl:call-template name="text_input"/>
4643
+ </fo:inline>
4644
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4645
+ <fo:block-container border="1pt solid black" width="50%">
4646
+ <fo:block> </fo:block>
4647
+ </fo:block-container>
4583
4648
  </xsl:template><xsl:template name="convertDate">
4584
4649
  <xsl:param name="date"/>
4585
4650
  <xsl:param name="format" select="'short'"/>
@@ -2028,6 +2028,7 @@
2028
2028
 
2029
2029
 
2030
2030
 
2031
+
2031
2032
  <xsl:if test=".//*[local-name() = 'table']">
2032
2033
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2033
2034
  </xsl:if>
@@ -4580,6 +4581,70 @@
4580
4581
  <xsl:value-of select="substring(.,1,1)"/>
4581
4582
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4582
4583
  <fo:inline><xsl:apply-templates/></fo:inline>
4584
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4585
+ <fo:block>
4586
+ <xsl:apply-templates/>
4587
+ </fo:block>
4588
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4589
+ <fo:inline><xsl:apply-templates/></fo:inline>
4590
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4591
+ <fo:inline>
4592
+ <xsl:call-template name="text_input"/>
4593
+ </fo:inline>
4594
+ </xsl:template><xsl:template name="text_input">
4595
+ <xsl:variable name="count">
4596
+ <xsl:choose>
4597
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4598
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4599
+ <xsl:otherwise>10</xsl:otherwise>
4600
+ </xsl:choose>
4601
+ </xsl:variable>
4602
+ <xsl:call-template name="repeat">
4603
+ <xsl:with-param name="char" select="'_'"/>
4604
+ <xsl:with-param name="count" select="$count"/>
4605
+ </xsl:call-template>
4606
+ <xsl:text> </xsl:text>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4608
+ <xsl:variable name="caption">
4609
+ <xsl:choose>
4610
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4611
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4612
+ </xsl:choose>
4613
+ </xsl:variable>
4614
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4615
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4616
+ <fo:inline padding-right="1mm">
4617
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4618
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4619
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4620
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4621
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4622
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4623
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4624
+ </svg>
4625
+ </fo:instream-foreign-object>
4626
+ </fo:inline>
4627
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4628
+ <fo:inline padding-right="1mm">
4629
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4630
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4631
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4632
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4633
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4634
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4635
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4636
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4637
+ </svg>
4638
+ </fo:instream-foreign-object>
4639
+ </fo:inline>
4640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4641
+ <fo:inline>
4642
+ <xsl:call-template name="text_input"/>
4643
+ </fo:inline>
4644
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4645
+ <fo:block-container border="1pt solid black" width="50%">
4646
+ <fo:block> </fo:block>
4647
+ </fo:block-container>
4583
4648
  </xsl:template><xsl:template name="convertDate">
4584
4649
  <xsl:param name="date"/>
4585
4650
  <xsl:param name="format" select="'short'"/>
@@ -2028,6 +2028,7 @@
2028
2028
 
2029
2029
 
2030
2030
 
2031
+
2031
2032
  <xsl:if test=".//*[local-name() = 'table']">
2032
2033
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2033
2034
  </xsl:if>
@@ -4580,6 +4581,70 @@
4580
4581
  <xsl:value-of select="substring(.,1,1)"/>
4581
4582
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4582
4583
  <fo:inline><xsl:apply-templates/></fo:inline>
4584
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4585
+ <fo:block>
4586
+ <xsl:apply-templates/>
4587
+ </fo:block>
4588
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4589
+ <fo:inline><xsl:apply-templates/></fo:inline>
4590
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4591
+ <fo:inline>
4592
+ <xsl:call-template name="text_input"/>
4593
+ </fo:inline>
4594
+ </xsl:template><xsl:template name="text_input">
4595
+ <xsl:variable name="count">
4596
+ <xsl:choose>
4597
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4598
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4599
+ <xsl:otherwise>10</xsl:otherwise>
4600
+ </xsl:choose>
4601
+ </xsl:variable>
4602
+ <xsl:call-template name="repeat">
4603
+ <xsl:with-param name="char" select="'_'"/>
4604
+ <xsl:with-param name="count" select="$count"/>
4605
+ </xsl:call-template>
4606
+ <xsl:text> </xsl:text>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4608
+ <xsl:variable name="caption">
4609
+ <xsl:choose>
4610
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4611
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4612
+ </xsl:choose>
4613
+ </xsl:variable>
4614
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4615
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4616
+ <fo:inline padding-right="1mm">
4617
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4618
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4619
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4620
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4621
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4622
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4623
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4624
+ </svg>
4625
+ </fo:instream-foreign-object>
4626
+ </fo:inline>
4627
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4628
+ <fo:inline padding-right="1mm">
4629
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4630
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4631
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4632
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4633
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4634
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4635
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4636
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4637
+ </svg>
4638
+ </fo:instream-foreign-object>
4639
+ </fo:inline>
4640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4641
+ <fo:inline>
4642
+ <xsl:call-template name="text_input"/>
4643
+ </fo:inline>
4644
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4645
+ <fo:block-container border="1pt solid black" width="50%">
4646
+ <fo:block> </fo:block>
4647
+ </fo:block-container>
4583
4648
  </xsl:template><xsl:template name="convertDate">
4584
4649
  <xsl:param name="date"/>
4585
4650
  <xsl:param name="format" select="'short'"/>
@@ -3,18 +3,18 @@ module IsoDoc
3
3
  class Xref < IsoDoc::Xref
4
4
  FRONT_CLAUSE = "//*[parent::preface]".freeze
5
5
 
6
- def initial_anchor_names(d)
7
- d.xpath(ns(self.class::FRONT_CLAUSE)).each do |c|
6
+ def initial_anchor_names(doc)
7
+ doc.xpath(ns(self.class::FRONT_CLAUSE)).each do |c|
8
8
  preface_names(c)
9
9
  sequential_asset_names(c)
10
10
  end
11
- middle_section_asset_names(d)
12
- clause_names(d, 0)
13
- termnote_anchor_names(d)
14
- termexample_anchor_names(d)
11
+ middle_section_asset_names(doc)
12
+ clause_names(doc, 0)
13
+ termnote_anchor_names(doc)
14
+ termexample_anchor_names(doc)
15
15
  end
16
16
 
17
- def annex_name_lbl(clause, num)
17
+ def annex_name_lbl(_clause, num)
18
18
  l10n("<strong>#{@labels['annex']} #{num}</strong>")
19
19
  end
20
20
 
@@ -31,20 +31,20 @@ module IsoDoc
31
31
  def container_names(clause, lvl)
32
32
  if clause["container"]
33
33
  @anchors[clause["id"]] =
34
- { label: nil, xref: clause.at(ns("./title"))&.text, level: lvl+1 }
34
+ { label: nil, xref: clause.at(ns("./title"))&.text, level: lvl + 1 }
35
35
  end
36
36
  clause.xpath(ns("./clause | ./term | ./terms | "\
37
37
  "./definitions")).each do |c|
38
- container_names(c, clause["container"] ? lvl+1 : lvl)
38
+ container_names(c, clause["container"] ? lvl + 1 : lvl)
39
39
  end
40
40
  end
41
41
 
42
- def sect_names(clause, num, i, lvl, prev_lvl)
42
+ def sect_names(clause, num, i, lvl, _prev_lvl)
43
43
  return i if clause.nil?
44
+
44
45
  curr = i
45
46
  if !clause["container"]
46
- retlvl = lvl
47
- i+=1
47
+ i += 1
48
48
  curr = i
49
49
  name = num.nil? ? i.to_s : "#{num}.#{i}"
50
50
  @anchors[clause["id"]] = { label: name, level: lvl + 1,
@@ -57,28 +57,29 @@ module IsoDoc
57
57
  if clause["container"]
58
58
  i, lvl = sect_names(c, num, i, lvl, lvl)
59
59
  else
60
- j, prev = sect_names(c, name, j, lvl+1, prev)
60
+ j, prev = sect_names(c, name, j, lvl + 1, prev)
61
61
  end
62
62
  end
63
- i = j if j >0
63
+ i = j if j.positive?
64
64
  i = curr if lvl < prev
65
65
  [i, prev]
66
66
  end
67
67
 
68
- def annex_naming(c, num, lvl, i)
69
- if c["guidance"] then annex_names1(c, "#{num}E", lvl + 1)
68
+ def annex_naming(clause, num, lvl, idx)
69
+ if clause["guidance"] then annex_names1(clause, "#{num}E", lvl + 1)
70
70
  else
71
- i+= 1 unless c["container"]
72
- annex_names1(c, "#{num}.#{i}", lvl + 1)
71
+ idx += 1 unless clause["container"]
72
+ annex_names1(clause, "#{num}.#{idx}", lvl + 1)
73
73
  end
74
- i
74
+ idx
75
75
  end
76
76
 
77
77
  def annex_names(clause, num)
78
- @anchors[clause["id"]] = { label: annex_name_lbl(clause, num), value: num,
79
- xref: l10n("#{@labels['annex']} #{num}"), level: 1 }
78
+ @anchors[clause["id"]] =
79
+ { label: annex_name_lbl(clause, num), value: num,
80
+ xref: l10n("#{@labels['annex']} #{num}"), level: 1 }
80
81
  if a = single_annex_special_section(clause)
81
- annex_names1(a, "#{num}", 1)
82
+ annex_names1(a, num.to_s, 1)
82
83
  else
83
84
  i = 0
84
85
  clause.xpath(ns("./clause | ./references")).each do |c|
@@ -90,8 +91,11 @@ module IsoDoc
90
91
  end
91
92
 
92
93
  def annex_names1(clause, num, level)
93
- clause["container"] or @anchors[clause["id"]] =
94
- { label: num, xref: l10n("#{@labels['annex']} #{num}"), level: level }
94
+ unless clause["container"]
95
+ @anchors[clause["id"]] =
96
+ { label: num,
97
+ xref: l10n("#{@labels['annex']} #{num}"), level: level }
98
+ end
95
99
  i = 0
96
100
  clause.xpath(ns("./clause | ./references")).each do |c|
97
101
  i = annex_naming(c, num, level, i)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module MPFA
3
- VERSION = "0.6.1".freeze
3
+ VERSION = "0.6.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-mpfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.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-04-26 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities