define-blog-post
A domain-specific language for writing blog posts
Arthur A. Gleckler
talks@speechcode.comBALISP
Sat 2 Feb 2019
Why?
-
Org mode
Powerful, but controlling layout and appearance is too much work. -
Power
Full power of Scheme to produce HTML.
Example blog post definition
(define-blog-post (push-pin-maps "Push-pin Maps" (1 9 2019) ())
((states '("AK" "AZ" "CA" "CO" "CT" "DE" "FL" "GA" "HI" "KY" "MA"
"MD" "ME" "MN" "MO" "NH" "NJ" "NM" "NV" "NY" "OH" "OK"
"OR" "PA" "RI" "TN" "TX" "UT" "VA" "VT" "WA" "WI"))
(selectors (string-join ", #" states "#"))
(svg (make-raw-xml (load-states-svg))))
(hero
((style) selectors " { fill: black; }\n.state { fill: #d3d3d3; }\nsvg { width: 100%; }")
svg)
(blurb
((p)
"Use these interactive maps to visualize where you've been "
((a href "/maps/usa") "in the USA")
" and "
((a href "/maps/world") "in the world")
"."))
((p) "My mother has a wall map that is covered with push pins marking the many countries she has visited. Her map inspired me to make two web pages, one for the US and one for the world, that anyone can use to visualize all the places they've visited.")
((ul)
((li) ((a href "/maps/usa") "USA"))
((li) ((a href "/maps/world") "World")))
((p) "Both are written using simple JavaScript, without frameworks, in a direct style that might not be practical for larger projects, but that works well for these small pages.")
((p) "Thanks to those who made the excellent SVG maps used here available through Wikipedia."))
define-blog-post
produces a card…
(define-blog-post (push-pin-maps "Push-pin Maps" (1 9 2019) ())
((states …)
(selectors …)
(svg …))
(hero
((style) …)
svg)
(blurb
((p)
"Use these interactive maps to visualize where you've been "
((a href "/maps/usa") "in the USA")
" and "
((a href "/maps/world") "in the world")
"."))
((p) "My mother has a wall map that is covered with push pins marking the many countries she has visited. Her map inspired me to make two web pages, one for the US and one for the world, that anyone can use to visualize all the places they've visited.")
…)
… as well as RSS feeds for the blog and for each label
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Speechcode.com</title>
<link>https://speechcode.com/</link>
<description>Blog posts on Miscellaneous by Arthur A. Gleckler</description>
<language>en-US</language>
<webMaster>webmaster@speechcode.com (Arthur A. Gleckler)</webMaster>
<atom:link href="https://speechcode.com/blog/label/miscellaneous/rss" rel="self" type="application/rss+xml"></atom:link>
…
<item>
<title>Push-pin Maps</title>
<link>https://speechcode.com/blog/push-pin-maps</link>
<guid>https://speechcode.com/blog/push-pin-maps</guid>
<description>
<p>Use these interactive maps to visualize where you've been <a href="/maps/usa">in the USA</a> and <a href="/maps/world">in the world</a>.</p><a href="https://speechcode.com/blog/push-pin-maps">more</a></description>
<dc:creator>Arthur A. Gleckler</dc:creator>
<pubDate>Wed, 9 Jan 2019 12:00:00 +0000</pubDate></item></channel></rss>