How to use the setTag function from swig
Find comprehensive JavaScript swig.setTag code examples handpicked from public code repositorys.
GitHub: logie17/swig-i18n
70 71 72 73 74 75 76 77 78 79
translation = translation.replace(new RegExp(key, "g"),val); }); return translation; }); swig.setTag('i18n', function(str, line, parser, types) { var handlingTag = true, // When we start we're handling the TAG endIsSafe = true, // We can call end catch all handlingSubs = false, // We are handling substitutions if there is more found after TAG accumulatedJS = ''; // This is all of the accumulated javascript
4
4
0
3518 3519 3520 3521 3522 3523 3524 3525 3526 3527
* * For a more in-depth explanation of writing custom tags, see <a href="../extending/#tags">Custom Tags</a>. * * @example * var tacotag = require('./tacotag'); * swig.setTag('tacos', tacotag.parse, tacotag.compile, tacotag.ends, tacotag.blockLevel); * // => {% tacos %}Make this be tacos.{% endtacos %} * // => Tacos tacos tacos tacos. * * @param {string} name Tag name.
0
1
0
+ 3 other calls in file
GitHub: logie17/swig-cldr
66 67 68 69 70 71 72 73 74 75
var dateParsed = Date.parse(dateStr); var fmt = new cldr.DateTimeFormatter(); return fmt.format(new Date(dateParsed), {"type": "short"}); }); swig.setTag('currency', function(str, line, parser, types) { parser.on(types.NUMBER, parseToken); parser.on('*', function (token) { throw new Error('!!!Unexpected token: "' + token.match + '" on line ' + line + '.');
0
0
0
+ 2 other calls in file
swig.compileFile is the most popular function in swig (1638 examples)