Skip to content

Commit

Permalink
debug rendering of amend and /bibdata/identifier: metanorma/metanorma…
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Sep 9, 2024
1 parent 3165e81 commit accc201
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/isodoc/presentation_function/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def amend(docxml)
end

def amend1(elem)
elem.xpath(ns("./locality | localityStack | autonumber | " \
"classification | contributor")).each(&:remove)
elem.xpath(ns("./locality | ./localityStack | ./autonumber | " \
"./classification | ./contributor")).each(&:remove)
elem.xpath(ns("./newcontent")).each { |a| a.name = "quote" }
elem.xpath(ns("./description")).each { |a| a.replace(a.children) }
elem.replace(elem.children)
Expand Down
8 changes: 7 additions & 1 deletion lib/isodoc/presentation_function/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ def metadata(docxml)
fonts_metadata(docxml)
attachments_extract(docxml)
preprocess_xslt_insert(docxml)
localized_strings(docxml)
a = docxml.at(ns("//metanorma-extension")) or return
a.elements.empty? and a.remove
end

def localized_strings(docxml)
a = docxml.at(ns("//bibdata")) or return
a.next =
"<localized-strings>#{i8n_name(trim_hash(@i18n.get), '').join}" \
Expand Down Expand Up @@ -69,7 +75,7 @@ def fonts_metadata(xmldoc)

def presmeta_insert_pt(xmldoc)
xmldoc.at(ns("//presentation-metadata")) ||
extension_insert_pt(xml).children.last
extension_insert_pt(xmldoc).children.last
end

def presmeta(name, value)
Expand Down
12 changes: 8 additions & 4 deletions spec/isodoc/blocks_notes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,16 @@
</body>
</html>
OUTPUT
expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options)
.convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml)
expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert
.new(presxml_options)
.convert("test", input, true))))
.to be_equivalent_to Xml::C14n.format(presxml)
expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({})
.convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html)
.convert("test", presxml, true)))
.to be_equivalent_to Xml::C14n.format(html)
expect(Xml::C14n.format(IsoDoc::WordConvert.new({})
.convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(doc)
.convert("test", presxml, true)))
.to be_equivalent_to Xml::C14n.format(doc)
end

it "processes sequences of notes" do
Expand Down
2 changes: 2 additions & 0 deletions spec/isodoc/presentation_xml_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
presxml = <<~OUTPUT
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
<bibdata/>
<metanorma-extension>
<presentation-metadata>
<name>font-license-agreement</name>
<value>no-install-fonts</value>
Expand All @@ -214,6 +215,7 @@
<name>fonts</name>
<value>font1</value>
</presentation-metadata>
</metanorma-extension>
<preface> <clause type="toc" id="_" displayorder="1"> <title depth="1">Table of contents</title> </clause> </preface>
<sections>
<clause id='A' inline-header='false' obligation='normative' displayorder='2'>
Expand Down

0 comments on commit accc201

Please sign in to comment.