metanorma-ieee 1.0.15 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1061,23 +1061,22 @@
1061
1061
  <fo:flow flow-name="xsl-region-body">
1062
1062
  <!-- debugpage=<xsl:copy-of select="."/> -->
1063
1063
 
1064
- <xsl:if test="position() = 1">
1065
-
1064
+ <!-- <xsl:if test="position() = 1">
1065
+
1066
1066
  <xsl:choose>
1067
1067
  <xsl:when test="$current_template = 'draft'">
1068
1068
  <fo:block font-family="Arial" font-size="23pt" font-weight="bold" margin-top="70pt" margin-bottom="48pt">
1069
-
1069
+
1070
1070
  <xsl:if test="contains('amendment corrigendum erratum', $subdoctype) and $subdoctype != ''">
1071
1071
  <xsl:attribute name="font-size">24pt</xsl:attribute>
1072
1072
  </xsl:if>
1073
-
1073
+
1074
1074
  <xsl:copy-of select="$title_prefix"/>
1075
1075
  <xsl:copy-of select="$title"/>
1076
-
1077
- <!-- <xsl:copy-of select="$draft_title_part"/> -->
1076
+
1078
1077
  </fo:block>
1079
1078
  </xsl:when>
1080
-
1079
+
1081
1080
  <xsl:when test="$current_template = 'standard'">
1082
1081
  <fo:block font-family="Arial" font-weight="bold" margin-top="13mm" space-after="12pt">
1083
1082
  <fo:block font-weight="bold" space-before="13mm">
@@ -1085,30 +1084,21 @@
1085
1084
  </fo:block>
1086
1085
  </fo:block>
1087
1086
  </xsl:when>
1087
+
1088
+ <xsl:otherwise> --><!-- $current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report' -->
1088
1089
 
1089
- <xsl:otherwise> <!-- $current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report' -->
1090
-
1091
- <xsl:attribute name="font-family">Calibri Light</xsl:attribute>
1090
+ <!-- <xsl:attribute name="font-family">Calibri Light</xsl:attribute>
1092
1091
  <xsl:attribute name="font-size">12pt</xsl:attribute>
1093
-
1092
+
1094
1093
  <fo:block font-family="Arial Black" font-size="20pt" margin-top="18pt">
1095
1094
  <xsl:copy-of select="$title"/>
1096
- <!-- <xsl:copy-of select="$draft_title_part"/> -->
1097
1095
  </fo:block>
1098
1096
  <xsl:call-template name="addBlueBox"/>
1099
- <!-- <fo:block font-size="1" margin-top="3mm">
1100
- <fo:instream-foreign-object content-width="57mm" content-height="3mm" scaling="non-uniform" fox:alt-text="Image Box">
1101
- <xsl:call-template name="insertImageBoxSVG">
1102
- <xsl:with-param name="color"><xsl:value-of select="$color_blue"/></xsl:with-param>
1103
- </xsl:call-template>
1104
- </fo:instream-foreign-object>
1105
- </fo:block>
1106
- <fo:block margin-top="12pt" margin-bottom="12pt">&#xa0;</fo:block> -->
1107
- <fo:block margin-bottom="12pt"> </fo:block>
1097
+ <fo:block margin-bottom="12pt">&#xa0;</fo:block>
1108
1098
  </xsl:otherwise>
1109
1099
  </xsl:choose>
1110
-
1111
- </xsl:if>
1100
+
1101
+ </xsl:if> -->
1112
1102
 
1113
1103
  <xsl:apply-templates select="*" mode="page"/>
1114
1104
  <xsl:if test="position() = last()"><fo:block id="lastBlockMain"/></xsl:if>
@@ -1736,6 +1726,32 @@
1736
1726
  </xsl:choose>
1737
1727
  </xsl:template>
1738
1728
 
1729
+ <xsl:template match="ieee:p[@class = 'zzSTDTitle1']" priority="4">
1730
+ <xsl:choose>
1731
+ <xsl:when test="$current_template = 'draft'">
1732
+ <fo:block font-family="Arial" font-size="23pt" font-weight="bold" margin-top="70pt" margin-bottom="48pt">
1733
+ <xsl:if test="contains('amendment corrigendum erratum', $subdoctype) and $subdoctype != ''">
1734
+ <xsl:attribute name="font-size">24pt</xsl:attribute>
1735
+ </xsl:if>
1736
+ <xsl:apply-templates/>
1737
+ </fo:block>
1738
+ </xsl:when>
1739
+ <xsl:when test="$current_template = 'standard'">
1740
+ <fo:block font-family="Arial" font-weight="bold" margin-top="13mm" space-after="12pt">
1741
+ <xsl:apply-templates/>
1742
+ </fo:block>
1743
+ </xsl:when>
1744
+ <xsl:otherwise> <!-- $current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report' -->
1745
+
1746
+ <fo:block font-family="Arial Black" font-size="20pt" margin-top="18pt">
1747
+ <xsl:apply-templates/>
1748
+ </fo:block>
1749
+ <xsl:call-template name="addBlueBox"/>
1750
+ <fo:block margin-bottom="12pt"> </fo:block>
1751
+ </xsl:otherwise>
1752
+ </xsl:choose>
1753
+ </xsl:template>
1754
+
1739
1755
  <xsl:template match="node()">
1740
1756
  <xsl:apply-templates/>
1741
1757
  </xsl:template>
@@ -4056,11 +4072,26 @@
4056
4072
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
4057
4073
  </xsl:if>
4058
4074
 
4059
- <xsl:value-of select="."/>
4075
+ <xsl:variable name="font_family" select="."/>
4060
4076
 
4061
- <xsl:if test="$additional_fonts != ''">
4062
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4063
- </xsl:if>
4077
+ <xsl:choose>
4078
+ <xsl:when test="$additional_fonts = ''">
4079
+ <xsl:value-of select="$font_family"/>
4080
+ </xsl:when>
4081
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
4082
+ <xsl:choose>
4083
+ <xsl:when test="contains($font_family, ',')">
4084
+ <xsl:value-of select="substring-before($font_family, ',')"/>
4085
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4086
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
4087
+ </xsl:when>
4088
+ <xsl:otherwise>
4089
+ <xsl:value-of select="$font_family"/>
4090
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4091
+ </xsl:otherwise>
4092
+ </xsl:choose>
4093
+ </xsl:otherwise>
4094
+ </xsl:choose>
4064
4095
  </xsl:attribute>
4065
4096
  </xsl:when>
4066
4097
  <xsl:otherwise>
@@ -6668,21 +6699,21 @@
6668
6699
 
6669
6700
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
6670
6701
 
6671
- <fo:block xsl:use-attribute-sets="table-note-style">
6702
+ <fo:block xsl:use-attribute-sets="table-note-style">
6672
6703
 
6673
- <xsl:call-template name="refine_table-note-style"/>
6704
+ <xsl:call-template name="refine_table-note-style"/>
6674
6705
 
6675
- <!-- Table's note/example name (NOTE, for example) -->
6676
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
6706
+ <!-- Table's note/example name (NOTE, for example) -->
6707
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
6677
6708
 
6678
- <xsl:call-template name="refine_table-note-name-style"/>
6709
+ <xsl:call-template name="refine_table-note-name-style"/>
6679
6710
 
6680
- <xsl:apply-templates select="*[local-name() = 'name']"/>
6711
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
6681
6712
 
6682
- </fo:inline>
6713
+ </fo:inline>
6683
6714
 
6684
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6685
- </fo:block>
6715
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6716
+ </fo:block>
6686
6717
 
6687
6718
  </xsl:template> <!-- table/note -->
6688
6719
 
@@ -7747,6 +7778,9 @@
7747
7778
  <!-- END Definition List -->
7748
7779
  <!-- ===================== -->
7749
7780
 
7781
+ <!-- default: ignore title in sections/p -->
7782
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
7783
+
7750
7784
  <!-- ========================= -->
7751
7785
  <!-- Rich text formatting -->
7752
7786
  <!-- ========================= -->
@@ -9797,8 +9831,12 @@
9797
9831
  <xsl:variable name="isAdded" select="../@added"/>
9798
9832
  <xsl:variable name="isDeleted" select="../@deleted"/>
9799
9833
  <xsl:choose>
9800
- <xsl:when test="ancestor::*[local-name() = 'title']">
9834
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
9801
9835
  <fo:inline padding-left="1mm" padding-right="1mm">
9836
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
9837
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
9838
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9839
+ </xsl:if>
9802
9840
  <xsl:variable name="src">
9803
9841
  <xsl:call-template name="image_src"/>
9804
9842
  </xsl:variable>
@@ -9831,25 +9869,45 @@
9831
9869
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
9832
9870
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
9833
9871
 
9834
- <xsl:variable name="img_src">
9835
- <xsl:choose>
9836
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
9837
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9838
- </xsl:choose>
9839
- </xsl:variable>
9872
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
9873
+ <xsl:attribute name="width">
9874
+ <xsl:value-of select="@width"/>
9875
+ </xsl:attribute>
9876
+ </xsl:if>
9840
9877
 
9841
- <xsl:variable name="image_width_effective">
9878
+ <xsl:if test="@height != '' and @height != 'auto'">
9879
+ <xsl:attribute name="height">
9880
+ <xsl:value-of select="@height"/>
9881
+ </xsl:attribute>
9882
+ </xsl:if>
9842
9883
 
9843
- <xsl:value-of select="$width_effective"/>
9884
+ <xsl:choose>
9885
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
9886
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
9887
+ </xsl:when>
9888
+ <xsl:otherwise>
9844
9889
 
9845
- </xsl:variable>
9890
+ <xsl:variable name="img_src">
9891
+ <xsl:choose>
9892
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
9893
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9894
+ </xsl:choose>
9895
+ </xsl:variable>
9846
9896
 
9847
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9848
- <xsl:if test="number($scale) &lt; 100">
9897
+ <xsl:variable name="image_width_effective">
9849
9898
 
9850
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9899
+ <xsl:value-of select="$width_effective"/>
9851
9900
 
9852
- </xsl:if>
9901
+ </xsl:variable>
9902
+
9903
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9904
+ <xsl:if test="number($scale) &lt; 100">
9905
+
9906
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9907
+
9908
+ </xsl:if>
9909
+ </xsl:otherwise>
9910
+ </xsl:choose>
9853
9911
 
9854
9912
  </xsl:if>
9855
9913
 
@@ -13544,7 +13602,7 @@
13544
13602
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
13545
13603
  <xsl:apply-templates mode="update_xml_step1"/>
13546
13604
  </xsl:template>
13547
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
13605
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
13548
13606
  <xsl:copy>
13549
13607
  <xsl:copy-of select="@*"/>
13550
13608
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -24,6 +24,47 @@ module IsoDoc
24
24
  def fileloc(loc)
25
25
  File.join(File.dirname(__FILE__), loc)
26
26
  end
27
+
28
+ def std_docid_semantic(id)
29
+ id.nil? and return nil
30
+ ret = Nokogiri::XML.fragment(id)
31
+ ret.traverse do |x|
32
+ x.text? or next
33
+ x.replace(std_docid_semantic1(x.text))
34
+ end
35
+ to_xml(ret)
36
+ end
37
+
38
+ def std_docid_semantic1(id)
39
+ ids = id.split(/\p{Zs}/)
40
+ agency?(ids[0].sub(/\/.*$/, "")) or return id
41
+ std_docid_semantic_full(id)
42
+ end
43
+
44
+ # AGENCY+ TYPE NUMBER YEAR
45
+ def std_docid_semantic_full(ident)
46
+ m = ident.match(%r{(?<text>[^0-9]+\p{Zs})
47
+ (?<num>[0-9]+)
48
+ (?:[:](?<yr>(?:19|20)\d\d))?}x)
49
+ m or return ident
50
+ ret = std_docid_sdo(m[:text]) +
51
+ "<span class='std_docNumber'>#{m[:num]}</span>"
52
+ m[:yr] and ret += ":<span class='std_year'>#{m[:yr]}</span>"
53
+ ret
54
+ end
55
+
56
+ def std_docid_sdo(text)
57
+ found = false
58
+ text.split(%r{([\p{Zs}|/]+)}).reverse.map do |x|
59
+ if /[A-Za-z]/.match?(x)
60
+ k = if found || agency?(x) then "std_publisher"
61
+ else "std_documentType"
62
+ end
63
+ found = true
64
+ "<span class='#{k}'>#{x}</span>"
65
+ else x end
66
+ end.reverse.join
67
+ end
27
68
  end
28
69
  end
29
70
  end
@@ -0,0 +1,100 @@
1
+ module IsoDoc
2
+ module IEEE
3
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
+ def bibdata_i18n(bib)
5
+ super
6
+ bibdata_dates(bib)
7
+ end
8
+
9
+ def bibdata_dates(bib)
10
+ bib.xpath(ns("./date")).each do |d|
11
+ d.next = d.dup
12
+ d.next["format"] = "ddMMMyyyy"
13
+ d.next.xpath(ns("./from | ./to | ./on")).each do |x|
14
+ x.children = ddMMMyyyy(x.text)
15
+ end
16
+ end
17
+ end
18
+
19
+ def ddMMMyyyy(isodate)
20
+ return nil if isodate.nil?
21
+
22
+ arr = isodate.split("-")
23
+ if arr.size == 1 && (/^\d+$/.match isodate)
24
+ Date.new(*arr.map(&:to_i)).strftime("%Y")
25
+ elsif arr.size == 2
26
+ Date.new(*arr.map(&:to_i)).strftime("%b %Y")
27
+ else
28
+ Date.parse(isodate).strftime("%d %b %Y")
29
+ end
30
+ end
31
+
32
+ def boilerplate(docxml)
33
+ docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/" \
34
+ "clause/title")).each(&:remove)
35
+ docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/clause"))
36
+ .each do |clause|
37
+ participants(clause)
38
+ end
39
+ end
40
+
41
+ def participants(clause)
42
+ clause.xpath(ns(".//ul")).each_with_index do |ulist, idx|
43
+ ulist.xpath(ns("./li")).each { |list| participants1(list, idx) }
44
+ ulist.replace(ulist.children)
45
+ end
46
+ affiliation_header(clause)
47
+ end
48
+
49
+ def affiliation_header(clause)
50
+ clause.xpath(ns(".//p[@type = 'officeorgrepmember']")).each do |p|
51
+ prev = p.previous_element
52
+ prev && prev.name == "p" &&
53
+ prev["type"] == "officeorgrepmember" and next
54
+ p.previous = <<~HDR
55
+ <p type='officeorgrepmemberhdr'><em>Organization
56
+ Represented</em><tab/><em>Name of Representative</em></p>
57
+ HDR
58
+ end
59
+ end
60
+
61
+ def participants1(list, idx)
62
+ key = ""
63
+ map = list.xpath(ns(".//dt | .//dd")).each_with_object({}) do |dtd, m|
64
+ (dtd.name == "dt" and key = dtd.text) or
65
+ m[key] = @c.encode(dtd.text.strip, :hexadecimal)
66
+ end
67
+ list.replace(participant_para(map, idx))
68
+ end
69
+
70
+ def participant_para(map, idx)
71
+ name = participant_name(map)
72
+ if map["role"]&.casecmp("member")&.zero?
73
+ participant_member_para(map, name, idx)
74
+ else
75
+ participant_officeholder_para(map, name, idx)
76
+ end
77
+ end
78
+
79
+ def participant_member_para(map, name, _idx)
80
+ if map["company"] && (map["name"] || map["surname"])
81
+ pers = map["name"] || "#{map['given']} #{map['surname']}"
82
+ "<p type='officeorgrepmember'>#{name}<tab/>#{pers}</p>"
83
+ elsif map["company"] then "<p type='officeorgmember'>#{name}</p>"
84
+ else "<p type='officemember'>#{name}</p>"
85
+ end
86
+ end
87
+
88
+ def participant_officeholder_para(map, name, idx)
89
+ name = "<strong>#{name}</strong>" if idx.zero?
90
+ br = map["role"].size > 30 ? "<br/>" : ""
91
+ "<p type='officeholder' align='center'>#{name}, #{br}" \
92
+ "<em>#{map['role']}</em></p>"
93
+ end
94
+
95
+ def participant_name(map)
96
+ map["company"] || map["name"] || "#{map['given']} #{map['surname']}"
97
+ end
98
+ end
99
+ end
100
+ end
@@ -29,7 +29,7 @@ module IsoDoc
29
29
  b.at(ns("./formattedref")))&.text,
30
30
  author: @author[b["id"]] || (b.at(ns("./title")) ||
31
31
  b.at(ns("./formattedref")))&.text,
32
- ord: b.at(ns("./docidentifier[@type = 'metanorma' or "\
32
+ ord: b.at(ns("./docidentifier[@type = 'metanorma' or " \
33
33
  "@type = 'metanorma-ordinal']"))&.text }
34
34
  end
35
35
  end
@@ -78,6 +78,10 @@ module IsoDoc
78
78
  end
79
79
  idx
80
80
  end
81
+
82
+ def expand_citeas(text)
83
+ std_docid_semantic(super)
84
+ end
81
85
  end
82
86
  end
83
87
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "init"
2
+ require_relative "presentation_bibdata"
2
3
  require_relative "presentation_terms"
3
4
  require_relative "presentation_ref"
4
5
  require "isodoc"
@@ -25,7 +26,6 @@ module IsoDoc
25
26
 
26
27
  def prefix_clause(target, loc)
27
28
  loc["type"] == "clause" or return loc["type"]
28
-
29
29
  if subclause?(target, loc["type"],
30
30
  loc&.at(ns("./referenceFrom"))&.text)
31
31
  ""
@@ -79,20 +79,6 @@ module IsoDoc
79
79
  prefix_name(elem, block_delim, lbl, "name")
80
80
  end
81
81
 
82
- def display_order(docxml)
83
- i = 0
84
- i = display_order_xpath(docxml, "//preface/*", i)
85
- i = display_order_at(docxml, "//clause[@type = 'overview']", i)
86
- i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
87
- i = display_order_at(docxml, "//sections/terms | " \
88
- "//sections/clause[descendant::terms]", i)
89
- i = display_order_at(docxml, "//sections/definitions", i)
90
- i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
91
- i = display_order_xpath(docxml, "//annex", i)
92
- i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
93
- display_order_xpath(docxml, "//indexsect", i)
94
- end
95
-
96
82
  def annex1(elem)
97
83
  lbl = @xrefs.anchor(elem["id"], :label)
98
84
  if t = elem.at(ns("./title"))
@@ -101,34 +87,6 @@ module IsoDoc
101
87
  prefix_name(elem, "<br/>", lbl, "title")
102
88
  end
103
89
 
104
- def bibdata_i18n(bib)
105
- super
106
- bibdata_dates(bib)
107
- end
108
-
109
- def bibdata_dates(bib)
110
- bib.xpath(ns("./date")).each do |d|
111
- d.next = d.dup
112
- d.next["format"] = "ddMMMyyyy"
113
- d.next.xpath(ns("./from | ./to | ./on")).each do |x|
114
- x.children = ddMMMyyyy(x.text)
115
- end
116
- end
117
- end
118
-
119
- def ddMMMyyyy(isodate)
120
- return nil if isodate.nil?
121
-
122
- arr = isodate.split("-")
123
- if arr.size == 1 && (/^\d+$/.match isodate)
124
- Date.new(*arr.map(&:to_i)).strftime("%Y")
125
- elsif arr.size == 2
126
- Date.new(*arr.map(&:to_i)).strftime("%b %Y")
127
- else
128
- Date.parse(isodate).strftime("%d %b %Y")
129
- end
130
- end
131
-
132
90
  def amend1(elem)
133
91
  elem.xpath(ns("./description/p")).each do |p|
134
92
  p.children = to_xml(p.children).strip
@@ -151,73 +109,6 @@ module IsoDoc
151
109
  super
152
110
  end
153
111
 
154
- def boilerplate(docxml)
155
- docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/" \
156
- "clause/title")).each(&:remove)
157
- docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/clause"))
158
- .each do |clause|
159
- participants(clause)
160
- end
161
- end
162
-
163
- def participants(clause)
164
- clause.xpath(ns(".//ul")).each_with_index do |ulist, idx|
165
- ulist.xpath(ns("./li")).each { |list| participants1(list, idx) }
166
- ulist.replace(ulist.children)
167
- end
168
- affiliation_header(clause)
169
- end
170
-
171
- def affiliation_header(clause)
172
- clause.xpath(ns(".//p[@type = 'officeorgrepmember']")).each do |p|
173
- prev = p.previous_element
174
- prev && prev.name == "p" &&
175
- prev["type"] == "officeorgrepmember" and next
176
- p.previous = <<~HDR
177
- <p type='officeorgrepmemberhdr'><em>Organization
178
- Represented</em><tab/><em>Name of Representative</em></p>
179
- HDR
180
- end
181
- end
182
-
183
- def participants1(list, idx)
184
- key = ""
185
- map = list.xpath(ns(".//dt | .//dd")).each_with_object({}) do |dtd, m|
186
- (dtd.name == "dt" and key = dtd.text) or
187
- m[key] = @c.encode(dtd.text.strip, :hexadecimal)
188
- end
189
- list.replace(participant_para(map, idx))
190
- end
191
-
192
- def participant_para(map, idx)
193
- name = participant_name(map)
194
- if map["role"]&.casecmp("member")&.zero?
195
- participant_member_para(map, name, idx)
196
- else
197
- participant_officeholder_para(map, name, idx)
198
- end
199
- end
200
-
201
- def participant_member_para(map, name, _idx)
202
- if map["company"] && (map["name"] || map["surname"])
203
- pers = map["name"] || "#{map['given']} #{map['surname']}"
204
- "<p type='officeorgrepmember'>#{name}<tab/>#{pers}</p>"
205
- elsif map["company"] then "<p type='officeorgmember'>#{name}</p>"
206
- else "<p type='officemember'>#{name}</p>"
207
- end
208
- end
209
-
210
- def participant_officeholder_para(map, name, idx)
211
- name = "<strong>#{name}</strong>" if idx.zero?
212
- br = map["role"].size > 30 ? "<br/>" : ""
213
- "<p type='officeholder' align='center'>#{name}, #{br}" \
214
- "<em>#{map['role']}</em></p>"
215
- end
216
-
217
- def participant_name(map)
218
- map["company"] || map["name"] || "#{map['given']} #{map['surname']}"
219
- end
220
-
221
112
  def asciimath_dup(node)
222
113
  @suppressasciimathdup and return
223
114
  super
@@ -243,9 +134,15 @@ module IsoDoc
243
134
  end
244
135
 
245
136
  def ol_numbering(docxml)
246
- docxml.xpath(ns("//clause | //annex | //foreword | //acknowledgements | //introduction | //preface/abstract | //appendix | //terms | //term | //definitions | //references | //colophon")).each do |_c|
247
- (docxml.xpath(ns(".//ol")) -
248
- docxml.xpath(ns("./clause//ol | ./appendix//ol | ./term//ol | ./terms//ol | ./definitions//ol | /references//ol | ./colophon//ol"))).each_with_index do |o, i|
137
+ p = "//clause | //annex | //foreword | //acknowledgements | " \
138
+ "//introduction | //preface/abstract | //appendix | //terms | " \
139
+ "//term | //definitions | //references | //colophon"
140
+ docxml.xpath(ns(p)).each do |c|
141
+ (c.xpath(ns(".//ol")) -
142
+ c.xpath(ns("./clause//ol | ./appendix//ol | ./term//ol | " \
143
+ "./terms//ol | ./definitions//ol | " \
144
+ "/references//ol | ./colophon//ol")))
145
+ .each_with_index do |o, i|
249
146
  ol_numbering1(o, i)
250
147
  end
251
148
  end
@@ -266,6 +163,17 @@ module IsoDoc
266
163
  type
267
164
  end
268
165
 
166
+ def middle_title(docxml)
167
+ s = docxml.at(ns("//sections")) or return
168
+ ret = "<p class='zzSTDTitle1'>#{@meta.get[:full_doctitle]}"
169
+ @meta.get[:amd] || @meta.get[:corr] and ret += "<br/>"
170
+ @meta.get[:amd] and ret += "Amendment #{@meta.get[:amd]}"
171
+ @meta.get[:amd] && @meta.get[:corr] and ret += " "
172
+ @meta.get[:corr] and ret += "Corrigenda #{@meta.get[:corr]}"
173
+ ret += "</p>"
174
+ s.children.first.previous = ret
175
+ end
176
+
269
177
  include Init
270
178
  end
271
179
  end
@@ -50,32 +50,34 @@ module IsoDoc
50
50
  def abstract(clause, out)
51
51
  page_break(out)
52
52
  out.div **attr_code(id: clause["id"], class: "abstract") do |s|
53
- clause_name(clause, clause.at(ns("./title")), s, { class: "AbstractTitle" })
53
+ clause_name(clause, clause.at(ns("./title")), s,
54
+ { class: "AbstractTitle" })
54
55
  clause.elements.each { |e| parse(e, s) unless e.name == "title" }
55
56
  end
56
57
  end
57
58
 
59
+ MAIN_ELEMENTS =
60
+ "//sections/*[@displayorder][not(@class = 'zzSTDTitle1')] | " \
61
+ "//annex[@displayorder] | " \
62
+ "//bibliography/*[@displayorder] | //colophon/*[@displayorder] | " \
63
+ "//indexsect[@displayorder]".freeze
64
+
58
65
  def make_body3(body, docxml)
59
- body.div class: "WordSectionMiddleTitle" do |_div3|
60
- middle_title_ieee(docxml, body)
66
+ body.div class: "WordSectionMiddleTitle" do |div3|
67
+ middle_title_ieee(docxml, div3)
61
68
  end
62
69
  section_break(body, continuous: true)
63
70
  body.div class: "WordSectionMain" do |div3|
64
- middle docxml, div3
71
+ content(div3, docxml, ns(self.class::MAIN_ELEMENTS))
65
72
  footnotes div3
66
73
  comments div3
67
74
  end
68
75
  end
69
76
 
70
- def middle_title(isoxml, out); end
71
-
72
- def middle_title_ieee(_docxml, out)
77
+ def middle_title_ieee(docxml, out)
78
+ title = docxml.at(ns("//p[@class = 'zzSTDTitle1']")) or return
73
79
  out.p(class: "IEEEStdsTitle", style: "margin-top:70.0pt") do |p|
74
- p << @meta.get[:full_doctitle]
75
- @meta.get[:amd] || @meta.get[:corr] and p << "<br/>"
76
- @meta.get[:amd] and p << "Amendment #{@meta.get[:amd]}"
77
- @meta.get[:amd] && @meta.get[:corr] and p << " "
78
- @meta.get[:corr] and p << "Corrigenda #{@meta.get[:corr]}"
80
+ title.children.each { |n| parse(n, p) }
79
81
  end
80
82
  end
81
83
 
@@ -137,7 +139,6 @@ module IsoDoc
137
139
  end
138
140
 
139
141
  def annex_name(_annex, name, div)
140
- preceding_floating_titles(name, div)
141
142
  return if name.nil?
142
143
 
143
144
  name&.at(ns("./strong"))&.remove # supplied by CSS list numbering