News for hackers. Stuff that matters.
Re:Pollen: the book is a program by CJefferson on Tuesday May 28, 2019 @02:33AM (#20027711)
Does anyone know of anything similar in a more popular language, like Python?

In particular, what I dislike about all other static generators is they come with their own templating language, which is usually limited, stupid and broken in various ways. I just want to mix Python and Markdown, but have the code replaced with its output, to make it easy to build more complicated structures.

Maybe I'll just write something myself...

Re:Pollen: the book is a program by velcrovan on Wednesday May 29, 2019 @10:09AM (#20040343)
Interestingly, the author of Pollen attempted to write it in Pollen first, then switched to Racket.

> “I wrote the initial version of Pollen in Python. I devised a simplified markup-notation language for the source files. This language was compiled into XML-ish data structures using ply (Python lex/yacc). These structures were parsed into trees using LXML. The trees were combined with templates made in Chameleon. These templates were rendered and previewed with the Bottle web server.

> “Did it work? Sort of. Source code went in; web pages came out. But it was also complicated and fragile. Moreover, though the automation was there, there wasn’t yet enough abstraction at the source layer. I started thinking about how I could add a source preprocessor.”

[1] https://docs.racket-lang.org/pollen/Backstory.html#%28part._...

Re:Pollen: the book is a program by gpoore on Tuesday May 28, 2019 @01:06PM (#20032053)
I've created https://github.com/gpoore/codebraid for running Python in Pandoc Markdown. It's written in Python and focused on executing Python code, though it also supports Julia, R, Rust, Bash, and JavaScript. It operates on the Pandoc AST, so there are no Markdown preprocessor issues and there's no custom Markdown syntax.
Re:Pollen: the book is a program by mbar84 on Tuesday May 28, 2019 @02:44AM (#20027761)
I'm working pretty much exactly on that. It's not at all fit for consumption yet though. This is a file I'm using for testing: https://gitlab.com/mbarkhau/litprog/blob/master/lit_v3/11_ov...
Re:Pollen: the book is a program by raizinho on Tuesday May 28, 2019 @06:09AM (#20028684)
There's bookdown in R which is great.

https://bookdown.org/yihui/bookdown/

Re:Pollen: the book is a program by jboynyc on Tuesday May 28, 2019 @03:53AM (#20028098)
Perhaps pweave, which is like knitr for Python.

http://mpastell.com/pweave/

Re:Pollen: the book is a program by criddell on Tuesday May 28, 2019 @08:13AM (#20029265)
If you want to publish on the web, why not give Pollen a try (I'm assuming you haven't)? It isn't really a static generator, but the end result is similar.

It's a pretty neat system and worth learning before you head off to invent your own wheel.

Re:Pollen: the book is a program by CJefferson on Tuesday May 28, 2019 @08:25AM (#20029339)
I tried pollen, but I just don't have room for another language in my head I'm only going to use for one purpose, and I felt the cool features were around the combination of text and code, not the racket/lisp part.
Re:Pollen: the book is a program by criddell on Tuesday May 28, 2019 @09:05AM (#20029571)
Not a fan of DSL's? I err on the other side of that coin and tend to produce them even when it may be overkill.
Re:Pollen: the book is a program by bayesian_horse on Tuesday May 28, 2019 @03:30AM (#20027995)
Pointers: paged.js for paged-media polyfills. Sphinx (you can customize the layout). Static page generators.

In general, you'll want javascript-assisted solutions working in the browser, and then some pre-processing in Python, depending on your needs.