Version 2.0

News

  • Nift is now available through Homebrew for OSX, there are installation instructions here
  • If you have Nift installed through Snapcraft please check that you don't have it installed as nsm or installed as nift without classic confinement. Run snap list to see which snaps you have installed, if nsm is installed then run snap remove nift; snap install nift --classic and if you have nift installed but it does not say classic underneath it then run snap remove nift; snap install nift --classic
  • If you have Nift installed through Chocolatey please check that you have it installed as nift and not as nsm. Run choco list --local-only to see which programs are installed, if nsm is installed then run choco uninstall nsm; choco install nift

Changes with v2.0

In preparation for some upcoming features and to improve the syntax for Nift's template language in the long-term I have made a number of changes to Nift's template language, consequently I have updated the version numbering from 1.* to 2.*. There will be minimal/no changes to the syntax for Nift's template language (which is going to get much more powerful and be more like a programming language in the next month or two) moving forward, I sincerely apologise for any inconvenience. You can see the release notes for Nift on GitHub here.

The main changes that people should be aware of are:

  • @inputcontent has changed to @content()
  • @rawcontent has been replaced with @content{raw}()
  • @pagetitle has changed to @[title] or @<title>
  • Special parsed multi-line comments (ie. @--- comment @---) now work the same as parsed multi-line comments (ie. @/* comment @*/) and have been renamed as such. The behaviour for all multi-line comments (including raw, ie. <@-- comment --@>) has changed/improved to printing the first non-whitespace text (ie. first character that isn't a space, tab or newline) following the closing comment tag where the open comment tag started
  • function calls have changed to the syntax @function-name{options}(parameters)
  • printing/referencing variables now has the syntax @[varname] or @<varname>, rather than @[varname] or @{varname}
  • you can now separate options and parameters across multiple lines, also even function names if you quote them (single or double), you can even separate definitions across multiple lines though each of variable names, types and values must be on one line
  • by default function names, options and parameters are now all parsed with Nift's template language, to prevent this (especially for extremely large projects) then use the !p option (this replaces what was done in versions 1.* where * was placed after the function name before the parameters to parse parameters with Nift's template language)
  • similarly to the last point, you no longer use ^ to not backup scripts but rather the !bs option, ie. @script{!bs}(script-path)
  • @input(file-path) now has the if-exists option to only input text if the file exists, if the file does not exist the first non-whitespace text following the @input{if-exists}(file-path) call is placed in the output file where the start of the function call is, this has made it possible to simply remove functions like @inputhead
  • @inputraw(file-path) has been replaced with the raw option with @input(file-path), ie. @input{raw}(file-path)
  • @userin(msg) has changed to @in(msg) and @userfilein(msg) has changed to @in{from-file}(msg)
  • @pathto can now take either a tracked name for a path to the output file or an absolute path from the project root directory to an existing file, you can even use the name/file options to be explicit about which you intend (which is marginally faster in the file case)
  • @script(path) and @system(system-call) now have the options inject/raw/content which have replaced functions like @systemoutput(system-call), @scriptraw(path) and @systemcontent(system-call)
  • @script(path) should now have parameters added as @script(path, param 1, ..., param n), see the docs for more information
  • @script(path) now also has the if-exists option which is very similar to how the same option works for @input(path) as explained above

In the coming 1-2 months the following powerful features will be added to Nift's template language to make it more of a template programming language:

  • lots more variable types with lots of hard-coded functions to work with them, including pointers, constants, maybe privates, arrays, vectors, queues, stacks, lists, other data structures, mutexes, threads, etc.)
  • if/else if/else statements
  • for/foreach/while loops
  • user-defined variable types
  • user-defined functions
  • lots of hard-coded functions which you would expect from any template/programming language

While you can already get many of these things with other template languages that can be used with Nift, the functionality with Nift should be really fast, have nice syntax, and be more powerful than a lot of other options (especially the user-defined variable types and user-defined functions).