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 transcluded as a section in the page:
{/page name}
The displayed modification time at the bottom of the page is the latest of the page itself or any transcluded pages it contains.
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 a video player {]id|/path/to/video|/path/to/thumbnail|fallback text for download link (if HTML5 video is not supported)} // shorthand for paragraphs, can embed other markup inside it {¶graph 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 tables {[column 1 header|column 2 header|column 3 header} {|simple data|{@bold data}|{*https://nilfm.cc|link data}} {|more|and more|and more data!} {;} // shorthand for publish date (eg, for blog posts; renders as <time class='publish-date'>) {+2022-02-22} // shorthand for explicit monospace, sans, and serif font respecively: {=some mono text} {(some sans serif text} {)some serif text}
eureka
defines the following constants as C macros in the config.h
to allow easy customization:
- LEXICON_SIZE: max size of the
Lexicon
, corresponds to the number of pageseureka
can keep track of - TAG_BODY_SIZE: max size for an individual markup body (in bytes)
- NAME: the title of the site
- DOMAIN: currently unused
- LOGO_HTML: HTML to put in the header h1 tag, verbatim
- ABOUT_HTML: HTML content for the front page, placed between <header> and <nav>
- CONTACT_HTML: the contact info line at the bottom of every page (except the front page, where it would typically already be in ABOUT)
- FOOTER_HTML: arbitrary footer HTML; in the case of nilFM, it shows SVG icons which link to the hack lab, the Light Crystal Systems website, and the Merveilles webring
- LICENSE_HTML: the license link at the bottom of every page
- SITEROOT: the path where the rendered HTML is placed; include trailing slash
- MAINCSS and FRONTCSS: to differentiate styles used for the landing page and the rest of the site
- TWTXT: path to the twtxt file relative to the SITEROOT; if you don't want twtxt on the front page, use a nonexistent filename
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 at the time of writing, from about 13MB to just under 1MB.
eureka
and its helper tw.sh
expect the twtxt file to be in descending order (latest first), although this may change in the future.
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.