Skip to content

Commit 9762847

Browse files
committed
https://github.com/metanorma/isodoc/issues/617
1 parent e3757c5 commit 9762847

File tree

1 file changed

+0
-118
lines changed

1 file changed

+0
-118
lines changed

lib/isodoc/jis/xref.rb

-118
Original file line numberDiff line numberDiff line change
@@ -93,42 +93,6 @@ def annex_name_lbl(clause, num)
9393
super.gsub(%r{</?strong>}, "")
9494
end
9595

96-
def annex_names1(clause, parentnum, num, level)
97-
#require "debug"; binding.b if level == 2
98-
super
99-
end
100-
101-
=begin cf. isodoc:
102-
def annex_name_anchors(clause, num, level)
103-
label = num
104-
level == 1 && clause.name == "annex" and
105-
label = annex_name_lbl(clause, label)
106-
xref = labelled_autonum(@labels["annex"], num)
107-
c = clause_title(clause) and title = semx(clause, c, "title")
108-
@anchors[clause["id"]] =
109-
{ label:, xref:, title:,
110-
elem: @labels["annex"], type: "clause",
111-
subtype: "annex", value: num.to_s, level: }
112-
end
113-
=end
114-
115-
# KILL?
116-
=begin
117-
def annex_name_anchors1(clause, num, level)
118-
@anchors[clause["id"]] =
119-
{ xref: num, label: num, level: level,
120-
subtype: "annex" }
121-
end
122-
123-
def annex_names1(clause, num, level)
124-
annex_name_anchors1(clause, num, level)
125-
i = clause_counter(0, prefix: num)
126-
clause.xpath(ns(SUBCLAUSES)).each do |c|
127-
annex_names1(c, i.increment(c).print, level + 1)
128-
end
129-
end
130-
=end
131-
13296
def annex_name_anchors1(clause, num, level)
13397
super
13498
# undo ISO "Clause A.2" in favour of "A.2"
@@ -247,88 +211,6 @@ def list_anchor_names(s)
247211
#require "debug"; binding.b
248212
end
249213

250-
# FROM ISODOC
251-
=begin
252-
def list_anchor_names(sections)
253-
sections.each do |s|
254-
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
255-
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
256-
c = list_counter(0, {})
257-
notes.noblank.each do |n|
258-
@anchors[n["id"]] =
259-
anchor_struct(increment_label(notes, n, c), n,
260-
@labels["list"], "list",
261-
{ unnumb: false, container: true })
262-
list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
263-
end
264-
list_anchor_names(s.xpath(ns(child_sections)))
265-
end
266-
end
267-
268-
def list_item_delim
269-
'<span class="fmt-autonum-delim">)</span>'
270-
end
271-
272-
def list_item_anchor_names(list, list_anchor, depth, prev_label,
273-
refer_list)
274-
c = list_counter(list["start"] ? list["start"].to_i - 1 : 0)
275-
list.xpath(ns("./li")).each do |li|
276-
bare_label, label =
277-
list_item_value(li, c, depth,
278-
{ list_anchor:, prev_label:,
279-
refer_list: depth == 1 ? refer_list : nil })
280-
li["id"] ||= "_#{UUIDTools::UUID.random_create}"
281-
@anchors[li["id"]] =
282-
{ label: bare_label, bare_xref: "#{label})", type: "listitem",
283-
xref: %[#{label}#{list_item_delim}], refer_list:,
284-
container: list_anchor[:container] }
285-
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
286-
list_item_anchor_names(ol, list_anchor, depth + 1, label,
287-
refer_list)
288-
end
289-
end
290-
end
291-
292-
def list_item_value(entry, counter, depth, opts)
293-
label = counter.increment(entry).listlabel(entry.parent, depth)
294-
s = semx(entry, label)
295-
[label,
296-
list_item_anchor_label(s, opts[:list_anchor], opts[:prev_label],
297-
opts[:refer_list])]
298-
end
299-
300-
def list_item_anchor_label(label, list_anchor, prev_label, refer_list)
301-
prev_label.empty? or
302-
label = @klass.connectives_spans(@i18n.list_nested_xref
303-
.sub("%1", %[#{prev_label}#{list_item_delim}])
304-
.sub("%2", label))
305-
refer_list and
306-
label = @klass.connectives_spans(@i18n.list_nested_xref
307-
.sub("%1", list_anchor[:xref])
308-
.sub("%2", label))
309-
label
310-
end
311-
=end
312-
313-
=begin FROM ISO
314-
def list_anchor_names(sections)
315-
sections.each do |s|
316-
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
317-
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
318-
c = Counter.new
319-
notes.noblank.each do |n|
320-
n["id"] ||= "_#{UUIDTools::UUID.random_create}"
321-
@anchors[n["id"]] = anchor_struct(increment_label(notes, n, c), n,
322-
@labels["list"], "list",
323-
{ unnumb: false, container: true })
324-
list_item_anchor_names(n, @anchors[n["id"]], 1, "",
325-
!single_ol_for_xrefs?(notes))
326-
end
327-
list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
328-
end
329-
=end
330-
331-
332214
def list_item_value(entry, counter, depth, opts)
333215
if depth > 2
334216
# require 'debug'; binding.b

0 commit comments

Comments
 (0)