Skip to content

Commit

Permalink
Merge pull request #126 from metanorma/fix/refactor-xrefs-oct24
Browse files Browse the repository at this point in the history
Fix/refactor xrefs oct24
  • Loading branch information
opoudjis authored Nov 5, 2024
2 parents c65845d + 4144cbd commit 47d78e1
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 176 deletions.
4 changes: 4 additions & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "main"
gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "fix/refactor-xrefs-oct24"
gem "metanorma-iso", git: "https://github.com/metanorma/metanorma-iso", branch: "fix/refactor-xrefs-oct24"
gem "metanorma-jis", git: "https://github.com/metanorma/metanorma-jis", branch: "fix/refactor-xrefs-oct24"
4 changes: 0 additions & 4 deletions lib/isodoc/plateau/base_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ module BaseConvert

def para_parse(node, out)
out.p **attr_code(para_attrs(node)) do |p|
unless @termdomain.empty?
p << "&lt;#{@termdomain}&gt; "
@termdomain = ""
end
@lang == "ja" and p << "&#x3000;"
node.children.each { |n| parse(n, p) }
end
Expand Down
5 changes: 2 additions & 3 deletions lib/isodoc/plateau/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ def metadata_init(lang, script, locale, labels)
end

def xref_init(lang, script, _klass, labels, options)
@xrefs = Xref.new(lang, script,
HtmlConvert.new(language: lang, script:),
labels, options)
p = HtmlConvert.new(language: lang, script:)
@xrefs = Xref.new(lang, script, p, labels, options)
end

def i18n_init(lang, script, locale, i18nyaml = nil)
Expand Down
22 changes: 16 additions & 6 deletions spec/isodoc/blocks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
was estimated to be 18,2 min for this example.
</p>
</fn>
<p keep-with-next="true">
<strong>
Key
</strong>
</p>
<p class="dl">A: B</p>
<source status="generalisation">
[SOURCE:
Expand Down Expand Up @@ -153,6 +158,11 @@
</p>
</div>
</aside>
<p style="page-break-after: avoid;">
<b>
Key
</b>
</p>
<p class="dl">A: B</p>
<div class="BlockSource">
<p>
Expand Down Expand Up @@ -204,7 +214,8 @@
.convert("test", input, true).gsub(/&lt;/, "&#x3c;"))))
.to be_equivalent_to Xml::C14n.format(presxml)
expect(Xml::C14n.format(strip_guid(IsoDoc::Plateau::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)
end

it "processes subfigures" do
Expand Down Expand Up @@ -569,8 +580,7 @@
presxml = <<~OUTPUT
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation">
<preface><clause type="toc" id="_" displayorder="1"><title depth="1">Contents</title></clause>
<foreword id="A" displayorder="2">
<foreword id="A" displayorder="2">><title>Foreword</title>
<p id="B">
<table id="C"><name>Table 1</name><thead> </thead>
<colgroup><col width="100%"/></colgroup>
Expand Down Expand Up @@ -606,10 +616,10 @@
</annex>
</standard-document>
OUTPUT
expect(strip_guid(IsoDoc::Plateau::PresentationXMLConvert
expect(strip_guid(Xml::C14n.format(IsoDoc::Plateau::PresentationXMLConvert
.new(presxml_options)
.convert("test", input, true))
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
.to be_equivalent_to (presxml)
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
.to be_equivalent_to Xml::C14n.format(presxml)
end
end
Loading

0 comments on commit 47d78e1

Please sign in to comment.