diff --git a/Gemfile.devel b/Gemfile.devel new file mode 100644 index 00000000..6c3302bc --- /dev/null +++ b/Gemfile.devel @@ -0,0 +1,2 @@ +gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "main" +gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "fix/presxml-oct24" diff --git a/lib/isodoc/iso/base_convert.rb b/lib/isodoc/iso/base_convert.rb index 47b867ef..f064fc69 100644 --- a/lib/isodoc/iso/base_convert.rb +++ b/lib/isodoc/iso/base_convert.rb @@ -183,7 +183,6 @@ def figure_parse1(node, out) measurement_units(node, out) out.div **figure_attrs(node) do |div| node.children.each do |n| - figure_key(out) if n.name == "dl" n.name == "note" && n["type"] == "units" and next parse(n, div) unless n.name == "name" end diff --git a/lib/isodoc/iso/presentation_bibdata.rb b/lib/isodoc/iso/presentation_bibdata.rb index da645235..5393ebff 100644 --- a/lib/isodoc/iso/presentation_bibdata.rb +++ b/lib/isodoc/iso/presentation_bibdata.rb @@ -32,7 +32,7 @@ def warning_for_missing_metadata_post(docxml, ret) ret = "" \ "

Metadata warnings:

#{ret}
" ins = docxml.at(ns("//sections//title")) or return - ins.children.first.previous = ret + ins.add_first_child ret end def editorialgroup_identifier(docxml) diff --git a/lib/isodoc/iso/presentation_terms.rb b/lib/isodoc/iso/presentation_terms.rb index 50102fc9..0429d893 100644 --- a/lib/isodoc/iso/presentation_terms.rb +++ b/lib/isodoc/iso/presentation_terms.rb @@ -52,19 +52,6 @@ def concept1(node) node.children) end - def termdefinition1(elem) - prefix_domain_to_definition(elem) - super - end - - def prefix_domain_to_definition(elem) - ((d = elem.at(ns("./domain"))) && - (v = elem.at(ns("./definition/verbal-definition"))) && - v.elements.first.name == "p") or return - v.elements.first.children.first.previous = - "<#{to_xml(d.remove.children)}> " - end - def insertall_after_here(node, insert, name) node.children.each do |n| n.name == name or next diff --git a/lib/isodoc/iso/presentation_xml_convert.rb b/lib/isodoc/iso/presentation_xml_convert.rb index 8775ed11..2c4e11a7 100644 --- a/lib/isodoc/iso/presentation_xml_convert.rb +++ b/lib/isodoc/iso/presentation_xml_convert.rb @@ -31,6 +31,7 @@ def block(docxml) admonition docxml source docxml ol docxml + quote docxml permission docxml requirement docxml recommendation docxml @@ -38,6 +39,8 @@ def block(docxml) @xrefs.anchors_previous = @xrefs.anchors.dup # store old xrefs of reqts @xrefs.parse docxml table docxml # have table include requirements newly converted to tables + # table feeds dl + dl docxml example docxml note docxml end @@ -52,6 +55,8 @@ def annex(isoxml) end def figure1(node) + figure_fn(node) + figure_key(node.at(ns("./dl"))) lbl = @xrefs.anchor(node["id"], :label, false) or return figname = node.parent.name == "figure" ? "" : "#{@i18n.figure} " conn = node.parent.name == "figure" ? "  " : " — " @@ -116,7 +121,7 @@ def wrap_in_bold(cell) def admonition_inline_name(elem) n = elem.at(ns("./name")) or return if (p = n.next_element) && p&.name == "p" - p.children.first.previous = admonition_name(to_xml(n.remove.children)) + p.add_first_child admonition_name(to_xml(n.remove.children)) end end @@ -162,7 +167,7 @@ def formula_where_one(dlist) def table1(elem) elem.xpath(ns(".//dl[@key = 'true'][not(./name)]")).each do |dl| - dl.children.first.previous = "#{@i18n.key}" + dl.add_first_child "#{@i18n.key}" end super end @@ -177,7 +182,7 @@ def middle_title(docxml) return s = docxml.at(ns("//sections")) or return ret = "#{middle_title_main}#{middle_title_amd}" - s.children.first.previous = ret + s.add_first_child ret end def middle_title_main diff --git a/lib/isodoc/iso/sections.rb b/lib/isodoc/iso/sections.rb index 582990a0..126dcde7 100644 --- a/lib/isodoc/iso/sections.rb +++ b/lib/isodoc/iso/sections.rb @@ -12,7 +12,7 @@ def foreword(clause, out) @foreword = true page_break(out) out.div **attr_code(id: clause["id"]) do |s| - clause_name(nil, clause.at(ns("./title")) || @i18n.foreword, s, + clause_name(nil, clause.at(ns("./title")), s, { class: "ForewordTitle" }) clause.elements.each { |e| parse(e, s) unless e.name == "title" } end diff --git a/spec/isodoc/amd_spec.rb b/spec/isodoc/amd_spec.rb index 5389e547..8624cc49 100644 --- a/spec/isodoc/amd_spec.rb +++ b/spec/isodoc/amd_spec.rb @@ -78,7 +78,7 @@ - + Foreword

Clause 1, Note 2.1, Note 1 diff --git a/spec/isodoc/blocks_spec.rb b/spec/isodoc/blocks_spec.rb index a4bd891f..ab562f64 100644 --- a/spec/isodoc/blocks_spec.rb +++ b/spec/isodoc/blocks_spec.rb @@ -21,7 +21,7 @@ Contents - + Foreword EXAMPLE — Title

Hello

@@ -114,7 +114,7 @@ Contents - + Foreword EXAMPLE 1 Hello @@ -212,7 +212,7 @@ Contents - + Foreword

CAUTION — Only use paddy or parboiled rice for the @@ -262,7 +262,7 @@ Contents - + Foreword CAUTION @@ -296,7 +296,7 @@ Contents - + Foreword Title