Skip to content

Commit

Permalink
Merge pull request #635 from metanorma/fix/no-semxml-dupe-in-presxml
Browse files Browse the repository at this point in the history
remove duplicate Semantic XML: https://github.com/metanorma/isodoc/is…
  • Loading branch information
opoudjis authored Feb 3, 2025
2 parents 66929ba + 837c493 commit 6a4e5a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 89 deletions.
3 changes: 2 additions & 1 deletion lib/isodoc/presentation_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def bibitem_lookup(docxml)
end

def conversions(docxml)
semantic_xml_insert(docxml)
#semantic_xml_insert(docxml)
metadata docxml
bibdata docxml
@xrefs.parse docxml
Expand Down Expand Up @@ -119,6 +119,7 @@ def terms(docxml)
termcleanup docxml
end

# KILL
def semantic_xml_insert(xml)
@semantic_xml_insert or return
embed = embedable_semantic_xml(xml)
Expand Down
88 changes: 0 additions & 88 deletions spec/isodoc/presentation_xml_metadata_spec.rb
Original file line number Diff line number Diff line change
@@ -1,94 +1,6 @@
require "spec_helper"

RSpec.describe IsoDoc do
it "inserts copy of Semantic XML by default" do
input = <<~INPUT
<iso-standard xmlns="http://riboseinc.com/isoxml">
<preface>
<foreword id="fwd">
<p><math id="b" xmlns:sodipodi='ABC'><sodipodi:b> xmlns:sodipodi</sodipodi:b></math>
<xref target="N1"/>
</p>
</foreword>
<introduction id="intro">
<figure id="N1"> <name>Split-it-right sample divider</name>
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
</figure>
</introduction></preface>
</iso-standard>
INPUT
output = <<~OUTPUT
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
<metanorma-extension>
<metanorma>
<source>
<semantic__iso-standard>
<semantic__preface>
<semantic__foreword id="semantic__fwd">
<semantic__p>
<semantic__math xmlns:sodipodi="ABC" id="semantic__b">
<sodipodi:semantic__b> xmlns:sodipodi</sodipodi:semantic__b>
</semantic__math>
<semantic__xref target="semantic__N1"/>
</semantic__p>
</semantic__foreword>
<semantic__introduction id="semantic__intro">
<semantic__figure id="semantic__N1">
<semantic__name>Split-it-right sample divider</semantic__name>
<semantic__image src="rice_images/rice_image1.png" id="semantic___8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
</semantic__figure>
</semantic__introduction>
</semantic__preface>
</semantic__iso-standard>
</source>
</metanorma>
</metanorma-extension>
<preface>
<clause type="toc" id="_" displayorder="1">
<fmt-title depth="1">Table of contents</fmt-title>
</clause>
<foreword id="fwd" displayorder="2">
<title id="_">Foreword</title>
<fmt-title depth="1">
<semx element="title" source="_">Foreword</semx>
</fmt-title>
<p>
<math xmlns:sodipodi="ABC" id="b">
<sodipodi:b> xmlns:sodipodi</sodipodi:b>
</math>
<xref target="N1">
<span class="fmt-element-name">Figure</span>
<semx element="autonum" source="N1">1</semx>
</xref>
</p>
</foreword>
<introduction id="intro" displayorder="3">
<figure id="N1" autonum="1">
<name id="_">Split-it-right sample divider</name>
<fmt-name>
<span class="fmt-caption-label">
<span class="fmt-element-name">Figure</span>
<semx element="autonum" source="N1">1</semx>
</span>
<span class="fmt-caption-delim"> — </span>
<semx element="name" source="_">Split-it-right sample divider</semx>
</fmt-name>
<fmt-xref-label>
<span class="fmt-element-name">Figure</span>
<semx element="autonum" source="N1">1</semx>
</fmt-xref-label>
<image src="rice_images/rice_image1.png" id="_" mimetype="image/png"/>
</figure>
</introduction>
</preface>
</iso-standard>
OUTPUT
expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert
.new({})
.convert("test", input, true))))
.to be_equivalent_to Xml::C14n.format(output)
end

it "processes user-css" do
input = <<~INPUT
<iso-standard xmlns="http://riboseinc.com/isoxml">
Expand Down

0 comments on commit 6a4e5a8

Please sign in to comment.