Browse Source

Initial

This is the very first version of a make-based static site generation solution
for rct.in-berlin.de
main
c47 5 months ago
commit
ee05332c75
  1. 58
      Makefile
  2. 100
      html5.tpl
  3. 1
      md2html.sh
  4. 9
      meta-block-template.yaml
  5. 1
      paragraphs-in-term-width.sh

58
Makefile

@ -0,0 +1,58 @@
PROOT=$(CURDIR)
INDIR=$(PROOT)/content
OUTDIR=$(PROOT)/output
PANDOC=/usr/bin/pandoc
PANDOC_OPTS=-f markdown-citations-smart+raw_html --filter md2html.sh --template=html5.tpl -t html5
PANDOC_TERM_OPTS=-f markdown-smart -t html5 --filter md2html.sh --filter paragraphs-in-term-width.sh --template=html5.tpl
SOURCE_FILES = $(shell find $(INDIR) -type f -name '*.md')
TARGET_FILES = $(patsubst %.md,%.html,$(subst $(INDIR),$(OUTDIR),$(SOURCE_FILES)))
SOURCE_DIRS = $(shell find $(INDIR) -type d)
TARGET_DIRS = $(subst $(INDIR),$(OUTDIR),$(SOURCE_DIRS))
SOURCE_CSS = $(INDIR)/style.css
TARGET_CSS = $(subst $(INDIR),$(OUTDIR),$(SOURCE_CSS))
#OTHER_S_FILES = $(shell find $(INDIR) ! -path "$(INDIR)/.git/*" -type f ! -name '*.md' ! -name '.gitignore')
#OTHER_T_FILES = $(subst $(INDIR),$(OUTDIR),$(OTHER_S_FILES))
help:
@echo ' '
@echo ' make all (re)generate html and put css file '
@echo ' make html (re)generate html '
@echo ' make clean remove the generated files '
@echo ' make publish publish generated content '
@echo ' make dh open python httpd in $(OUTDIR) '
@echo ' '
all: html $(TARGET_CSS) #$(OTHER_T_FILES)
html: $(TARGET_FILES)
$(OUTDIR)/%.html: $(INDIR)/%.md html5.tpl md2html.sh paragraphs-in-term-width.sh $(TARGET_CSS)
@mkdir -p $(@D)
$(PANDOC) $(PANDOC_OPTS) $< -o $@
$(TARGET_CSS): $(SOURCE_CSS)
@cp $< $@
#$(OTHER_T_FILES): $(OTHER_S_FILES)
# @cp $^ $@
clean:
@rm -rf $(OUTDIR)/*
publish:
$(shell cd $(OUTDIR) && git add -A && git commit)
dh:
@python -m http.server --bind 127.0.0.1 --directory $(OUTDIR)
.PHONY: help print html TARGET_CSS TARGET_DIRS all clean #OTHER_T_FILES

100
html5.tpl

@ -0,0 +1,100 @@
<!DOCTYPE html>
$if(lang)$
<html lang="$lang$">
$else$
<html lang="en">
$endif$
<head>
$if(title)$
<title>$title$</title>
$endif$
<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(abstract)$
<meta name="abstract" content="$abstract$">
$endif$
$if(keywords)$
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$">
$endif$
$if(description)$
<meta name="description" content="$description$">
$endif$
$for(css)$
<link rel="stylesheet" href="$css$">
$endfor$
$for(header-includes)$
$header-includes$
$endfor$
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="/fonts/Fork-Awesome/css/fork-awesome.min.css">
</head>
<body>
<div class="page-content">
<div class="page-content-left">
$for(include-before)$
$include-before$
$endfor$
$if(title)$
<header id="page-header" role="banner">
<h1>
<a href="/" class="fa fa-home" accesskey="h" title="homepage of rct.in-berlin.de">&nbsp;&nbsp;<span id="homepage-link-text">rct</span></a>
</h1>
$if(subtitle)$
<p class="subtitle">$subtitle$</p>
$endif$
</header>
$endif$
$if(toc)$
<nav id="$idprefix$TOC" role="doc-toc">
$if(toc-title)$
<h2 id="$idprefix$toc-title">$toc-title$</h2>
$endif$
$table-of-contents$
</nav>
$endif$
<main role="main">
<article>
<header>
$if(date)$
<p class="created-date">Created: $date$</p>
</header>
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
<footer id="mod-edit-info">
<p id="page-last-mod">Last edit: $if(moddate)$$moddate$$else$$date$$endif$</p>
</footer>
</article>
</main>
</div>
</div>
<footer id="page-footer" role="contentinfo">
<div id="page-footer-div" class="two-col-grid-container">
<div id="impressum" class="two-col-grid-left">
<a id="link-impressum" href="/impressum/" accesskey="i" title="Impressum of rct.in-berlin.de">Impressum</a>
</div>
<div id="site-created-with" class="two-col-grid-right">
Site created with: <a href="https://www.vim.org" title="Homepage of Vi IMproved editor">vim</a> &amp; <a href="https://pandoc.org" title="Homepage of pandoc document converter">pandoc</a> &amp; <a href="https://forkaweso.me/Fork-Awesome/" title="Homepage of iconic font Fork-Awesome">Fork-Awesome</a>
</div>
</div>
</footer>
</body>
</html>

1
md2html.sh

@ -0,0 +1 @@
/bin/sed 's/\.md/\.html/g'

9
meta-block-template.yaml

@ -0,0 +1,9 @@
---
title:
author:
- Rebeka Catalina Trulsen
date:
moddate:
description:
---

1
paragraphs-in-term-width.sh

@ -0,0 +1 @@
sed 's/<p>/<p class="term-width">/'
Loading…
Cancel
Save