diff options
-rw-r--r-- | index.md.do | 2 | ||||
l--------- | lists/blog/001 | 1 | ||||
-rw-r--r-- | lists/blog/title | 1 | ||||
-rw-r--r-- | lists/default.md.do | 5 | ||||
l--------- | lists/zz_all/001 (renamed from lists/all/001) | 0 | ||||
l--------- | lists/zz_all/002 | 1 | ||||
-rw-r--r-- | lists/zz_all/title (renamed from lists/all/title) | 0 | ||||
-rw-r--r-- | posts/blog-architecture.md | 47 | ||||
-rw-r--r-- | style.css | 2 |
9 files changed, 55 insertions, 4 deletions
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 | |||
33 | for x in "${LISTS[@]}"; do | 33 | for x in "${LISTS[@]}"; do |
34 | printf "* [%s](%s)\n" "$(<$x/title)" "$x.html" | 34 | printf "* [%s](%s)\n" "$(<$x/title)" "$x.html" |
35 | while read -r -d $'\n'; do | 35 | while read -r -d $'\n'; do |
36 | printf " %s" "$REPLY" | 36 | printf " %s\n" "$REPLY" |
37 | done < "$x/preview" | 37 | done < "$x/preview" |
38 | done | 38 | done |
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 | |||
28 | printf "* [%s](%s)\n" "${POST_TITLES[$n]}" "${POSTS[$n]%.md}.html" | 28 | printf "* [%s](%s)\n" "${POST_TITLES[$n]}" "${POSTS[$n]%.md}.html" |
29 | done | 29 | done |
30 | 30 | ||
31 | >"$2/preview" | ||
31 | prev_no=3 | 32 | prev_no=3 |
32 | if [[ ${#POSTS[@]} -gt $prev_no ]]; then | 33 | if [[ ${#POSTS[@]} -gt $prev_no ]]; then |
33 | printf "* …\n" > "$2/preview" | 34 | printf "* …\n" >> "$2/preview" |
34 | else | 35 | else |
35 | prev_no=${#POSTS[@]} | 36 | prev_no=${#POSTS[@]} |
36 | fi | 37 | fi |
37 | 38 | ||
38 | for n in $(seq $prev_no -1 1); do | 39 | for n in $(seq $prev_no -1 1); do |
39 | printf "* [%s](%s)\n" "${POST_TITLES[-$n]}" "${POSTS[-$n]%.md}.html" >"$2/preview" | 40 | printf "* [%s](%s)\n" "${POST_TITLES[-$n]}" "${POSTS[-$n]%.md}.html" >>"$2/preview" |
40 | done | 41 | done |
diff --git a/lists/all/001 b/lists/zz_all/001 index 659bc10..659bc10 120000 --- a/lists/all/001 +++ b/lists/zz_all/001 | |||
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/all/title b/lists/zz_all/title index 73a5267..73a5267 100644 --- a/lists/all/title +++ b/lists/zz_all/title | |||
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 @@ | |||
1 | % General Architecture of this "Blogging" System | ||
2 | |||
3 | The main idea behind this system is that my site is supposed to consist of | ||
4 | *posts* which are organized into *lists of posts*. This mapping is not assumed | ||
5 | to be injective, i.e. a post may be a member of many lists. In fact, this is how | ||
6 | the list [All Posts](/lists/zz_all.html) is made: every post is supposed to be | ||
7 | linked into it. | ||
8 | |||
9 | To keep order in this mess of data, I have decided to map it into the file | ||
10 | system. I have a folder `posts` which contains all posts and a folder `lists` | ||
11 | with all the lists. Every list is a folder with symbolic links to posts: | ||
12 | |||
13 | blog | ||
14 | ├── lists | ||
15 | │ ├── all | ||
16 | │ │ ├── 001 -> ../../posts/hello-world.md | ||
17 | │ │ └── title | ||
18 | │ ├── blog | ||
19 | │ │ └── title | ||
20 | └── posts | ||
21 | └── hello-world.md | ||
22 | |||
23 | As you can see, I have added a special file to each list folder named `title` | ||
24 | which contains the title of the list (as you might have guessed). | ||
25 | |||
26 | Posts are written as [Markdown](http://en.wikipedia.org/wiki/Markdown) files and | ||
27 | converted to HTML with [Pandoc](http://en.wikipedia.org/wiki/Pandoc). Pandoc | ||
28 | handles this conversion almost perfectly, but I had one small issue with | ||
29 | it. Namely, I want to be able to write mathematics and hence translate | ||
30 | TeX--snippets into something that your browser can display. | ||
31 | |||
32 | Pandoc has several builtin methods to do this, but most of them either rely on a | ||
33 | specialised TeX--parser or JavaScript. Both were deemed too ugly to use. So I | ||
34 | wrote a filter around Pandoc to extract TeX-snippets and compile them with my | ||
35 | regular LaTeX distribution into SVG. This seems to work quite nicely. | ||
36 | |||
37 | The next issue was keeping this mess of posts and lists and Markdown files under | ||
38 | control. Traditionally, I would have used a Makefile for that but I wanted | ||
39 | something a little nicer this time. I turned to an old idea of | ||
40 | [Dan Bernstein's](http://cr.yp.to/djb.html): | ||
41 | [Redo](http://cr.yp.to/redo.html). There are several implementations of Redo out | ||
42 | there; eventually I plan to write my own, just as practice. For now, I use a | ||
43 | very minimal implementation in shell script from | ||
44 | <https://github.com/apenwarr/redo>. | ||
45 | |||
46 | More on how exactly the conversion from Markdown to HTML and all the associated | ||
47 | ecosystem works will appear in a later post. | ||
@@ -2,7 +2,7 @@ body { | |||
2 | margin: auto; | 2 | margin: auto; |
3 | padding-right: 1em; | 3 | padding-right: 1em; |
4 | padding-left: 1em; | 4 | padding-left: 1em; |
5 | font: normal 1.1em/1.3em monospace; | 5 | font: normal 1.1em monospace; |
6 | max-width: 60em; | 6 | max-width: 60em; |
7 | text-align: justify; | 7 | text-align: justify; |
8 | } | 8 | } |