Commit 58b3b554 authored by PoroCYon's avatar PoroCYon

rss etc.

parent 0fa5105e
out/
stc/mathjax.js
obj/
ningau.sh
miscfiles
......
......@@ -5,14 +5,13 @@
# Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for
# more details.
AWK ?= awk
default: all
DATE:="$(shell date "+%B %e, %Y")"
MAINTITLE:="lo kibystu pe la poros"
AWK ?= awk
PANDOC ?= pandoc
SCSSC ?= sassc
PDMARKDOWN:=markdown_github+raw_tex+yaml_metadata_block+table_captions+implicit_figures+simple_tables+multiline_tables+grid_tables+tex_math_dollars+fenced_code_attributes+inline_code_attributes+markdown_attribute+fancy_lists+all_symbols_escapable+superscript+subscript+header_attributes-emoji-hard_line_breaks
......@@ -35,14 +34,25 @@ SIDEBAR_FILES:=$(shell find src/ -mindepth 1 -maxdepth 1 -type f -name "*.md" -a
SIDEBAR_FILES_CLEAN=$(patsubst src/%.md, -V sidebar-links=%, $(SIDEBAR_FILES))
OUTPUT_FILES:=$(patsubst src/%.md, out/%.html, $(INPUT_FILES))
DATERFC3339:=$(shell LC_TIME='C' date -u '+%FT%TZ')
DATERFC822:=$(shell LC_TIME='C' date -u '+%c')
%/:
mkdir -p "$@"
out/blog/postlist.html: src/blog/postdb.tsv out/blog/
< "$<" $(AWK) -F '\t' -f src/blog/mkpostdb.awk > "$@"
obj/postlist.html: src/blog/postdb.tsv obj/
< "$<" $(AWK) -F '\t' -f src/blog/mkpostlist.awk > "$@"
out/blog.html: src/blog.md out/blog/postlist.html
$(PANDOC) $(PDFLAGS) -f $(PDMARKDOWN) --template=tpl/template-blog.html -A out/blog/postlist.html -t html "$<" -o "$@"
obj/%.xml.pre: tpl/%.xml.pre obj/
< "$<" sed -E -e 's/daterfc3339/$(DATERFC3339)/g' -e 's/daterfc822/$(DATERFC822) +0000/g' > "$@"
obj/%.list.xml: src/blog/mk%list.awk src/blog/postdb.tsv obj/
< "src/blog/postdb.tsv" $(AWK) -F '\t' -f "$<" > "$@"
out/feed/%.xml: obj/%.xml.pre obj/%.list.xml tpl/%.xml.post
@if ! [ -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
cat $^ > "$@"
out/blog.html: src/blog.md obj/postlist.html
$(PANDOC) $(PDFLAGS) -f $(PDMARKDOWN) --template=tpl/template-blog.html -A obj/postlist.html -t html "$<" -o "$@"
out/%.html: src/%.md
@if ! [ -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
......@@ -51,8 +61,9 @@ out/%.html: src/%.md
out/stc/%.css: sty/%.scss out/stc/
$(SCSSC) -t compact -M "$<" "$@"
all: $(wildcard stc/*) $(wildcard tpl/*.html) \
all: obj/ $(wildcard stc/*) $(wildcard tpl/*.html) \
out/stc/style-dark.css out/stc/style-light.css \
out/feed/rss.xml out/feed/atom.xml \
$(OUTPUT_FILES)
@cp -vr stc/ out/
......@@ -67,5 +78,8 @@ install: ningau.sh
test: all
cd out/ && python3 -m http.server 8088 --bind localhost
blogpost:
./mkblogpost.sh
.PHONY: default all clean distclean install test
#!/usr/bin/env bash
set -e
read -erp "Title: " TITLE
read -erp "Filename: " FILENAME
mkdir -p "src/blog/post/"
$EDITOR "src/blog/post/${FILENAME}.md"
if [ -f "src/blog/post/${FILENAME}.md" ]; then
echo -e "${FILENAME}\t$(date '+%F')\t${TITLE}\t$(uuidgen)" >> src/blog/postdb.tsv
fi
{
cmd = "LC_TIME='C' date -u '+%FT%TZ' -d \"" $2 "\""
cmd | getline date
close(cmd)
cmd = "pandoc -f markdown -t html -o - src/blog/post/" $1 ".md | tr '\n' ' '"
cmd | getline content
close(cmd)
cmd = "tail src/blog/post/" $1 ".md -n +3 | head -c 256 | tr '\n' ' '"
cmd | getline summary
close(cmd)
print "<entry><title>" $3 "</title>" \
"<link rel=\"alternate\" type=\"text/html\" href=\"https://pcy.ulyssis.be/blog/post/" $1 ".html\" />" \
"<id>urn:uuid:" $4 "</id>" \
"<published>" date "</published>" \
"<updated>" date "</updated>" \
"<summary>" summary "...</summary>" \
"<content type=\"text/html\"><div xmlns=\"http://www.w3.org/1999/xhtml\">" \
content "</div></content>" \
"<author><name>PoroCYon</name></author></entry>"
}
{
cmd = "LC_TIME='C' date -u '+%c' -d \"" $2 "\""
cmd | getline date
close(cmd)
cmd = "tail src/blog/post/" $1 ".md -n +3 | head -c 256 | tr '\n' ' '"
cmd | getline description
close(cmd)
print "<item><title>" $3 "</title>" \
"<description>" description "...</description>" \
"<link>https://pcy.ulyssis.be/blog/post/" $1 ".html</link>" \
"<guid isPermaLink=\"false\">" $4 "</guid>" \
"<pubDate>" date " +0000</pubDate></item>"
}
hello-world 2017-12-13 Hello, world!
hello-world 2017-12-13 Hello, world! 69c41ec1-6053-48c8-84a6-347eaffe5e1f
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>lo kibykarni pe la poros</title>
<subtitle>PoroCYon's blog.</subtitle>
<link href="https://pcy.ulyssis.be/feed/atom.xml" rel="self" />
<link href="https://pcy.ulyssis.be/blog.html" />
<id>urn:uuid:81efaf4f-48ec-40eb-b0f1-be9620bd78f5</id>
<updated>daterfc3339</updated>
<script src="/stc/script.js"></script>
<link href="/feed/atom.xml" type="application/atom+xml" rel="alternative" title="Blog Atom feed" />
<link href="/feed/rss.xml" type="application/rss+xml" rel="alternative" title="Blog RSS feed" />
</channel>
</rss>
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>lo kibykarni pe la poros</title>
<description>PoroCYon's blog</description>
<link>https://pcy.ulyssis.be/blog.html</link>
<lastBuildDate>daterfc822</lastBuildDate>
<pubDate>Wed, 13 Dec 2017 12:45:37 +0000</pubDate>
<ttl>1800</ttl>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment