Introduction
Nift has its own poweful in-built template language
Contents
Syntax
The syntax for Nift function calls is as follows:
funcName{options}(params)
@funcName{options}(params)
You can use Nift's template language with the function name, options and parameters for a function call. For example:
@input("$[contentpath]")
You can even expand multiple options or parameters when parsing the options or parameters string with both
@string str = "param_1, param_2" @funcName($[str])
Note: you need to quote the function name when doing things like printing variables or calling functions in the function name. A contrived
@string str = "input" @"$[str]"("$[contentpath]")
Nift is pretty good at working out when it does or does not need to parse things like the function name, options and/or parameters. You can manually tell Nift to not parse the function name and parameters using the
@input("${!p}[contentpath]")
Note: For options and parameters (including variable names and values), you can use:
\n for the newline character\t for tabs (though normal tabs also work)\\ for\ \' for' \" for"
Function names, options and parameters (including variable names and values) can be unquoted, single quoted or double quoted, whichever is more convenient, integrates with the other programming, scripting and/or template languages you are using and/or has nice syntax highlighting with the extensions and editor(s) you are using. Also for functions that can take multiple parameters, parameters containing commas
Options
The following options are available for almost all function calls:
option | description |
---|---|
do not parse parameters | |
replace variables with their values (where applicable) | |
do not replace variables with their values (where applicable) | |
treat parameter string as one parameter | |
option | description |
The following options are available for user-defined function calls:
option | description |
---|---|
add member functions for |
|
do not add member functions for |
|
add output | |
do not add output | |
add scope | |
do not add scope | |
option | description |
Index
Below is an index of Nift's hard-coded functions (including functions for defining variables, functions and structures/types) which can be called from f++ and n++:
- $`expression` (evaluate ExprTk expression)
- $ (print variable)
- ! (not operator)
- !\n (special single-line comment)
- != (not equals operator)
- ? (ternary operator)
- && (and operator)
- || (or operator)
- \ (escape characters)
- := (define)
- = (assignment operator)
- == (equals to operator)
- < (less than operator)
- # (raw single-line comment)
- #-- (parsed multi-line comment)
- <#-- (raw multi-line comment)
- <= (less than or equals to operator)
- <-- (remove added trailing whitespace)
- > (greater than operator)
- >= (greater than or equals to operator)
- + (addition operator)
- ++ (pre-increment operator)
- +++ (post-increment operator)
- += (addition assignment operator)
- - (subtraction operator)
- -- (pre-decrement operator)
- --// (parsed single-line comment)
- --- (post-decrement operator)
- --> (skip whitespace)
- -= (subtraction assignment operator)
- * (multiplication operator)
- *= (multiplication assignment operator)
- / (division operator)
- /= (division assignment operator)
- /* (raw multi-line comment)
- // (raw single-line comment)
- % (mod operator)
- %= (mod assignment operator)
- add_member_fns
- add_scope
- break
- cd
- comments
- console
- console.lock
- console.locked
- console.unlock
- const
- content
- continue
- cpy
- cssinclude
- dep
- do-while
- ent
- error
- exit
- exprtk
- exprtk.add_package
- exprtk.add_variable
- exprtk.compile
- exprtk.eval
- exprtk.file
- exprtk.load
- exprtk.str
- f++
- faviconinclude
- fn
- for
- forget
- function
- getenv
- getline
- hash
- if
- imginclude
- in
- include
- inject
- input
- is_const
- is_private
- item
- join
- jsinclude
- layer
- link
- lolcat
- lolcat.cmd
- lolcat.off
- lolcat.on
- lolcat.status
- lst
- lua
- lua_addnsmfns
- lua_getglobal
- lua_gettop
- lua_pop
- lua_pushlightuserdata
- lua_pushnumber
- lua_pushstring
- lua_remove
- lua_setglobal
- lua_tonumber
- lua_tostring
- lua_version
- mve
- n++
- nsm_lang
- nsm_mode
- paginate
- paginate.no_items_per_page
- paginate.separator
- paginate.template
- parse
- pathto
- pathtofile
- pathtopage
- pathtopageno
- poke
- precision
- private
- prompt.char
- pwd
- quit
- quote
- read
- refresh_completions
- replace_all
- replace_vars
- return
- rmv
- scope
- script
- size
- std::vector.at
- std::vector.erase
- std::vector.pop_back
- std::vector.push_back
- std::vector.set
- std::vector.size
- stream.close
- stream.open
- struct
- substr
- sys
- system
- typeof
- unquote
- valid_type
- vjoin
- warning
- while
- write