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/presxml oct24 #1233

Closed
wants to merge 10 commits into from
2 changes: 2 additions & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -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"
1 change: 0 additions & 1 deletion lib/isodoc/iso/base_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/iso/presentation_bibdata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def warning_for_missing_metadata_post(docxml, ret)
ret = "<review date='#{Date.today}' reviewer='Metanorma' id='_#{id}'>" \
"<p><strong>Metadata warnings:<strong></p> #{ret}</review>"
ins = docxml.at(ns("//sections//title")) or return
ins.children.first.previous = ret
ins.add_first_child ret
end

def editorialgroup_identifier(docxml)
Expand Down
13 changes: 0 additions & 13 deletions lib/isodoc/iso/presentation_terms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
"&#x3c;#{to_xml(d.remove.children)}&#x3e; "
end

def insertall_after_here(node, insert, name)
node.children.each do |n|
n.name == name or next
Expand Down
11 changes: 8 additions & 3 deletions lib/isodoc/iso/presentation_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ def block(docxml)
admonition docxml
source docxml
ol docxml
quote docxml
permission docxml
requirement docxml
recommendation docxml
requirement_render 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
Expand All @@ -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" ? "&#xa0; " : "&#xa0;&#x2014; "
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 = "<name>#{@i18n.key}</name>"
dl.add_first_child "<name>#{@i18n.key}</name>"
end
super
end
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/iso/sections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/isodoc/amd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</bibdata>

<preface>
<foreword displayorder="1">
<foreword displayorder="1"><title>Foreword</title>
<p>
<xref target="N">Clause 1, Note</xref>
<xref target="note1">2.1, Note 1</xref>
Expand Down
Loading
Loading