commit b9eb2a0bf6c47cb02967a3286c122b4a7506d11d parent 4e91fd2dc72ee6180843012ee2b9778391529ced Author: Decay <decay@todayiwilllaunchmyinfantsonintoorbit.com> Date: Thu, 15 Oct 2020 15:15:12 -0700 Clean up page tree generation Don't generate dead <ul></ul> pairs for empty subtrees Diffstat:
M | src/format.lisp | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/format.lisp b/src/format.lisp @@ -53,9 +53,10 @@ (page-name (getf page :name)) (page-path (append parent-path (list page-name))) (page-path-str (str:join "/" page-path))) - (format stream "<li><a href=\"~apage/~a\">~a</a></li>~%" (% root-uri) page-path-str (getf page :title)) - (if (string= page-name next-name) - (descend page-path descendents page)))) + (format stream "<li><a href=\"~apage/~a\">~a</a>~%" (% root-uri) page-path-str (getf page :title)) + (if (and (string= page-name next-name) descendents) + (descend page-path descendents page)) + (format stream "</li>~%"))) (format stream "</ul>~%"))) (descend nil (% path) (% pages)))))