diff options
Diffstat (limited to 'posts/blog-architecture.md')
| -rw-r--r-- | posts/blog-architecture.md | 47 |
1 files changed, 47 insertions, 0 deletions
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. | ||
