Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/indexsect #446

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gem "relaton-render", git: "https://github.com/relaton/relaton-render", branch: "main"
gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "fix/relaton-render-0.9"
gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "fix/fn-index-dup"
163 changes: 0 additions & 163 deletions lib/isodoc/bipm/index.rb

This file was deleted.

42 changes: 18 additions & 24 deletions lib/isodoc/bipm/presentation_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require "metanorma-generic"
require "metanorma-iso"
require_relative "init"
require_relative "index"
require_relative "doccontrol"
require_relative "../../relaton/render/general"
require_relative "presentation_blocks"
Expand Down Expand Up @@ -33,16 +32,6 @@ def eref_localities1(opt)
super
end

# KILL
def annex1x(elem)
@jcgm and return super
elem["unnumbered"] == "true" and return
lbl = @xrefs.anchor(elem["id"], :label)
t = elem.at(ns("./title")) and
t.children = "<strong>#{to_xml(t.children)}</strong>"
prefix_name(elem, ".<tab/>", lbl, "title")
end

def annex_delim(elem)
@jcgm and return super
".<tab/>"
Expand All @@ -63,19 +52,6 @@ def clause1(elem)
super
end

# KILL
def prefix_namex(node, delims, number, elem)
number.nil? || number.empty? and return
unless name = node.at(ns("./#{elem}[not(@type = 'quoted')]"))
node.at(ns("./#{elem}[@type = 'quoted']")) and return
node.add_first_child "<#{elem}></#{elem}>"
name = node.children.first
end
if name.children.empty? then name.add_child(cleanup_entities(number))
else (name.children.first.previous = "#{number}#{delim}")
end
end

def prefix_name(node, delims, number, elem)
if n = node.at(ns("./#{elem}[@type = 'quoted']"))
n1 = n.dup
Expand Down Expand Up @@ -204,6 +180,24 @@ def termsource_modification(elem)
termsource_add_modification_text(elem.at(ns("./modification")))
end

def enable_indexsect
true
end

def index1(docxml, indexsect, index)
index.keys.sort.each do |k|
c = indexsect.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
words = index[k].keys.each_with_object({}) do |w, v|
v[sortable(w).downcase] = w
end
words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
end
end
docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
@xrefs.bookmark_anchor_names(docxml)
end

include Init
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/isodoc/html_convert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@
<xref target="I">
<semx element="indexsect" source="I">Index</semx>
</xref>
<bookmark to="End" id="_"/>
<bookmark id="_"/>
<bookmark id="_"/>
<bookmark id="_"/>
<bookmark id="_"/>
Expand Down
Loading