Using Ed(1) as My Static Site Generator

aartaka.me

91 points by BoingBoomTschak 3 days ago


snackbroken - 2 days ago

> But then, ed is so simple and more or less standard

More or less? ED IS THE STANDARD TEXT EDITOR! [1]

[1] https://www.gnu.org/fun/jokes/ed-msg.html

BoingBoomTschak - 3 days ago

The quite cool journey of a hacker trying to find his favourite SSG itch scratching position.

What inspired me to post it is that I cobbled a fun HTML preprocessor using cpp to someone today: https://git.sr.ht/~q3cpma/html-cpp (I use a Common Lisp contraption for myself).

tonymet - a day ago

I love how much utility 60+ year old Unix commands have. Very powerful, requiring only a few kB of ram, and even 20+ years later, I’m still discovering new utilities.

I did something similar for https://isgithubipv6.web.app/ . Most static site generators are huge ( I was aiming for < 5mb docker container) . I went with `envsubst` , env vars and a simple HTML template.

xelxebar - 2 days ago

Nice! Another tantalizing rabbit hole.

I go full in on ed sporadically. It requires a bit of a brain rewire, but tye UX is closer to pencil and paper, which is hard to beat for encouraging deeper thought, IMHO.

Also, check out edbrowse for a line-oriented browser:

https://en.wikipedia.org/wiki/Edbrowse

It's developed by a blind coder and has a nice core following.

WD-42 - 2 days ago

Fantastic. The Unix hackers are alive and well. Keep it real.

sgt - 2 days ago

I once used m4 to generate my blog. Worked like a charm!

susam - 2 days ago

Impressive! Only three leaps away from using butterflies as static site generator!

kevin_thibedeau - 2 days ago

> It has no file inclusion, for one. So C Preprocessor's #include is no longer accessible. I manage without it

m4 is always there with better macros than CPP.

regus - 2 days ago

I really like the idea of ed. I tried using it recently but having to constantly reprint the block of code you are editing was really tedious.

- 2 days ago
[deleted]
djoldman - 2 days ago

> Should You Use ed As Site Generator?

> No, not at all.

Well, it (totxt.ed) looks pretty inscrutable to me:

  H
  !# Include proxy title
  !# Insert fallback values
  ?<head>?a
  <SUBTITLE></SUBTITLE>
  <DESCRIPTION></DESCRIPTION>
  <IMAGE></IMAGE>
  <IMAGE_ALT></IMAGE_ALT>
  .
  w
  !# Include the template files via script
  g/\(<!--\)*[<#]include \(file=\)*"*\([^">]*\)"* *-*\/*>*/s//&\
  \/[<#]include\/d\
  -1r \3\
  wq\
  /
  g/[<#]include "*\([^">]*\)"*\/*>*/d\
  .,+3w !ed %
  E
  !# Repeat the second time for recursive includes
  g/\(<!--\)*[<#]include \(file=\)*"*\([^">]*\)"* *-*\/*>*/s//&\
  \/[<#]include\/d\
  -1r \3\
  wq\
  /