aboutsummaryrefslogtreecommitdiff
SMP(1)                                                                                                    General Commands Manual                                                                                                   SMP(1)

name
       Skaldpress Macro Processor - Macro processor

SYNOPSIS
       smp [input_file]

DESCRIPTION
       smp smp is a macro processor, made specifically for a usecase when doing templating of websites.

   Macros
       include(<file>)
              Includes a file in-place, performing macro-expansion on it.  NOTE, THERE IS NO LOOP PROTECTION HERE!

       include_varbatim(<file>)
              Same as include, but does not expand macros.

       define(<macro_name> [, <macro content>])
              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.

       ifdef(<macro_name>, <output if defined> [, <output if not defined>])

       ifndef(<macro_name>, <output if not defined> [, <output if defined>])

       ifeq(<arg1>, <arg2>, <output if equal> [, <output if not equal>])

       ifneq(<arg1>, <arg2>, <output if not equal> [, <output if equal>])

       shell(<command>)
              Runs command on shell, and includes the command output in the output

       expr(<arg1>, <arg2>, ..., <argN>)
              Shorthand for running the expr command, expands all arguments, and executes it on the shell.

       define_array(<macro_name>)
              Defines a macro as a array, this can later be used with macros like array_push and array_each.

       array_push(<macro_name>, <value>[, <additional value(s)>])
              On a macro that is defined as a array, this will add one or more elements.

       array_each(<macro_name>, <template macro>])
              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.

       array_size(<macro_name>)
              Will return number of elements in a macro array.

       explode(<array_name>, <delimiter>, <input>)
              Explode a input into individual array elements.

       format_time(<format>, <time>)
              Format a RFC3339-timestamp to the specified format. Format is similar to strftime.  Only available if the time-feature was enabled during compilation.

       html_from_markdown(<markdown>)
              If  compiled  with  markdown, 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.

       wodl(<url>)
              If compiled with deadlinks, 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!

   Compile-Time Feature Flags
       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.

       readline
         Enabled by default.  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.

       time
         Enabled by default.  Enables the format_time-macro, this will compile the chrono dependency to format time.

       markdown
         Enabled by default.  Enabled the html_from_markdown-macro, this will compile the markdown dependency. And can convert markdown into html.

       deadlinks
         Enabled by default.  Enabled the wodl-macro, this will compile the minreq dependency.  Allows testing the return code of links, and warns when the request is unsuccessful.

       guile
         If compiled with guile, the macro processor supports running guile-code inline.  This is enabled with %()% in the input, and anything inside the parantheses will be evaluated as guile.

         Requires libguile-3.0 to be installed on the system.

         Experimental feature!

OPTIONS
       If a input file is provided, that will be processed.  If not, a sort of interactive REPL will be started instead.

SEE ALSO
       skaldpress(1)

                                                                                                                2024-06-08                                                                                                          SMP(1)