Change references to a page


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



Copy this code and paste it in your HTML
  1. ;; changes all references to the given page-old
  2. ;; to references to the given page-new
  3. (define (change-refs page-old page-new)
  4. (let ( page-old-filename (replace "_" (dup page-old 1) ".")
  5. rexp (append {\[\[} page-old {\]\]})
  6. subst (append {[[} page-new {]]})
  7. files (slice (directory "pages/") 2) )
  8. (dolist (fle files)
  9. (let ( content (get-content fle) )
  10. (if (find rexp content 0)
  11. (begin
  12. (replace rexp content subst 512)
  13. (write-file (append "pages/" fle) content)))))))

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.