#!/bin/bash

(echo '
---
title:  CSCI 3410 -- First Commands
author: Clément Aubert
dir: ltr
lang: en
documentclass: scrartcl
papersize: letter
header-includes:
 - \setromanfont[Ligatures={Common,TeX}]{Linux  Libertine O}
 - \setmainfont[Ligatures={Common,TeX}]{Linux  Libertine O}
 - \setsansfont{Linux Biolinum O}
 - \setmonofont{DejaVu Sans Mono}
 - \hypersetup{colorlinks=true, allcolors=black}
 - \topmargin=-0.45in
 - \evensidemargin=0in
 - \oddsidemargin=0in
 - \textwidth=6.5in
 - \textheight=9.0in
 - \headsep=0.25in
 - \linespread{1}
 - \setlength\parindent{0pt}
 - \usepackage{lastpage}
 - \usepackage{fancyhdr}
 - \pagestyle{fancy}
 - \fancypagestyle{plain}{
        \cfoot{\href{http://spots.augusta.edu/caubert/pcp/}{spots.augusta.edu/caubert/db/}}
        \rfoot{Page\ \thepage\ of\ \protect\pageref{LastPage}}\renewcommand{\footrulewidth}{0.4pt}
        \lhead{}
        \rhead{}
        \renewcommand{\headrulewidth}{0pt}
    }
 - \lhead{\textbf{First Commands in `SQL`}}
 - \rhead{CSCI 3410 - Database Systems}
 - \lfoot{Mon., 29th January}
 - \cfoot{\href{http://spots.augusta.edu/caubert/db/}{spots.augusta.edu/caubert/db/}}
 - \rfoot{Page\ \thepage\ of\ \protect\pageref{LastPage}}
 - \renewcommand{\footrulewidth}{0.4pt}
 - \renewcommand{\headrulewidth}{0.4pt}
 - \usepackage{fvextra}
 - \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}
--- 
~~~~{.sql}
'  && cat index.sql  && echo '~~~~


<p><a href="../../">Back</a> ~ <a href="index.sql">Code</a> ~ <a href="index.pdf">Printable document</a></p>') | pandoc \
--standalone \
--email-obfuscation=references \
--columns=10000 \
--section-divs \
--toc \
--toc-depth=1 \
-c ../../../../../../web/style/style.css \
--metadata=title:"CSCI 3410 -- First Commands" \
-t html5 \
-M date="`date "+%B %e, %Y"`" \
-H head.html \
-o index.html


(echo '
---
title:  CSCI 3410 -- First Commands
author: Clément Aubert
dir: ltr
lang: en
documentclass: scrartcl
papersize: letter
header-includes:
 - \setromanfont[Ligatures={Common,TeX}]{Linux  Libertine O}
 - \setmainfont[Ligatures={Common,TeX}]{Linux  Libertine O}
 - \setsansfont{Linux Biolinum O}
 - \setmonofont{DejaVu Sans Mono}
 - \hypersetup{colorlinks=true, allcolors=black}
 - \topmargin=-0.45in
 - \evensidemargin=0in
 - \oddsidemargin=0in
 - \textwidth=6.5in
 - \textheight=9.0in
 - \headsep=0.25in
 - \linespread{1}
 - \setlength\parindent{0pt}
 - \usepackage{lastpage}
 - \usepackage{fancyhdr}
 - \pagestyle{fancy}
 - \fancypagestyle{plain}{
        \cfoot{\href{http://spots.augusta.edu/caubert/pcp/}{spots.augusta.edu/caubert/db/}}
        \rfoot{Page\ \thepage\ of\ \protect\pageref{LastPage}}\renewcommand{\footrulewidth}{0.4pt}
        \lhead{}
        \rhead{}
        \renewcommand{\headrulewidth}{0pt}
    }
 - \lhead{\textbf{First Commands in `SQL`}}
 - \rhead{CSCI 3410 - Database Systems}
 - \lfoot{Mon., 29th January}
 - \cfoot{\href{http://spots.augusta.edu/caubert/db/}{spots.augusta.edu/caubert/db/}}
 - \rfoot{Page\ \thepage\ of\ \protect\pageref{LastPage}}
 - \renewcommand{\footrulewidth}{0.4pt}
 - \renewcommand{\headrulewidth}{0.4pt}
 - \usepackage{fvextra}
 - \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}
--- 
~~~~{.sql}
'  && cat index.sql  && echo '~~~~') | pandoc -f markdown --pdf-engine=xelatex -M date="`date "+%B %e, %Y"`" -o index.pdf
