Applies all the TOC-related changes to content


/ Published in: Lisp
Save to your folder(s)



Copy this code and paste it in your HTML
  1. ;; applies all the changes needed to properly display (or not) TOC
  2. (define (finalize-toc)
  3. (if TOC:found
  4. (begin
  5. (push SETUP:toc-end TOC:toc)
  6. (reverse TOC:toc)
  7. (let ( str-toc (join TOC:toc "") )
  8. (replace {\[toc\]} page str-toc 512)
  9. (replace {\[TOC\]</a>\[TOC\]} page "</a>" 512)
  10. (replace {\[TOC\]<a name(.*)\[TOC\]} page (append "<a name" $1) 512)))
  11. (begin
  12. (replace {\[TOC\]</a>\[TOC\]} page "" 512)
  13. (replace {\[TOC\]<a name.*\[TOC\]} page "" 512))))

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.