Skip to content

Commit

Permalink
mark up containers in xref, add container instance of fmt-xref-label: #…
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Nov 29, 2024
1 parent 2cb2a65 commit bf95855
Show file tree
Hide file tree
Showing 20 changed files with 3,190 additions and 2,749 deletions.
13 changes: 9 additions & 4 deletions lib/isodoc/presentation_function/xrefs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def prefix_container(container, linkend, node, target)
anchor_xref(node, container, container: true),
node, target)
l10n(connectives_spans(@i18n.nested_xref
.sub("%1", container_label)
.sub("%1", "<span class='fmt-xref-container'>#{container_label}</span>")
.sub("%2", linkend)))
end

Expand Down Expand Up @@ -56,7 +56,8 @@ def anchor_xref(node, target, container: false)

def anchor_xref_short(node, target, container)
if (l = node["label"]) && !container
@i18n.l10n(%[<span class="fmt-element-name">#{l}</span> #{anchor_value(target)}])
v = anchor_value(target)
@i18n.l10n(%[<span class="fmt-element-name">#{l}</span> #{v}])
else @xrefs.anchor(target, :xref)
end
end
Expand Down Expand Up @@ -134,9 +135,13 @@ def loc2xref(entry)
def combine_conn(list)
list.size == 1 and list.first[:label]
if list[1..].all? { |l| l[:conn] == "and" }
connectives_spans(@i18n.boolean_conj(list.map { |l| loc2xref(l) }, "and"))
connectives_spans(@i18n.boolean_conj(list.map do |l|
loc2xref(l)
end, "and"))
elsif list[1..].all? { |l| l[:conn] == "or" }
connectives_spans(@i18n.boolean_conj(list.map { |l| loc2xref(l) }, "or"))
connectives_spans(@i18n.boolean_conj(list.map do |l|
loc2xref(l)
end, "or"))
else
ret = loc2xref(list[0])
list[1..].each { |l| ret = i18n_chain_boolean(ret, l) }
Expand Down
2 changes: 2 additions & 0 deletions spec/assets/i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ norm_annex: normative
figure: figur-etikedo duvorta
example: Ekzempl-etikedo Duvorta
note: NOTO
note_xref: noto
locality: {
table: Tabelo,
prelude: preludo
Expand All @@ -41,3 +42,4 @@ SpelloutRules:
edition_ordinal: "eldono {{ var1 | ordinal_word: edition, '' }}"
edition: eldono
no_identifier: null
nested_xref: "%1<comma>—</comma>%2"
Loading

0 comments on commit bf95855

Please sign in to comment.