/ Published in: Lisp
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
;; applies all the changes needed to properly display (or not) TOC (define (finalize-toc) (if TOC:found (begin (push SETUP:toc-end TOC:toc) (reverse TOC:toc) (let ( str-toc (join TOC:toc "") ) (replace {\[toc\]} page str-toc 512) (replace {\[TOC\]</a>\[TOC\]} page "</a>" 512) (replace {\[TOC\]<a name(.*)\[TOC\]} page (append "<a name" $1) 512))) (begin (replace {\[TOC\]</a>\[TOC\]} page "" 512) (replace {\[TOC\]<a name.*\[TOC\]} page "" 512))))