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

Fix/toc bare #574

Merged
merged 3 commits into from
Apr 16, 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
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
Loading