From 88ee48c053f996679983f9fdbe806f7a15b41c4d Mon Sep 17 00:00:00 2001 From: Viktor Kleen Date: Wed, 7 Jan 2015 16:42:28 +0000 Subject: Post blog architecture --- index.md.do | 2 +- lists/all/001 | 1 - lists/all/title | 1 - lists/blog/001 | 1 + lists/blog/title | 1 + lists/default.md.do | 5 +++-- lists/zz_all/001 | 1 + lists/zz_all/002 | 1 + lists/zz_all/title | 1 + posts/blog-architecture.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++ style.css | 2 +- 11 files changed, 57 insertions(+), 6 deletions(-) delete mode 120000 lists/all/001 delete mode 100644 lists/all/title create mode 120000 lists/blog/001 create mode 100644 lists/blog/title create mode 120000 lists/zz_all/001 create mode 120000 lists/zz_all/002 create mode 100644 lists/zz_all/title create mode 100644 posts/blog-architecture.md diff --git a/index.md.do b/index.md.do index 933b1a8..e36b596 100644 --- a/index.md.do +++ b/index.md.do @@ -33,6 +33,6 @@ EOF for x in "${LISTS[@]}"; do printf "* [%s](%s)\n" "$(<$x/title)" "$x.html" while read -r -d $'\n'; do - printf " %s" "$REPLY" + printf " %s\n" "$REPLY" done < "$x/preview" done diff --git a/lists/all/001 b/lists/all/001 deleted file mode 120000 index 659bc10..0000000 --- a/lists/all/001 +++ /dev/null @@ -1 +0,0 @@ -../../posts/hello-world.md \ No newline at end of file diff --git a/lists/all/title b/lists/all/title deleted file mode 100644 index 73a5267..0000000 --- a/lists/all/title +++ /dev/null @@ -1 +0,0 @@ -All Posts diff --git a/lists/blog/001 b/lists/blog/001 new file mode 120000 index 0000000..0583396 --- /dev/null +++ b/lists/blog/001 @@ -0,0 +1 @@ +../../posts/blog-architecture.md \ No newline at end of file diff --git a/lists/blog/title b/lists/blog/title new file mode 100644 index 0000000..657adaa --- /dev/null +++ b/lists/blog/title @@ -0,0 +1 @@ +"Blog" Documentation diff --git a/lists/default.md.do b/lists/default.md.do index daf7453..fffd6e2 100644 --- a/lists/default.md.do +++ b/lists/default.md.do @@ -28,13 +28,14 @@ for n in $(seq 0 $((${#POSTS[@]}-1))); do printf "* [%s](%s)\n" "${POST_TITLES[$n]}" "${POSTS[$n]%.md}.html" done +>"$2/preview" prev_no=3 if [[ ${#POSTS[@]} -gt $prev_no ]]; then - printf "* …\n" > "$2/preview" + printf "* …\n" >> "$2/preview" else prev_no=${#POSTS[@]} fi for n in $(seq $prev_no -1 1); do - printf "* [%s](%s)\n" "${POST_TITLES[-$n]}" "${POSTS[-$n]%.md}.html" >"$2/preview" + printf "* [%s](%s)\n" "${POST_TITLES[-$n]}" "${POSTS[-$n]%.md}.html" >>"$2/preview" done diff --git a/lists/zz_all/001 b/lists/zz_all/001 new file mode 120000 index 0000000..659bc10 --- /dev/null +++ b/lists/zz_all/001 @@ -0,0 +1 @@ +../../posts/hello-world.md \ No newline at end of file diff --git a/lists/zz_all/002 b/lists/zz_all/002 new file mode 120000 index 0000000..0583396 --- /dev/null +++ b/lists/zz_all/002 @@ -0,0 +1 @@ +../../posts/blog-architecture.md \ No newline at end of file diff --git a/lists/zz_all/title b/lists/zz_all/title new file mode 100644 index 0000000..73a5267 --- /dev/null +++ b/lists/zz_all/title @@ -0,0 +1 @@ +All Posts diff --git a/posts/blog-architecture.md b/posts/blog-architecture.md new file mode 100644 index 0000000..be969de --- /dev/null +++ b/posts/blog-architecture.md @@ -0,0 +1,47 @@ +% General Architecture of this "Blogging" System + +The main idea behind this system is that my site is supposed to consist of +*posts* which are organized into *lists of posts*. This mapping is not assumed +to be injective, i.e. a post may be a member of many lists. In fact, this is how +the list [All Posts](/lists/zz_all.html) is made: every post is supposed to be +linked into it. + +To keep order in this mess of data, I have decided to map it into the file +system. I have a folder `posts` which contains all posts and a folder `lists` +with all the lists. Every list is a folder with symbolic links to posts: + + blog + ├── lists + │ ├── all + │ │ ├── 001 -> ../../posts/hello-world.md + │ │ └── title + │ ├── blog + │ │ └── title + └── posts + └── hello-world.md + +As you can see, I have added a special file to each list folder named `title` +which contains the title of the list (as you might have guessed). + +Posts are written as [Markdown](http://en.wikipedia.org/wiki/Markdown) files and +converted to HTML with [Pandoc](http://en.wikipedia.org/wiki/Pandoc). Pandoc +handles this conversion almost perfectly, but I had one small issue with +it. Namely, I want to be able to write mathematics and hence translate +TeX--snippets into something that your browser can display. + +Pandoc has several builtin methods to do this, but most of them either rely on a +specialised TeX--parser or JavaScript. Both were deemed too ugly to use. So I +wrote a filter around Pandoc to extract TeX-snippets and compile them with my +regular LaTeX distribution into SVG. This seems to work quite nicely. + +The next issue was keeping this mess of posts and lists and Markdown files under +control. Traditionally, I would have used a Makefile for that but I wanted +something a little nicer this time. I turned to an old idea of +[Dan Bernstein's](http://cr.yp.to/djb.html): +[Redo](http://cr.yp.to/redo.html). There are several implementations of Redo out +there; eventually I plan to write my own, just as practice. For now, I use a +very minimal implementation in shell script from +. + +More on how exactly the conversion from Markdown to HTML and all the associated +ecosystem works will appear in a later post. diff --git a/style.css b/style.css index 7158c52..ef9e2a5 100644 --- a/style.css +++ b/style.css @@ -2,7 +2,7 @@ body { margin: auto; padding-right: 1em; padding-left: 1em; - font: normal 1.1em/1.3em monospace; + font: normal 1.1em monospace; max-width: 60em; text-align: justify; } -- cgit v1.2.3