nilFM

eureka

eureka is a simple static site generator based on Devine Lu Linvega's generator for the new version of 100r.co. It renders this site.

eureka simply reads .htm files in inc/ and applies a template around them, giving them a <header>, <nav>, and <footer>. The <nav> content is also located in inc/meta.nav.htm, and, contrary to 100r.co's engine, special rules are applied when templating around it to render the landing page (index.html).

As in the original 100r.co engine, pages can be linked in other pages by surrounding the short page name (not including inc/ or the .htm extension, and replacing underscores with spaces) with curly brackets:

{page name}

If you put a forward-slash before the filename (but inside the brackets), the file will be injected as a section in the page:

{/page name}

I expanded this syntax to come up with a shorthand markup for many HTML tags that makes it much easier and faster to write blog posts and memex entries:

// shorthand for arbitary link
{*destination url|text}

// shorthand for an image you can click to see the full sized version
{:anchor-id|image url|alt text}

// shorthand for an image with arbitrary link destination
{?anchor-id|destination url|image url|alt text}

// shorthand for an audio player
{_/path/to/media}

// shorthand for paragraphs, can embed other markup inside it
{&paragraph text {with a link} {@and some bold text}}

// shorthand for ordered lists, can embed other markup inside it
{#
  {-item one}
  {-item two}
  {-item three}
}

// shorthand for unordered lists, can embed other markup inside it
{,
  {-item one}
  {-item two}
  {-item three}
}

// shorthand for bold
{@bold text}

// shorthand for italic
{~italic text}

// shorthand for code
{`short code}

// shorthand for pre
{$longer code}

// shorthand for quote
{'short quote}

// shorthand for blockquote
{>longer quote}

// shorthand for strikethrough
{\crossed-out text}

// shorthand for level 3 heading (levels one and two are taken care of by the site title and the page title)
{!heading text}

// shorthand for level 4 heading
{.heading text}

// shorthand for publish date (eg, for blog posts; renders as <time class='publish-date'>)
{+2022-02-22}

eureka defines the following constants as C macros in the config.h to allow easy customization:

In addition, there is a thumbnailer that uses ImageMagick to create low-bandwidth thumbnails at 500px wide and 16 colors, and store them in a subdirectory alongside the full size images. eureka has a function to automatically replace the inline images within pages with the thumbnails, but leave the links they point to untouched. This reduced the page size of images, one of the heaviest pages on this site, from about 13MB to just under 1MB.

Eureka also parses a twtxt file at SITEROOT/twtxt.txt and displays the latest three entrires on the front page. It expects the file to be in descending order.

This started out as a very minimal tweak on the 100r.co SSG, but now with the layout tweaks and markup extensions, it provides a very full-featured (for my purposes) site management/editing experience. It gets out of the way but provides powerful formatting and linking capabilities to make managing this site (and others, possibly) painless, fast, and easy.