Skip to content

Instantly share code, notes, and snippets.

@nicferrier
Created July 14, 2013 16:42
Show Gist options
  • Save nicferrier/5994882 to your computer and use it in GitHub Desktop.
Save nicferrier/5994882 to your computer and use it in GitHub Desktop.
(defun tapas-creole->bootstrap (struct)
"Transform STRUCT, a creole structure, into something bootstrapable.
HTML DIV elements are hacked into the structure wherever we find
an HR element. The HR elements are retained."
(let ((tx
(loop for e in struct
append
(if (eq (car e) 'hr)
(list '(hr) '(plugin-html . "</div><div class=\"section\">"))
(list e)))))
(append '((plugin-html . "<div>")) tx '((plugin-html . "</div>")))))
(defun tapas-creole (page destination)
(interactive
(list
"main.creole"
(get-buffer-create "*testcreole*")))
(creole-wiki
(concat tapas-indexroot page)
:destination destination
:structure-transform-fn 'tapas-creole->bootstrap
:css (list "/-/bootstrap/css/bootstrap.css"
"/-/main.css"))
(when (called-interactively-p 'interactive)
(switch-to-buffer destination)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment