⚒Anvil
Sign in

clo / cl-site public

merged

Refactor 'preprocess-*' and 'generate-news' into around-like functions 73

opened by common-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-27.

All preprocess-* functions are now called "around" the original renderer, instead of in separate passes. This approach facilitates passing information between each of the processing steps. The major driver for this change is the need to pass around the original file name, which we need to generate the Edit this page button.

Introduce a way to declare dependencies between pages. That way, we can convert generate-news into a post-processor for news.md, delaying the rendering of index.html until news.md has been generated.

And last but not least: actually add the 'Edit this page' button with a link to our GitLab project!

@dcooper, @mmontone, @vdardel, @tplotnikov: your reviews are highly appreciated! This is quite a big change and I think it's good that we agree on this path forward.

Closes #8.

0 commits, 0 files changed

common-lisp.net added 1 commit <ul><li>a7714620 - No &#39;news.html&#39; page will be generated anymore; no need to ignore</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=866&start_sha=736107d494d4c62f5039a0f10610910aeabdcba1)
common-lisp.net added 1 commit <ul><li>4df7db00 - Compensate the news generator for input change</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=867&start_sha=a7714620672f283cff73af1808f71e28927c13dd)
common-lisp.net added 1 commit <ul><li>361f8ee2 - Stop writing the newsbox to disk (but use global context instead)</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=868&start_sha=4df7db00478e535d7e7ef40dbd7d5f4184f98afd)
common-lisp.net added 1 commit <ul><li>d70d88b8 - Pass all available context to the content processing phase</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=869&start_sha=361f8ee29665843f37bf244a711288a52b920942)
common-lisp.net added 3 commits <ul><li>ae248202 - Fix header not being discarded from content</li><li>4e020a51 - Add missing page heading</li><li>fc5ae7fb - Fix ordering of context variables, preferring header-specified values over framework defaults</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=870&start_sha=d70d88b8b7ac9bfed1d67913b668f0b9e58d244f)
common-lisp.net added 2 commits <ul><li>21905dbb - Introduce macrology to simplify definition and invocation of wrappers</li><li>af5c58aa - Simplify page generation loop</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=871&start_sha=fc5ae7fbe4ab343a6fdce09d9c520243b85437ed)
common-lisp.net added 1 commit <ul><li>74563d90 - Macro hygene: use a generated (anonymous) symbol in macro expansion</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=872&start_sha=af5c58aa32351fbff4faeb5cd3082954c3d4156a)
Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-28.

With these additional commits (simplifications), I'd say this branch is ready to be merged. (As ready as it'll ever be...)

Ccommon-lisp.net

Dave Cooper (@dcooper) on GitLab, 2018-10-28.

I have trouble following those huge loops, but that's just because I never use loop myself.

I guess I'd better get used to it because it seems people around here are quite fond of them.

I missed how the context (i.e. file-name) is actually being passed around. Previously I was thinking the computed-page-content dynamic variable could be used for this purpose, by pre-binding it with some info before loading the LHTML pages in preprocess-lisp-pages.

Finaly some nit-picky stuff:

In make-site, why not do:

(defun make-site (&optional (output-dir *output-dir*)) ... )

instead of binding it again with an inner let variable?

In processing.lisp why use setf when setting the value of a symbol, when setq will do and is more targeted/surgical for the purpose? (I always use setq when possible and only use setf when necessary for setting an actual place).

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-28.

Thanks for your review!

Regarding *output-dir* vs output-dir, it was there when we started this recent flurry of activity. I'll change it, but you got a more fundamental point: we seem to ignore the output directory passed in when processing statics and announcing the output directory...

Fix coming up.

common-lisp.net added 1 commit <ul><li>ec0a4aa0 - Fix output-dir function argument being ignored (and *output-dir* global being used)</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=873&start_sha=74563d904148719220b1f14c9afbd1ebf5232dac)
Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-28.

As for setq vs setf, I've grown used to using setf: it's the generalized version of setq. I wonder: what happens when you setq a place bound by symbol-macrolet?

Anyway, given that we control this code base and we don't use trickery like that, I'll agree with you that setq is fine and probably preferred.

common-lisp.net added 1 commit <ul><li>4f389667 - Use &#39;setq&#39; whereever possible</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=874&start_sha=ec0a4aa0355453fe763c6d68f1b606a5fcb95424)
Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-28.

Regarding your comment

I missed how the context (i.e. file-name) is actually being passed around.

I think one of my next MRs will be to add (more) documentation about the general structure of what we're doing here. Hoping that will lower the barrier of entry.

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-28.

After my latest adjustments of the code (without replacing loop with do), do you have further comments?

My reason to want to use loop over do here is that the init form is also the step form for loop. In case of the rendering driver, we want to initialize with the same value as updating. although I guess dolist with a let* could have been appropriate. For the inner loops, I'm not sure.

Note that I started out with multiple iteration variables, which is hard with dolist (not so hard with do), but very easy with loop. So, that's why it started out that way. As I see the code now, it uses only a single iteration variable on the outer list.

common-lisp.net added 1 commit <ul><li>aa4bd0b9 - Re-enable build pipeline (because it can run everywhere)</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=875&start_sha=4f389667bdd73ae33a729147cc24286eef5b6033)
common-lisp.net added 1 commit <ul><li>eba4bd4b - Fix one too many SETQ conversions</li></ul> [Compare with previous version](https://gitlab.common-lisp.net/clo/cl-site/merge_requests/73/diffs?diff_id=876&start_sha=aa4bd0b965591b09295998761d9bc14c0b66d669)
common-lisp.net mentioned in commit c23f28a2f5f95c6f4e047d1ef1e70290ab9936ac
common-lisp.net merged

Sign in to comment.