inweb-bootstrap/inweb2noweb.scm

22 lines
595 B
Scheme
Raw Normal View History

2024-03-09 16:37:34 +00:00
(use-modules (guix build utils))
;; These set of substitutions convert most of the inweb markup syntax
;; to noweb markup syntax, but some parts still need to be converted by hand.
(substitute* (find-files "." "\\.nw$")
(("^@h (.*)\n$" all header)
(string-append "@ \\section{" header "}\n"))
(("^=.*\n$") "<<*>>=\n")
(("^@define ") "#define ")
(("^@enum ") "enum ")
(("^@d ") "#define ")
(("^@e ") "enum ")
(("@<") "<<")
(("@> =") ">>=")
(("@>") ">>")
(("@ =") "<<*>>=")
(("\\|(.*)\\|" all keyword)
(string-append "[[" keyword "]]"))
(("\\[\\[\\]\\]") "||"))