metanorma-ogc 2.5.7 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -186,6 +186,13 @@ module IsoDoc
186
186
  elem << "&#xa0;<span class='AdmittedLabel'>#{@i18n.admitted}</span>"
187
187
  end
188
188
 
189
+ def source_label(elem)
190
+ labelled_ancestor(elem) and return
191
+ lbl = @xrefs.anchor(elem["id"], :label, false) or return
192
+ prefix_name(elem, block_delim,
193
+ l10n("#{lower2cap @i18n.sourcecode} #{lbl}"), "name")
194
+ end
195
+
189
196
  include Init
190
197
  end
191
198
  end
@@ -19,8 +19,6 @@ module IsoDoc
19
19
  end
20
20
  end
21
21
 
22
- # ["//preface/abstract", "//preface/clause[@type = 'executivesummary']", "//preface/clause[@type = 'keywords']", "//foreword", "//preface/clause[@type = 'security']", "//preface/clause[@type = 'submitting_orgs']", "//submitters", "//introduction"]
23
-
24
22
  def middle_section_asset_names(doc)
25
23
  middle_sections =
26
24
  "//clause[@type = 'scope' or @type = 'conformance'] | //foreword | " \
@@ -80,7 +78,8 @@ module IsoDoc
80
78
  @anchors[ref["id"]] = { xref: "#{@anchors[ref['id']][:xref]} (draft)" }
81
79
  end
82
80
 
83
- def sequential_permission_body(id, block, label, klass, model, container: false)
81
+ def sequential_permission_body(id, block, label, klass, model,
82
+ container: false)
84
83
  @anchors[block["id"]] = model.postprocess_anchor_struct(
85
84
  block, anchor_struct(id, container ? block : nil,
86
85
  label, klass, block["unnumbered"])
@@ -90,6 +89,45 @@ module IsoDoc
90
89
  n[:klass], false)
91
90
  end
92
91
  end
92
+
93
+ FIGURE_NO_CLASS = ".//figure[not(@class)]".freeze
94
+
95
+ LISTING = <<~XPATH.freeze
96
+ .//figure[@class = 'pseudocode'] | .//sourcecode[not(ancestor::example)]
97
+ XPATH
98
+
99
+ def sequential_asset_names(clause, container: false)
100
+ super
101
+ sequential_sourcecode_names(clause, container: container)
102
+ end
103
+
104
+ def sequential_sourcecode_names(clause, container: false)
105
+ c = Counter.new
106
+ clause.xpath(ns(LISTING)).noblank.each do |t|
107
+ c.increment(t)
108
+ @anchors[t["id"]] = anchor_struct(
109
+ c.print, container ? t : nil,
110
+ @labels["sourcecode"], "sourcecode",
111
+ t["unnumbered"]
112
+ )
113
+ end
114
+ end
115
+
116
+ def hierarchical_asset_names(clause, num)
117
+ super
118
+ hierarchical_sourcecode_names(clause, num)
119
+ end
120
+
121
+ def hierarchical_sourcecode_names(clause, num)
122
+ c = Counter.new
123
+ clause.xpath(ns(LISTING)).noblank.each do |t|
124
+ c.increment(t)
125
+ label = "#{num}#{hiersep}#{c.print}"
126
+ @anchors[t["id"]] =
127
+ anchor_struct(label, nil, @labels["sourcecode"],
128
+ "sourcecode", t["unnumbered"])
129
+ end
130
+ end
93
131
  end
94
132
  end
95
133
  end