Refactor tupfiles

This commit is contained in:
Fabien Freling 2019-10-29 12:53:51 +01:00
parent eab3405456
commit 4beeae10ab
11 changed files with 71 additions and 34 deletions

View file

@ -1,4 +1,4 @@
include_rules
: foreach *.md |> !pandoc |>
: foreach *.md |> !html |>
: favicon.png |> !tup_preserve |>

View file

@ -1,31 +1,11 @@
&root = .
!pandoc = | &(root)/templates/footer.html \
|> ^ pandoc %f^ \
pandoc --from markdown --to html \
--template=&(root)/templates/pandoc.html \
--css &(root)/css/style.css \
--include-in-header=&(root)/templates/header.html \
--include-before-body=&(root)/templates/nav.html \
--include-after-body=&(root)/templates/footer.html \
%f | sed 's|%%webRoot%%|&(root)|g' > %o \
|> %B.html
HTML_TEMPLATE = main.html
!project = | &(root)/templates/footer.html \
|> ^ pandoc %f^ \
!html = | &(root)/templates/footer.html \
|> ^ html %f^ \
pandoc --from markdown --to html \
--template=&(root)/templates/project.html \
--css &(root)/css/style.css \
--include-in-header=&(root)/templates/header.html \
--include-before-body=&(root)/templates/nav.html \
--include-after-body=&(root)/templates/footer.html \
%f | sed 's|%%webRoot%%|&(root)|g' > %o \
|> %B.html
!article = | &(root)/templates/footer.html \
|> ^ pandoc %f^ \
pandoc --from markdown --to html \
--template=&(root)/templates/article.html \
--template=&(root)/templates/$(HTML_TEMPLATE) \
--css &(root)/css/style.css \
--include-in-header=&(root)/templates/header.html \
--include-before-body=&(root)/templates/nav.html \

View file

@ -1,4 +1,5 @@
include_rules
HTML_TEMPLATE = article.html
: |> ./generate_listing.sh > %o |> index.md
: foreach *.md |> !article |>
: *.md |> ./generate_listing.sh > %o |> index.md
: foreach *.md |> !html |>

1
projects/Tuprules.tup Normal file
View file

@ -0,0 +1 @@
HTML_TEMPLATE = project.html

View file

@ -1,4 +1,4 @@
include_rules
: index.md |> !project |>
: index.md |> !html |>
: thumbnail.png |> convert %f -blur 0x8 %o |> thumb.png

View file

@ -1,4 +1,4 @@
include_rules
: index.md |> !project |>
: index.md |> !html |>
: thumbnail.png |> convert %f -blur 0x8 %o |> thumb.png

View file

@ -1,3 +1,3 @@
include_rules
: index.md |> !project |>
: index.md |> !html |>

View file

@ -1,4 +1,4 @@
include_rules
: index.md |> !project |>
: index.md |> !html |>
: thumbnail.gif |> convert %f -blur 0x8 %o |> thumb.gif

View file

@ -1,4 +1,4 @@
include_rules
: index.md |> !project |>
: index.md |> !html |>
: thumbnail.jpg |> convert %f -blur 0x8 %o |> thumb.jpg

View file

@ -1,4 +1,4 @@
include_rules
: index.md |> !project |>
: index.md |> !html |>
: thumbnail.png |> convert %f -blur 0x8 %o |> thumb.png

55
templates/main.html Normal file
View file

@ -0,0 +1,55 @@
<!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" />
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$
$if(date-meta)$
<meta name="dcterms.date" content="$date-meta$" />
$endif$
$if(keywords)$
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ $endif$$pagetitle$</title>
$for(css)$
<link rel="stylesheet" href="$css$" />
$endfor$
$if(math)$
$math$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
</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>