Skip to content

Commit

Permalink
separate config of figure and requirement hierarchical autonum delimi…
Browse files Browse the repository at this point in the history
…ter: #617
  • Loading branch information
opoudjis committed Nov 30, 2024
1 parent 48e0642 commit 7d7a91c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/isodoc/xref/xref_gen_seq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def hierfigsep
"-"
end

def hierreqtsep
"-"
end

def subfigure_increment(idx, counter, elem)
if elem.parent.name == "figure" then idx += 1
else
Expand Down Expand Up @@ -67,6 +71,12 @@ def subfigure_separator(markup: false)
h
end

def subreqt_separator(markup: false)
h = hierreqtsep
h.blank? || !markup or h = delim_wrap(h)
h
end

def subfigure_delim
""
end
Expand Down Expand Up @@ -150,7 +160,7 @@ def sequential_permission_children(elem, lbl, klass, container: false)
m = @reqt_models.model(t["model"])
klass, label = reqt2class_nested_label(t, m)
ctr = c.increment(label, t).print
id = "#{lbl}#{subfigure_separator}#{ctr}"
id = "#{lbl}#{subreqt_separator}#{ctr}"
sequential_permission_body(ctr, lbl, t, label, klass, m,
container:)
sequential_permission_children(t, id, klass, container:)
Expand All @@ -159,14 +169,14 @@ def sequential_permission_children(elem, lbl, klass, container: false)

def sequential_permission_body(id, parent_id, elem, label, klass, model,
container: false)
lbl = parent_id ? "#{parent_id}#{subfigure_separator}#{id}" : id
lbl = parent_id ? "#{parent_id}#{subreqt_separator}#{id}" : id
@anchors[elem["id"]] = model.postprocess_anchor_struct(
elem, anchor_struct(lbl, elem,
label, klass, { unnumb: elem["unnumbered"], container: })
)
@anchors[elem["id"]][:semx] = semx(elem, lbl)
if parent_id
x = "#{subfigure_separator(markup: true)}#{semx(elem, id)}"
x = "#{subreqt_separator(markup: true)}#{semx(elem, id)}"
@anchors[elem["id"]][:semx] = @anchors[elem.parent["id"]][:semx] + x
@anchors[elem["id"]][:label] =
"<span class='fmt-element-name'>#{label}</span> #{@anchors[elem["id"]][:semx]}"
Expand Down Expand Up @@ -302,7 +312,7 @@ def hierarchical_permission_children(block, lbl)
block.xpath(ns(REQ_CHILDREN)).noblank.each do |t|
m = @reqt_models.model(t["model"])
klass, label = reqt2class_nested_label(t, m)
id = "#{lbl}#{subfigure_separator}#{c.increment(label, t).print}"
id = "#{lbl}#{subreqt_separator}#{c.increment(label, t).print}"
sequential_permission_body(c.print, lbl, t, label, klass, m)
hierarchical_permission_children(t, id)
end
Expand All @@ -314,7 +324,7 @@ def hierarchical_permission_body(id, parent_id, elem, label, klass, model)
elem, anchor_struct(id, elem,
label, klass, { unnumb: elem["unnumbered"], container: false })
)
x = "#{subfigure_separator(markup: true)}#{semx(elem, id)}"
x = "#{subreqt_separator(markup: true)}#{semx(elem, id)}"
@anchors[elem["id"]][:label] = "#{semx(elem.parent, parent_id)}#{x}"
@anchors[elem["id"]][:xref] = @anchors[elem.parent["id"]][:xref] + x
model.permission_parts(elem, id, label, klass).each do |n|
Expand Down

0 comments on commit 7d7a91c

Please sign in to comment.