Use an html template for Pandoc.

This commit is contained in:
Donald Ephraim Curtis 2012-01-22 14:28:13 -06:00
parent c28172d4d3
commit 27ecad6ca4
4 changed files with 104 additions and 10 deletions

View file

@ -37,7 +37,8 @@
data.map! do |row| data.map! do |row|
[row[0], row[1][0], row[3..-2].join(" ")] [row[0], row[1][0], row[3..-2].join(" ")]
end end
data.sort!
colwidth = [0,0,0] colwidth = [0,0,0]

View file

@ -1,19 +1,24 @@
#content {
table { width: 800px;
border-spacing: 0px; margin-left: auto;
margin-right: auto;
} }
/* td:first-child, th:first-child { */ table {
/* padding-left: 5px; */ width: 800px;
/* padding-right: 5px; */ border-spacing: 0px;
/* } */ border-top: 1px solid #ccc;
/* border-bottom: 1px solid #ccc; */
}
td, th { td, th {
padding: 3px 7px 3px 7px; padding: 2px 7px 2px 7px;
} }
tr.header { tr.header {
background-color: #fad; background-color: #fad;
text-align: left;
font-size: 110%;
} }
tr.odd { tr.odd {

88
html/template.html Normal file
View file

@ -0,0 +1,88 @@
$if(html5)$
<!DOCTYPE html>
<html$if(lang)$ lang="$lang$"$endif$>
$else$
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$>
$endif$
<head>
$if(html5)$
<meta charset="utf-8" />
$else$
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
$endif$
<meta name="generator" content="pandoc" />
$for(author)$
<meta name="author" content="$author$" />
$endfor$
$if(date)$
<meta name="date" content="$date$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ - $endif$$if(pagetitle)$$pagetitle$$endif$</title>
$if(html5)$
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
$endif$
$if(highlighting-css)$
<style type="text/css">
/*<![CDATA[*/
$highlighting-css$
/*]]>*/
</style>
$endif$
$for(css)$
<link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/>
$endfor$
$if(math)$
$if(html5)$
$else$
$math$
$endif$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
<div id="content">
$for(include-before)$
$include-before$
$endfor$
$if(title)$
$if(html5)$
<header>
$else$
<div id="$idprefix$header">
$endif$
<h1 class="title">$title$</h1>
$for(author)$
<h3 class="author">$author$</h3>
$endfor$
$if(date)$
<h4 class="date">$date$</h4>
$endif$
$if(html5)$
</header>
$else$
</div>
$endif$
$endif$
$if(toc)$
$if(html5)$
<nav id="$idprefix$TOC">
$toc$
</nav>
$else$
<div id="$idprefix$TOC">
$toc$
</div>
$endif$
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
</div>
</body>
</html>

2
melpa
View file

@ -28,7 +28,7 @@ function melpa_generate_html {
echo "*** Building html" echo "*** Building html"
cd html || return 1 cd html || return 1
erb index.erb > index.md erb index.erb > index.md
pandoc --css=style.css -s --mathml -t html --smart index.md > index.html pandoc --template=template.html --css=style.css -s --mathml -t html --smart index.md > index.html
cd .. cd ..
echo echo
} }