makefile pandoc magic #4

Merged
ben merged 4 commits from make-pdf into master 2019-09-23 15:55:59 +00:00
9 changed files with 96 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
dist/*.pdf
dist/*.html

41
Makefile Normal file
View File

@ -0,0 +1,41 @@
ISSUES != find issues -type d
DEST_PDF_FILES := $(ISSUES:issues/%=dist/issue-%.pdf)
DEST_HTML_FILES := $(ISSUES:issues/%=dist/issue-%.html)
PANDOC != command -v pandoc 2> /dev/null
all: $(DEST_PDF_FILES) $(DEST_HTML_FILES)
dist/issue-%.pdf: issues/%
$(PANDOC) \
--file-scope \
--from markdown \
--to latex \
--pdf-engine xelatex \
--table-of-contents \
--variable title:"tildeverse zine $@" \
--standalone \
--output $@ \
$</*.md
dist/issue-%.html: issues/%
$(PANDOC) \
--file-scope \
--from markdown \
--to html \
--standalone \
--table-of-contents \
--lua-filter header-permalinks.lua \
--lua-filter increase-header-levels.lua \
--metadata title:"tildeverse zine $@" \
--variable include-before:"<div class=\"container\">" \
--variable include-after:"</div>" \
--css https://tilde.team/css/hacker.css \
--output $@ \
$</*.md
clean:
rm dist/*.html dist/*.pdf
.PHONY: clean

33
dist/index.php vendored Normal file
View File

@ -0,0 +1,33 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://tilde.team/css/hacker.css">
<title>tildeverse zine</title>
</head>
<body>
<div class="container">
<h1>tildeverse zine</h1>
<p>this is the tildeverse zine</p>
<p>get involved and send in some content: <a href="https://tildegit.org/tildeverse/zine">tildeverse/zine</a></p>
<h2>issues</h2>
<?php foreach (glob("dist/*.html") as $issue) {
$issue = mb_substr(basename($issue, ".html"), 6); ?>
<h4>issue <?=$issue?></h4>
<p>
<a href="issue-<?=$issue?>.html">html version</a>
<a href="issue-<?=$issue?>.pdf">pdf version</a>
</p>
<?php } ?>
</div>
</body>
</html>

6
header-permalinks.lua Normal file
View File

@ -0,0 +1,6 @@
function Header(elem)
table.insert(elem.content, pandoc.Space())
table.insert(elem.content, pandoc.Link("§", "#" .. elem.identifier))
return elem
end

View File

@ -0,0 +1,7 @@
function Header(elem)
if elem.level > 1 then
elem.level = elem.level + 1
end
return elem
end

View File

@ -1,5 +1,7 @@
# Diving Into the Depths Of the Tildeverse
author: ubergeek
## Intro
There's a whole lot going on with the tildeverse, and lots of little projects, many of which take some discovering. Here's I'll dive into some of them, which I've since discovered.

1
issues/1/metadata.yml Normal file
View File

@ -0,0 +1 @@
title: tildeverse zine issue 1

View File

@ -1,5 +1,7 @@
# Being Social With Git
author: ubergeek
## Intro
One underrated social aspect in the tildeverse is collaborating via code or document creation. Many people consider that to be "loner work", when in reality, it can be much, much more!

View File

@ -1,5 +1,7 @@
# So, You Wanna Make A Tilde?
author: ubergeek
So, you want to make a Tilde server (aka a pubnix server)? You've got time on your hands. You want to make a new and cool thing, right? Awesome! This article is going to step you through some of the pitfalls, so you can try to ensure it's going to be fun.
## Why?