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

https://github.com/metanorma/metanorma-standoc/issues/742 #508

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/isodoc/function/blocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ def source_parse(node, out)
end
end

def cross_align_parse(node, out)
out.table do |t|
t.tbody do |b|
node.xpath(ns("./align-cell")).each do |c|
b.td do |td|
c.children.each { |n| parse(n, td) }
end
end
end
end
end

def columnbreak_parse(node, out); end
end
end
Expand Down
7 changes: 7 additions & 0 deletions lib/isodoc/function/to_word_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ def info(isoxml, out)
@meta.get
end

def cross_align(isoxml, out)
isoxml.xpath(ns("//cross-align")).each do |c|
parse(c, out)
end
end

def boilerplate(node, out)
@bare and return
boilerplate = node.at(ns("//boilerplate")) or return
Expand Down Expand Up @@ -252,6 +258,7 @@ def parse(node, out)
when "variant-title" then variant_title(node, out)
when "span" then span_parse(node, out)
when "location" then location_parse(node, out)
when "cross-align" then cross_align_parse(node, out)
when "columnbreak" then columnbreak_parse(node, out)
when "ruby" then ruby_parse(node, out)
when "rt" then rt_parse(node, out)
Expand Down
60 changes: 59 additions & 1 deletion spec/isodoc/section_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@
.convert("test", input, true)))).to be_equivalent_to xmlpp(output)
end

it "processes annexes containing one, or more than one special sections" do
it "processes indexsect" do
input = <<~INPUT
<iso-standard xmlns="http://riboseinc.com/isoxml">
<indexsect id='PP' obligation='normative' displayorder="1">
Expand Down Expand Up @@ -2184,4 +2184,62 @@
expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options)
.convert("test", input, true)))).to be_equivalent_to xmlpp(presxml)
end

it "processes cross-align" do
input = <<~INPUT
<iso-standard xmlns="http://riboseinc.com/isoxml">
<sections>
<cross-align displayorder="1">
<align-cell>
<clause id="A1">
<title>Title</title>
<p>Para</p>
</clause>
</align-cell>
<align-cell>
<clause id="A2">
<title>Iitre</title>
<p>Alinée</p>
</clause>
</align-cell>
</cross-align>
</sections>
</iso-standard>
INPUT
output = <<~OUTPUT
<html lang="en">
<head/>
<body lang="en">
<div class="title-section">
<p> </p>
</div>
<br/>
<div class="prefatory-section">
<p> </p>
</div>
<br/>
<div class="main-section">
<table>
<tbody>
<td>
<div id="A1">
<h1>Title</h1>
<p>Para</p>
</div>
</td>
<td>
<div id="A2">
<h1>Iitre</h1>
<p>Alinée</p>
</div>
</td>
</tbody>
</table>
</div>
</body>
</html>
OUTPUT
expect(xmlpp(IsoDoc::HtmlConvert.new({})
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
end
end
Loading