-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TOC - add header and footer options (#66)
* TOC - add header and footer options * miss pasted struct * Update json_test.go * TestTOCAndCustomFooter
- Loading branch information
Showing
7 changed files
with
287 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<script src="js/footer.js"></script> | ||
<style> | ||
|
||
body { | ||
margin: 0 10mm; | ||
} | ||
|
||
#pageFooter { | ||
padding-top: 3mm; | ||
padding-bottom: 5mm; | ||
font-weight: bold; | ||
border-top: 0.5mm solid grey; | ||
} | ||
|
||
#pageFooter .page-number { | ||
position: absolute; | ||
bottom: 6mm; | ||
font-size: 5mm; | ||
color: grey; | ||
text-align: left; | ||
vertical-align: bottom; | ||
font-family: Verdana sans-serif; | ||
font-weight: bold; | ||
} | ||
|
||
#footer-data { | ||
font-size: 2.7mm; | ||
line-height: 4mm; | ||
color: blue; | ||
text-align: center; | ||
vertical-align: bottom; | ||
font-family: Verdana sans-serif; | ||
} | ||
|
||
#footer-data a { | ||
color: blue; | ||
text-decoration: none; | ||
} | ||
</style> | ||
</head> | ||
<body onload="footer()"> | ||
|
||
<div id="pageFooter" > | ||
<div class="page-number page"></div> | ||
<div id="footer-data"> | ||
<a href="https://example.com">example.com</a> | ||
<br/> | ||
<strong>TOC FOOTER</strong> | ||
</div> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<script src="js/footer.js"></script> | ||
<style> | ||
|
||
body { | ||
margin: 0 10mm; | ||
} | ||
|
||
#pageFooter { | ||
padding-top: 3mm; | ||
padding-bottom: 5mm; | ||
font-weight: bold; | ||
border-top: 0.5mm solid grey; | ||
} | ||
|
||
#pageFooter .page-number { | ||
position: absolute; | ||
bottom: 6mm; | ||
font-size: 5mm; | ||
color: blue; | ||
text-align: left; | ||
vertical-align: bottom; | ||
font-family: Verdana sans-serif; | ||
font-weight: bold; | ||
} | ||
|
||
#footer-data { | ||
font-size: 2.7mm; | ||
line-height: 4mm; | ||
color: blue; | ||
text-align: center; | ||
vertical-align: bottom; | ||
font-family: Verdana sans-serif; | ||
} | ||
|
||
#footer-data a { | ||
color: blue; | ||
text-decoration: none; | ||
} | ||
</style> | ||
</head> | ||
<body onload="footer()"> | ||
|
||
<div id="pageFooter" > | ||
<div class="page-number page"></div> | ||
<div id="footer-data"> | ||
Example: | ||
<a href="https://example.com">example.com</a> | ||
<br/> | ||
tel.: <a href="tel:+00123123123">+00 123 123 123</a>, | ||
<a href="mailto:[email protected]">[email protected]</a>, | ||
</div> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function footer() { | ||
var vars = {}; | ||
var query_strings_from_url = document.location.search.substring(1).split('&'); | ||
for (var query_string in query_strings_from_url) { | ||
if (query_strings_from_url.hasOwnProperty(query_string)) { | ||
var temp_var = query_strings_from_url[query_string].split('=', 2); | ||
vars[temp_var[0]] = decodeURI(temp_var[1]); | ||
} | ||
} | ||
var css_selector_classes = ['page', 'frompage', 'topage', 'webpage', 'section', 'subsection', 'date', 'isodate', 'time', 'title', 'doctitle', 'sitepage', 'sitepages']; | ||
for (var css_class in css_selector_classes) { | ||
if (css_selector_classes.hasOwnProperty(css_class)) { | ||
var element = document.getElementsByClassName(css_selector_classes[css_class]); | ||
for (var j = 0; j < element.length; ++j) { | ||
element[j].textContent = vars[css_selector_classes[css_class]]; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet version="2.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:outline="http://wkhtmltopdf.org/outline" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" | ||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona | ||
l.dtd" | ||
indent="yes" /> | ||
<xsl:template match="outline:outline"> | ||
<html> | ||
<head> | ||
<title>TOC</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<style> | ||
.toc-title { | ||
font-size: 22px; | ||
padding-top: 2mm; | ||
padding-bottom: 5mm; | ||
margin-left: 16mm; | ||
color: grey; | ||
} | ||
|
||
li { | ||
list-style: none; | ||
} | ||
|
||
ul { | ||
margin-right: -7mm; | ||
position: relative; | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
} | ||
|
||
.chapter-link { | ||
font-size: 4mm; | ||
font-weight:bold; | ||
color: blue; | ||
padding: 6mm 6mm 6mm 6mm; | ||
} | ||
|
||
li { | ||
position: relative; | ||
background: lightgrey; | ||
padding: 6mm 6mm 6mm 6mm; | ||
margin-bottom: 3mm; | ||
} | ||
|
||
li img { | ||
position: absolute; | ||
left: 0mm; | ||
top: 3mm; | ||
width: 10mm; | ||
height: 10mm; | ||
background: red; | ||
border-radius: 50%; | ||
z-index: 1; | ||
} | ||
|
||
.page-number { | ||
float: right; | ||
color: blue; | ||
padding-right: 20mm; | ||
font-size: 6mm; | ||
font-weight:bold; | ||
margin-top: -1mm; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1 class="toc-title">TOC</h1> | ||
<ul> | ||
<xsl:apply-templates select="outline:item/outline:item"/> | ||
|
||
<li class="list-decoration"></li></ul> | ||
</body> | ||
</html> | ||
</xsl:template> | ||
<xsl:template match="outline:item"> | ||
<xsl:if test="@title!='TOC'"> | ||
<li> | ||
|
||
<xsl:if test="contains(@title, 'elements')"> | ||
|
||
<img src="https://picsum.photos/200/200"/> | ||
</xsl:if> | ||
|
||
<a class="chapter-link"> | ||
<xsl:if test="@link"> | ||
<xsl:attribute name="href"><xsl:value-of select="@link"/></xsl:attribute> | ||
</xsl:if> | ||
<xsl:if test="@backLink"> | ||
<xsl:attribute name="name"><xsl:value-of select="@backLink"/></xsl:attribute> | ||
</xsl:if> | ||
<xsl:value-of select="@title" /> | ||
</a> | ||
|
||
<a class="page-number"> | ||
<xsl:if test="@link"> | ||
<xsl:attribute name="href"><xsl:value-of select="@link"/></xsl:attribute> | ||
</xsl:if> | ||
PAGE <xsl:value-of select="@page" /> | ||
</a> | ||
|
||
</li> | ||
</xsl:if> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters