From 670e9ae37c68cc4fe1ecbe95278e182c3dd33677 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Thu, 14 Nov 2024 23:40:46 +1100 Subject: [PATCH] ensure dl has fmt-name: https://github.com/metanorma/isodoc/issues/617 --- lib/isodoc/function/references.rb | 2 +- lib/isodoc/presentation_function/block.rb | 10 ++- spec/isodoc/table_spec.rb | 96 +++++++++++++++++------ 3 files changed, 83 insertions(+), 25 deletions(-) diff --git a/lib/isodoc/function/references.rb b/lib/isodoc/function/references.rb index 6233a537..c547eb7f 100644 --- a/lib/isodoc/function/references.rb +++ b/lib/isodoc/function/references.rb @@ -26,7 +26,7 @@ def biblio_list(refs, div, biblio) i += 1 bibitem_entry(div, b, i, biblio) else - parse(b, div) unless %w(title).include? b.name + parse(b, div) unless %w(fmt-title).include? b.name end end end diff --git a/lib/isodoc/presentation_function/block.rb b/lib/isodoc/presentation_function/block.rb index 440914fb..2da9adf5 100644 --- a/lib/isodoc/presentation_function/block.rb +++ b/lib/isodoc/presentation_function/block.rb @@ -106,7 +106,7 @@ def table(docxml) def table1(elem) table_fn(elem) labelled_ancestor(elem) and return - # elem["unnumbered"] && !elem.at(ns("./name")) and return + elem["unnumbered"] && !elem.at(ns("./name")) and return n = @xrefs.anchor(elem["id"], :label, false) lbl = "#{lower2cap @i18n.table} "\ "#{autonum(elem['id'], n)}" @@ -146,7 +146,13 @@ def amend1(elem) elem.replace(elem.children) end - def dl(docxml); end + def dl(docxml) + docxml.xpath(ns("//dl")).each { |f| dl1(f) } + end + + def dl1(elem) + prefix_name(elem, {}, "", "name") # copy name to fmt-name + end def ol(docxml) docxml.xpath(ns("//ol")).each { |f| ol1(f) } diff --git a/spec/isodoc/table_spec.rb b/spec/isodoc/table_spec.rb index b84b7640..04b0e3ac 100644 --- a/spec/isodoc/table_spec.rb +++ b/spec/isodoc/table_spec.rb @@ -57,7 +57,7 @@
- Key + Key
Drago
A type of rice
@@ -109,18 +109,43 @@ - Table of contents + Table of contents - Foreword - - - Table 1 — Repeatability and reproducibility of - husked - rice yield - + + Foreword + + + Foreword + + +
+ + Repeatability and reproducibility of + husked + rice yield + +

X

+
+
+ + + Table + 1 +  — + + Repeatability and reproducibility of + husked + rice yield +

X

-
- + +
+
+
+ + Table + 1 + @@ -187,14 +212,23 @@
- Key + Key + + + Key + +
Drago
A type of rice
[SOURCE: ISO 712, Section 1 — with adjustments ; ISO 712, Section 2] - NOTE + + + NOTE + +

This is a table about rice

@@ -209,7 +243,21 @@
- 1.<tab/>Normative References + Normative References + + + 1 + . + + + + Normative References + + + + Clause + 1 + International Organization for Standardization. Cereals and cereal products. ISO 712 @@ -329,7 +377,7 @@ OUTPUT word = <<~OUTPUT - +