A test page for my semi-custom static site generator
1. Introduction
This is an example page that tries to show all features of my semi-custom static site generator. This website is generated using the org-mode HTML publishing features together with a hefty dose of custom Emacs Lisp and CSS. This page is meant as a test of the different styles and functionality of the website. It will contain a lot of Lorem Ipsum.
- This is an unordered list11Here is an inline footnote. On narrow screens, this will not be displayed. Instead, the footnotes will only be in the footnotes section.
- I am trying this out
- Another item
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut22 Hi, I am in the margin. aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Here is an ordered list This is a margin note. On narrow screeens, this will automatially be inlined.
- With a few items
- Great.
Here is a quote block:
:sitemap-function
Plug-in function to use for generation of the sitemap. It is called with two arguments: the title of the site-map and a representation of the files and directories involved in the project as a nested list, which can further be transformed using org-list-to-generic, org-list-to-subtree and alike. Default value generates a plain list of links to all files in the project.
This is a source code block33 This is an out-of line footnote. Footnote definitions are very difficult and we must be careful. For example, any text between this and the next footnote definition or section is considered part of the footnote… For example. this paragraph is part of the sidenote/footnote. :
(defun my-blog-parse-sitemap-list (l) "Convert the sitemap list in to a list of filenames." (mapcar #'(lambda (i) (let ((link (with-temp-buffer (let ((org-inhibit-startup nil)) (insert (car i)) (org-mode) (goto-char (point-min)) (org-element-link-parser))))) (when link (plist-get (cadr link) :path)))) (cdr l)))
1.1. Sectioning and margin notes
This is one level down. This is an inline margin note. I'm not sure I like the org syntax for this one.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
1.2. Margin notes with links
I want to be able to insert margin notes using a custom block. This is another margin note. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Here is a figure: And some text after it. I was able to hack the HTML exporter to get this done properly. This requires some hacking. I finally was able to do this. I like the results.
2. Equations
This is an equation:
\begin{align} \label{org2cebc93} X(\omega) = \int_{-\infty}^{+\infty} x(t) e^{-j\omega t}\ \mathrm{dt} \end{align}And we can reference it: \eqref{org2cebc93}. Good, this works. Here is some inline math: \(a^2 + b^2 = c^2\). And here is an unnumbered equation:
\begin{align*} f(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp \left( -\frac{1}{2} \frac{(x-\mu)^2}{\sigma^2} \right) \end{align*}3. Collapsed source code blocks
Here is a tempo template that lets me insert a folded block:
(require 'org-tempo) (tempo-define-template "html-details" ; just some name for the template '("#+HTML: <details><summary></b>" p "<b></summary>" n p n "#+HTML: </details>" n) "<d" "Insert collapsible block" ; documentation 'org-tempo-tags)
Anything here is collapsed
This is a little nicer than using a #+BEGIN_details
block because it preserves syntax highlighting of nested blocks…
(message "Hello World")
This is what comes after the details block. The code to generate the above is:
=#+BEGIN_details= block because it preserves syntax highlighting of nested blocks... #+begin_src emacs-lisp (message "Hello World") #+end_srcThis is a little nicer than using a
4. More things in the margin
Here we have an equation in the margin. Seems to me that reducing all of physics to this one equation is not the whole story: \begin{equation*} E = mc^2 \end{equation*} It does look pretty though.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.44 Here is more math in the margin, but this time as footnote: \begin{equation*} S = \sum_{i=1}^n f(x_i^{*}) \Delta x_i \end{equation*} Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
4.1. Code in the margin
From: https://en.wikipedia.org/wiki/Fibonacci_sequence
If we wanted to compute the Fibonacci series [1] using emacs lisp, we would do something like this:
(defun fib (n)
(cond ((= n 0) 0)
((= n 1) 1)
(t (+ (fib (- n 1))
(fib (- n 2))))))
But we note that Emacs Lisp does not support tail call optimization, so this will eventually run out of stack space…
In mathematics, the Fibonacci sequence is a sequence in which each number is the sum of the two preceding ones. Numbers that are part of the Fibonacci sequence are known as Fibonacci numbers, commonly denoted \(F_n\). The sequence commonly starts from 0 and 1, although some authors start the sequence from 1 and 1 or sometimes (as did Fibonacci) from 1 and 2. Starting from 0 and 1, the first few values in the sequence are:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144.
The Fibonacci numbers were first described in Indian mathematics, as early as 200 BC in work by Pingala on enumerating possible patterns of Sanskrit poetry formed from syllables of two lengths. They are named after the Italian mathematician Leonardo of Pisa, also known as Fibonacci, who introduced the sequence to Western European mathematics in his 1202 book Liber Abaci.
Fibonacci numbers appear unexpectedly often in mathematics, so much so that there is an entire journal dedicated to their study, the Fibonacci Quarterly. Applications of Fibonacci numbers include computer algorithms such as the Fibonacci search technique and the Fibonacci heap data structure, and graphs called Fibonacci cubes used for interconnecting parallel and distributed systems. They also appear in biological settings, such as branching in trees, the arrangement of leaves on a stem, the fruit sprouts of a pineapple, the flowering of an artichoke, an uncurling fern, and the arrangement of a pine cone's bracts.
5. Images and Figures
Let's add a photo of the top of Mammoth Mountain here. This works and displays the image inline with the main text.
A nicer way to caption inline images is using a margin note here. But this doesn't allow for figure numbering in the caption. I think that is OK.
In the spirit of tufte-css, if we want to display a figure across the whole width of the page, we assign it the fullwidth
class using a #+begin_fullwidth ... #+end_fullwidth
block.
6. Citations and references
7. References
Footnotes
1 | Here is an inline footnote. On narrow screens, this will not be displayed. Instead, the footnotes will only be in the footnotes section. |
2 | Hi, I am in the margin. |
3 | This is an out-of line footnote. Footnote definitions are very difficult and we must be careful. For example, any text between this and the next footnote definition or section is considered part of the footnote… For example. this paragraph is part of the sidenote/footnote. |
4 | Here is more math in the margin, but this time as footnote: \begin{equation*} S = \sum_{i=1}^n f(x_i^{*}) \Delta x_i \end{equation*} |