From e3642c513084a202ee2195dab902d77a0e9575cc Mon Sep 17 00:00:00 2001 From: Qrius Date: Tue, 6 May 2025 11:12:47 +0200 Subject: Add info on code blocks and strings --- smp.1 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/smp.1 b/smp.1 index 33a96dc..40942ad 100644 --- a/smp.1 +++ b/smp.1 @@ -94,6 +94,41 @@ Passes the rest of the file as content to the \fBtemplate\fR-macro. .IP "\fB@html_from_markdown\fR" Passes the rest of the file as content to the \fBhtml_from_markdown\fR-macro. +.SS "\fBStrings\fR" +This macro processor is generally recursive, meaning all macros will process it's arguments normally before using them. +To make this easier to deal with, strings are differentiated between opening and closing. + +Opening is \fB%"\fR, closing is \fB"%\fR. + +.SS "\fBCode\fR" +You can run arbitrary (python) code in the files, which operates in the same environment as the macros. +This means you can from the python code call all builtin macros directly (you will need to manually provide the macro_processor reference). +It also means all definitions you make, are available outside as macro tokens. +Code blocks are opened with \fB%(\fR and closed with \fB)%\fR. + + + +.PP +.nf +.RS +%( +def A(): + return "test" +)% +A +%"A"% +.RE +.fi +.PP +Returns +.PP +.nf +.RS +test +A +.RE +.fi +.PP .SS "\fBBuiltin macro options\fR" There are some macros flags that can enable/disable features, -- cgit v1.2.3