summaryrefslogblamecommitdiff
path: root/smp.1
blob: 888cced921ce6d3775df8611fbf3005b6839b7af (plain) (tree)
1
2
3

                    
                                             












                                                                                            
                                    




















                                                                                            













                                                                                                          



                                                                                  




                                                                                                                        





                                                           
.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.


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 "\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.

.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)