Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Mustache |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 1.0.0 |
SHA1 sum: | e58b9aa11b254d5012d923c2eadccc3c0f3116bd |
Author: | Milan Unger <nilan.unger@siemens-healthineers.com> |
Home page: | https://github.com/milung/pl_mustache.git |
No reviews. Create the first review!.
Version | SHA1 | #Downloads | URL |
---|---|---|---|
1.0.0 | e58b9aa11b254d5012d923c2eadccc3c0f3116bd | 1 | https://github.com/milung/pl_mustache.git |
87bd48f20d640162ce0f907b0a850bd1aa83050a | 10 | https://github.com/milung/pl_mustache.git | |
304092745de9a9539117f93ac337cd12415908ea | 8 | https://github.com/milung/pl_mustache.git |
Prolog implementation and predicates for {{mustache}} templating system.
Supports all features of the mustache spec, with the following specifics:
?(Goal)
then the output is produced by the execution of the predicate once(call(Goal, Value, Result))
where result is consider as the actual value associated with the property.Some transformed {{?- my_goal. variable }}
In this case the output is produced by calling once(call(my_goal, Value, Result))
. The goal itself
is retrieved by the call to the read_term/2 therefore it must be ended by a dot.
Use module mustache
Example:
:- use_module(library(`mustache`)). hallo :- mustache_from_file('index.mustache', _{ name: 'World' }, Output }, writeOutput()
mustache(+Variables:list, +In:codes)
//` is det
Converts mustache template into the rendered text
by replacing {{ variable }}
placeholders with the variables
specified in the Variables list. Variables is either list of terms
Var - Value
or Var = Value
, or Variables and properties may be made of dicts.
The value can be atomic, codes, string, or list of values, or if used with extension then
any valid prolog term
mustache_from_file(+FileSpec, +Variables:list, -Out:codes)
is det
Same as mustache//2 but loads the template from the FileSpec.
FileSpec is resolved by absolute_file_name/3.
The script run-tests.ps1
executes the tests
To debug the module, load the debug.pl
file into prolog top.
Pack contains 8 files holding a total of 17.3K bytes.