From 6e43c0334391d70e0b09b6fa09c41847c00050a8 Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 Date: Sun, 10 Mar 2024 00:37:34 +0800 Subject: [PATCH] inweb-bootstrap: Add inweb2noweb.scm. --- inweb2noweb.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 inweb2noweb.scm diff --git a/inweb2noweb.scm b/inweb2noweb.scm new file mode 100644 index 0000000..e5a4404 --- /dev/null +++ b/inweb2noweb.scm @@ -0,0 +1,21 @@ +(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 "]]")) + (("\\[\\[\\]\\]") "||")) +