aboutsummaryrefslogtreecommitdiff
path: root/smp.1
diff options
context:
space:
mode:
Diffstat (limited to 'smp.1')
-rw-r--r--smp.1105
1 files changed, 105 insertions, 0 deletions
diff --git a/smp.1 b/smp.1
new file mode 100644
index 0000000..1b616e4
--- /dev/null
+++ b/smp.1
@@ -0,0 +1,105 @@
+.TH SMP 1 2024-06-08
+.SH name
+Skaldpress Macro Processor \- Macro processor
+.SH SYNOPSIS
+.B smp [\fIinput_file\fB]
+
+.SH DESCRIPTION
+.B smp
+smp is a macro processor, made specifically for a usecase when doing templating of websites.
+
+
+.SS Macros
+.IP "\fBinclude(<file>)\fR"
+Includes a file in-place, performing macro-expansion on it.
+NOTE, THERE IS NO LOOP PROTECTION HERE!
+
+.IP "\fBinclude_varbatim(<file>)\fR"
+Same as \fBinclude\fR, but does not expand macros.
+
+.IP "\fBdefine(<macro_name> [, <macro content>])\fR"
+This defines a macro, optionally with some content.
+The optional content will be expanded immediately,
+and later the already processed content will be included in the output.
+
+.IP "\fBifdef(<macro_name>, <output if defined> [, <output if not defined>])\fR"
+
+.IP "\fBifndef(<macro_name>, <output if not defined> [, <output if defined>])\fR"
+
+.IP "\fBifeq(<arg1>, <arg2>, <output if equal> [, <output if not equal>])\fR"
+
+.IP "\fBifneq(<arg1>, <arg2>, <output if not equal> [, <output if equal>])\fR"
+
+.IP "\fBshell(<command>)\fR"
+Runs command on shell, and includes the command output in the output
+
+.IP "\fBexpr(<arg1>, <arg2>, ..., <argN>)\fR"
+Shorthand for running the expr command, expands all arguments, and executes it on the shell.
+
+.IP "\fBdefine_array(<macro_name>)\fR"
+Defines a macro as a array, this can later be used with macros like \fBarray_push\fR and \fBarray_each\fR.
+
+.IP "\fBarray_push(<macro_name>, <value>[, <additional value(s)>])\fR"
+On a macro that is defined as a array, this will add one or more elements.
+
+.IP "\fBarray_each(<macro_name>, <template macro>])\fR"
+Push any arguments to array macro
+Process each element in a array as a macro-invokation on the second argument
+Not the best way to do this, it is not sensibly recursive.
+
+.IP "\fBarray_size(<macro_name>)\fR"
+Will return number of elements in a macro array.
+
+.IP "\fBexplode(<array_name>, <delimiter>, <input>)\fR"
+Explode a input into individual array elements.
+
+.IP "\fBformat_time(<format>, <time>)\fR"
+Format a RFC3339-timestamp to the specified format. Format is similar to strftime.
+Only available if the \fBtime\fR-feature was enabled during compilation.
+
+.IP "\fBhtml_from_markdown(<markdown>)\fR"
+If compiled with \fBmarkdown\fR, this macro will convert it's argument from markdown to html.
+It will process it's input twice before actually doing the conversion. This is to remove the outer quotes of a argument.
+So you should probably always quote arguments to this.
+
+.IP "\fBwodl(<url>)\fR"
+If compiled with \fBdeadlinks\fR, this macro will always return it's argument.
+But it will also perform a request to the link, and emit a warning if it it doesn't return HTTP 200 OK.
+This will significantly slow down compile times!
+
+.SS "\fBCompile-Time Feature Flags\fR"
+There are some compile-time flags that can enable/disable features, most are enabled by default,
+and exist either because they trigger a external dependency, or because they are unlikely to work without glibc.
+
+.IP "\fBreadline\fR" 2
+\fBEnabled by default\fR.
+Enables the use of libc readline in REPL mode. If not enabled, normal stdio will be used for input.
+
+Requires readline to be installed on the system.
+
+.IP "\fBtime\fR" 2
+\fBEnabled by default\fR.
+Enables the \fIformat_time\fR-macro, this will compile the chrono dependency to format time.
+
+.IP "\fBmarkdown\fR" 2
+\fBEnabled by default\fR.
+Enabled the \fIhtml_from_markdown\fR-macro, this will compile the markdown dependency. And can convert markdown into html.
+
+.IP "\fBdeadlinks\fR" 2
+\fBEnabled by default\fR.
+Enabled the \fIwodl\fR-macro, this will compile the minreq dependency.
+Allows testing the return code of links, and warns when the request is unsuccessful.
+
+.IP "\fBguile\fR" 2
+If compiled with guile, the macro processor supports running guile-code inline.
+This is enabled with \fI%()%\fR in the input, and anything inside the parantheses will be evaluated as guile.
+
+Requires libguile-3.0 to be installed on the system.
+
+\fBExperimental feature!\fR
+.SH OPTIONS
+If a input file is provided, that will be processed.
+If not, a sort of interactive REPL will be started instead.
+
+.SH SEE ALSO
+skaldpress(1)