web template module:
(use-modules (web template))
create a file which defines a hash-table that holds what the various snippets do. It can be any name but here it's called "htags.scm"
(define htags (make-hash-table )) ;; Initialize command table (hash-set! htags 'test (lambda () (format #f "TEST")))
- It defines a tag named 'test' that simply prints "TEST"
load that file from the main file
Create a file that holds the content (here creatively called "file")
<html><body> first line <br> [test] <br> third line <br> </body></html>
use an htag by putting the tag in between square brackets.
to bind it all together, use the template:parse function
(display "Content-type: text/html")(newline)(newline) (map display (template:parse htags (open-input-string (read-delimited "" (open-file "file" "r")))))