Script and first template.
This commit is contained in:
parent
f85b6b6ae4
commit
bbaa2cd135
30
doc.sh
Executable file
30
doc.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
dir="$(dirname "$(readlink -e "$0")")"
|
||||
|
||||
if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
echo "Usage: doc.sh <template> <input file>"
|
||||
exit 0
|
||||
elif [ "$1" = "-l" ] || [ "$1" = "--list-templates" ]; then
|
||||
find "$dir" -name "*.template.html" | sed -e "s!$dir/!!g" -e "s!.template.html!!g" | sort
|
||||
exit 0
|
||||
fi
|
||||
|
||||
template="$1"
|
||||
input="$2"
|
||||
|
||||
output="$3"
|
||||
if [ "$output" = "" ]; then
|
||||
output=$(echo "$input" | rev | cut -d"." -f2- | rev)
|
||||
output="$output.pdf"
|
||||
fi
|
||||
|
||||
title=$(grep -m 1 "^# " "$input" | sed "s/^# //g")
|
||||
|
||||
pandoc --standalone\
|
||||
-f gfm\
|
||||
--pdf-engine weasyprint\
|
||||
--metadata "title=$title"\
|
||||
--template="$dir/$template.template.html"\
|
||||
-o "$output"\
|
||||
"$input"
|
83
protocol.template.html
Normal file
83
protocol.template.html
Normal file
@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="$lang$" xml:lang="$lang$"$if(dir)$ dir="$dir$"$endif$>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
||||
<style>
|
||||
* {
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 2cm;
|
||||
@bottom-center {
|
||||
content: counter(page) " / " counter(pages);
|
||||
}
|
||||
}
|
||||
|
||||
h1 {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
border-bottom: 0.2mm solid #CCCCCC;
|
||||
padding-top: 6mm;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
tr:nth-child(odd){
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
tr:nth-child(even){
|
||||
background: #eeeeee;
|
||||
}
|
||||
|
||||
th {
|
||||
border: 0.2mm solid #333333;
|
||||
padding: 2mm;
|
||||
background-color: #c0ffdd;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 0.2mm solid #333333;
|
||||
padding: 2mm;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
$for(include-before)$
|
||||
$include-before$
|
||||
$endfor$
|
||||
$if(title)$
|
||||
<header id="title-block-header">
|
||||
<!--<h1 class="title">$title$</h1>-->
|
||||
$if(subtitle)$
|
||||
<p class="subtitle">$subtitle$</p>
|
||||
$endif$
|
||||
$for(author)$
|
||||
<p class="author">$author$</p>
|
||||
$endfor$
|
||||
$if(date)$
|
||||
<p class="date">$date$</p>
|
||||
$endif$
|
||||
</header>
|
||||
$endif$
|
||||
$if(toc)$
|
||||
<nav id="$idprefix$TOC" role="doc-toc">
|
||||
$table-of-contents$
|
||||
</nav>
|
||||
$endif$
|
||||
$body$
|
||||
$for(include-after)$
|
||||
$include-after$
|
||||
$endfor$
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user