HTML-Toc
view release on metacpan or search on metacpan
t/manualTest.t view on Meta::CPAN
'tokenToToc' => [{
'groupId' => 'part',
'doNumberToken' => 1,
'level' => 1,
'tokenBegin' => '<h1 class="part">',
}, {
'tokenBegin' => '<h1 class="-[appendix|prelude|hidden|part]">'
}, {
'tokenBegin' => '<h2>',
'level' => 2
}, {
'tokenBegin' => '<h3>',
'level' => 3
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h1 class="appendix">',
'numberingStyle' => 'upper-alpha',
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2 class="appendix">',
'level' => 2
}, {
'groupId' => 'prelude',
'tokenBegin' => '<h1 class="prelude">',
'level' => 1,
'doNumberToken' => 0,
}],
});
$tocOfFigures->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "replace <!-- Table of Figures -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Figure $node: "',
'tokenToToc' => [{
'groupId' => 'Figure',
'tokenBegin' => '<p class="captionFigure">'
}]
});
$tocOfTables->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "replace <!-- Table of Tables -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Table $node: "',
'tokenToToc' => [{
'groupId' => 'Table',
'tokenBegin' => '<p class="captionTable">'
}]
});
# Insert ToC
$tocInsertor->insertIntoFile(
[$toc, $tocOfFigures, $tocOfTables],
't/ManualTest/manualTest1.htm', {
'doUseGroupsGlobal' => 1,
'output' => \$output,
'outputFile' => 't/ManualTest/manualTest2.htm'
}
);
eq_or_diff($output, <<HTML, 'Test inserting ToC into manual', {max_width => 120});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Manual</title>
<style type="text/css">
ul.toc_appendix1 {
list-style-type: none;
margin-left: 0;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h2 {
list-style-type: none;
}
ul.toc_h3 {
list-style-type: none;
}
ul.toc_part1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_prelude1 {
list-style: none;
}
p.captionFigure {
font-style: italic;
font-weight: bold;
}
p.captionTable {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<h1 class="prelude"><a name="prelude-1"></a>Preface</h1>
<p>Better C than never.</p>
<h1 class="hidden">Table of Contents</h1>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul class="toc_prelude1">
<li><a href="#prelude-1">Preface</a></li>
<li><a href="#prelude-2">Table of Figures</a></li>
<li><a href="#prelude-3">Table of Tables</a></li>
<li><a href="#prelude-4">Introduction</a>
<ul class="toc_part1">
<li>Part 1 <a href="#part-1">Disks</a>
<ul class="toc_h1">
<li>1. <a href="#h-1">Compiler Disk v1</a>
<ul class="toc_h2">
<li>1. <a href="#h-1.1">System</a></li>
t/manualTest.t view on Meta::CPAN
'tokenToToc' => [{
'groupId' => 'part',
'doNumberToken' => 1,
'level' => 1,
'tokenBegin' => '<h1 class="part">',
}, {
'tokenBegin' => '<h1 class="-[appendix|prelude|hidden|part]">'
}, {
'tokenBegin' => '<h2>',
'level' => 2
}, {
'tokenBegin' => '<h3>',
'level' => 3
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h1 class="appendix">',
'numberingStyle' => 'upper-alpha',
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2 class="appendix">',
'level' => 2
}, {
'groupId' => 'prelude',
'tokenBegin' => '<h1 class="prelude">',
'level' => 1,
'doNumberToken' => 0,
}],
});
$tocOfFigures->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Figures -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Figure $node: "',
'tokenToToc' => [{
'groupId' => 'Figure',
'tokenBegin' => '<p class="captionFigure">'
}]
});
$tocOfTables->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Tables -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Table $node: "',
'tokenToToc' => [{
'groupId' => 'Table',
'tokenBegin' => '<p class="captionTable">'
}]
});
# Insert ToC
$tocUpdator->updateFile(
[$toc, $tocOfFigures, $tocOfTables],
't/ManualTest/manualTest1.htm', {
'doUseGroupsGlobal' => 1,
'output' => \$output,
'outputFile' => 't/ManualTest/manualTest3.htm'
}
);
eq_or_diff($output, <<HTML, 'Test inserting ToC into manual', {max_width => 120});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Manual</title>
<style type="text/css">
ul.toc_appendix1 {
list-style-type: none;
margin-left: 0;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h2 {
list-style-type: none;
}
ul.toc_h3 {
list-style-type: none;
}
ul.toc_part1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_prelude1 {
list-style: none;
}
p.captionFigure {
font-style: italic;
font-weight: bold;
}
p.captionTable {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<h1 class="prelude"><!-- #BeginTocAnchorNameBegin --><a name="prelude-1"></a><!-- #EndTocAnchorNameBegin -->Preface</h1>
<p>Better C than never.</p>
<h1 class="hidden">Table of Contents</h1>
<!-- Table of Contents --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul class="toc_prelude1">
<li><a href="#prelude-1">Preface</a></li>
<li><a href="#prelude-2">Table of Figures</a></li>
<li><a href="#prelude-3">Table of Tables</a></li>
<li><a href="#prelude-4">Introduction</a>
<ul class="toc_part1">
<li>Part 1 <a href="#part-1">Disks</a>
<ul class="toc_h1">
<li>1. <a href="#h-1">Compiler Disk v1</a>
<ul class="toc_h2">
<li>1. <a href="#h-1.1">System</a></li>
t/manualTest.t view on Meta::CPAN
'tokenToToc' => [{
'groupId' => 'part',
'doNumberToken' => 1,
'level' => 1,
'tokenBegin' => '<h1 class="part">',
}, {
'tokenBegin' => '<h1 class=-[appendix|prelude|hidden|part]>'
}, {
'tokenBegin' => '<h2>',
'level' => 2
}, {
'tokenBegin' => '<h3>',
'level' => 3
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h1 class="appendix">',
'numberingStyle' => 'upper-alpha',
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2 class="appendix">',
'level' => 2
}, {
'groupId' => 'prelude',
'tokenBegin' => '<h1 class="prelude">',
'level' => 1,
'doNumberToken' => 0,
}],
});
$tocOfFigures->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Figures -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Figure $node: "',
'tokenToToc' => [{
'groupId' => 'Figure',
'tokenBegin' => '<p class="captionFigure">'
}]
});
$tocOfTables->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Tables -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Table $node: "',
'tokenToToc' => [{
'groupId' => 'Table',
'tokenBegin' => '<p class="captionTable">'
}]
});
# Insert ToC
$tocUpdator->updateFile(
[$toc, $tocOfFigures, $tocOfTables],
't/ManualTest/manualTest3.htm', {
'doUseGroupsGlobal' => 1,
'output' => \$output,
'outputFile' => 't/ManualTest/manualTest4.htm'
}
);
eq_or_diff($output, <<HTML, 'Test inserting ToC into manual', {max_width => 120});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Manual</title>
<style type="text/css">
ul.toc_appendix1 {
list-style-type: none;
margin-left: 0;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h2 {
list-style-type: none;
}
ul.toc_h3 {
list-style-type: none;
}
ul.toc_part1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_prelude1 {
list-style: none;
}
p.captionFigure {
font-style: italic;
font-weight: bold;
}
p.captionTable {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<h1 class="prelude"><!-- #BeginTocAnchorNameBegin --><a name="prelude-1"></a><!-- #EndTocAnchorNameBegin -->Preface</h1>
<p>Better C than never.</p>
<h1 class="hidden">Table of Contents</h1>
<!-- Table of Contents --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul class="toc_prelude1">
<li><a href="#prelude-1">Preface</a></li>
<li><a href="#prelude-2">Table of Figures</a></li>
<li><a href="#prelude-3">Table of Tables</a></li>
<li><a href="#prelude-4">Introduction</a>
<ul class="toc_part1">
<li>Part 1 <a href="#part-1">Disks</a>
<ul class="toc_h1">
<li>1. <a href="#h-1">Compiler Disk v1</a>
<ul class="toc_h2">
<li>1. <a href="#h-1.1">System</a></li>
( run in 0.436 second using v1.01-cache-2.11-cpan-bbe5e583499 )