Skip to content

Commit

Permalink
Merge pull request #574 from metanorma/fix/toc-bare
Browse files Browse the repository at this point in the history
Fix/toc bare
  • Loading branch information
opoudjis authored Apr 16, 2024
2 parents 8e58696 + 9acc958 commit 2ca3de8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 51 deletions.
13 changes: 5 additions & 8 deletions lib/isodoc/function/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def preface_normal(clause, out)
end

def table_of_contents(clause, out)
@bare and return
page_break(out)
out.div **attr_code(preface_attrs(clause)) do |div|
clause_name(clause, clause.at(ns("./title")), div,
Expand Down Expand Up @@ -194,32 +195,28 @@ def preface_block(block, out)
end

def copyright_parse(node, out)
return if @bare

@bare and return
out.div class: "boilerplate-copyright" do |div|
node.children.each { |n| parse(n, div) }
end
end

def license_parse(node, out)
return if @bare

@bare and return
out.div class: "boilerplate-license" do |div|
node.children.each { |n| parse(n, div) }
end
end

def legal_parse(node, out)
return if @bare

@bare and return
out.div class: "boilerplate-legal" do |div|
node.children.each { |n| parse(n, div) }
end
end

def feedback_parse(node, out)
return if @bare

@bare and return
out.div class: "boilerplate-feedback" do |div|
node.children.each { |n| parse(n, div) }
end
Expand Down
88 changes: 45 additions & 43 deletions spec/isodoc/postproc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@
olstyle: "l2" },
).convert("test", <<~INPUT, false)
<iso-standard xmlns="http://riboseinc.com/isoxml">
<preface><foreword displayorder="1" id="fwd">
<preface>
<clause type="toc"><title>TOC</title></clause>
<foreword displayorder="2" id="fwd">
<note>
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
</note>
Expand All @@ -377,35 +379,35 @@
html.xpath("//script").each(&:remove)
expect(strip_guid(xmlpp(html.to_xml)))
.to be_equivalent_to <<~OUTPUT
<body lang="en" xml:lang="en">
<div class="title-section">
/* an empty html cover page */
</div>
<br/>
<div class="prefatory-section">
/* an empty html intro page */
<ul id="toc-list"/>
<div id="toc"><ul><li class="h1"><a href="#_"> Antaŭparolo</a></li></ul></div>
</div>
<br/>
<main class="main-section">
<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
<body lang="en" xml:lang="en">
<div class="title-section">
/* an empty html cover page */
</div>
<br/>
<div class="prefatory-section">
/* an empty html intro page */
<ul id="toc-list"/>
<div id="toc"><ul><li class="h1"><a href="#_"> Antaŭparolo</a></li></ul></div>
</div>
<br/>
<div id="fwd">
<h1 class="ForewordTitle" id="_">Antaŭparolo</h1>
<div class="Note">
<p>  These results are based on a study carried out on three different types of kernel.</p>
<main class="main-section">
<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
<br/>
<div id="fwd">
<h1 class="ForewordTitle" id="_">Antaŭparolo</h1>
<div class="Note">
<p>  These results are based on a study carried out on three different types of kernel.</p>
</div>
</div>
</div>
</main>
</body>
OUTPUT
</main>
</body>
OUTPUT
end

it "populates HTML ToC" do
FileUtils.rm_f "test.doc"
FileUtils.rm_f "test.html"
IsoDoc::HtmlConvert.new({htmlintropage: "spec/assets/htmlintro.html"})
IsoDoc::HtmlConvert.new({ htmlintropage: "spec/assets/htmlintro.html" })
.convert("test", <<~INPUT, false)
<iso-standard xmlns="http://riboseinc.com/isoxml">
<preface><foreword displayorder="1"><title>Foreword</title>
Expand All @@ -425,26 +427,26 @@
.at("//div[@id = 'toc']")
expect(strip_guid(xmlpp(html.to_xml)))
.to be_equivalent_to xmlpp(<<~OUTPUT)
<div id="toc">
<ul>
<li class="h1">
<a href="#_"> FORVORT</a>
</li>
<li class="h1">
<a href="#_"> First Clause</a>
</li>
<li class="h2">
<a href="#_"> SUBCLOZ</a>
</li>
<li class="h1">
<a href="#_"> Second Clause</a>
</li>
<li class="h2">
<a href="#_"> Subclause</a>
</li>
</ul>
</div>
OUTPUT
<div id="toc">
<ul>
<li class="h1">
<a href="#_"> FORVORT</a>
</li>
<li class="h1">
<a href="#_"> First Clause</a>
</li>
<li class="h2">
<a href="#_"> SUBCLOZ</a>
</li>
<li class="h1">
<a href="#_"> Second Clause</a>
</li>
<li class="h2">
<a href="#_"> Subclause</a>
</li>
</ul>
</div>
OUTPUT
end

it "reorders footnote numbers in HTML" do
Expand Down

0 comments on commit 2ca3de8

Please sign in to comment.