How to use the nunjucks.installJinjaCompat function in nunjucks

To help you get started, we’ve selected a few nunjucks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deathbeds / lintotype / src / ts / jupyter-widjucks / widget.ts View on Github external
// Copyright (c) dead pixels collective
// Distributed under the terms of the Modified BSD License.

import {
  DOMWidgetModel, DOMWidgetView, ISerializers
} from '@jupyter-widgets/base';

import { defaultSanitizer } from '@jupyterlab/apputils';

import * as renderers from '@jupyterlab/rendermime';

import * as nunjucks from 'nunjucks';

import * as marked from 'marked';

nunjucks.installJinjaCompat();

import {
  MODULE_NAME, MODULE_VERSION
} from './version';


export
class WidjuckModel extends DOMWidgetModel {
  private env = new nunjucks.Environment();

  defaults() {
    return {...super.defaults(),
      _model_name: WidjuckModel.model_name,
      _model_module: WidjuckModel.model_module,
      _model_module_version: WidjuckModel.model_module_version,
      _view_name: WidjuckModel.view_name,
github opentok / json2code / json2code.js View on Github external
'use strict';

const fs = require('fs');
const mkdirp = require('mkdirp');
const nunjucks = require('nunjucks');
const path = require('path');

nunjucks.installJinjaCompat();
const env = nunjucks.configure(path.join(__dirname, 'platforms'), {
  trimBlocks: true,
  lstripBlocks: true,
});

const [schemaPath, prefix, pkg] = process.argv.slice(2);

const schema = JSON.parse(fs.readFileSync(path.resolve(schemaPath)));

function classize(value) {
  return value.substr(0, 1).toUpperCase() + value.substr(1);
}

env.addFilter('classize', classize);

function instantize(value) {