How to use the multiline.stripIndent function in multiline

To help you get started, we’ve selected a few multiline 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 Crossbow-js / crossbow-sites / test / specs / helpers / inc.paths.js View on Github external
it("Can do simple includes with CWD", function(done) {

        var index = multiline.stripIndent(function(){/*

         Button: {{ inc src="button.html" }}

         */});

        var page = crossbow.addPage("index.html", index, {});

        var config = {
            siteConfig:{},
            cwd: "test/fixtures"
        };

        crossbow.compileOne(page, config, function (err, out) {
            if (err) {
                done(err);
            }
github Crossbow-js / crossbow-sites / test / specs / helpers / md.js View on Github external
it("can render md blocks with page content", function(done) {

        var layout = multiline.stripIndent(function(){/*
{{ content }}
         */});
        var index = multiline.stripIndent(function(){/*
---
layout: "default.hbs"
---
{{#md}}
#title
{{/md}}
##Not a title
         */});

        crossbow.populateCache("_layouts/default.hbs", layout);

        var page = crossbow.addPage("index.html", index, {});

        crossbow.compileOne(page, {siteConfig:{}}, function (err, out) {
            if (err) {
                done(err);
github Crossbow-js / crossbow-sites / test / specs / helpers / inc.params.js View on Github external
it("Can do simple includes with params", function(done) {

        var index = multiline.stripIndent(function(){/*

         Button: {{ inc src="button.html" text="Cancel" }}

         */});

        crossbow.populateCache("button.html", "<button>{{text}}</button>");

        var page = crossbow.addPage("index.html", index, {});

        crossbow.compileOne(page, {siteConfig:{}}, function (err, out) {
            assert.include(out.compiled, "<button>Cancel</button>");
            done();
        });
    });
    it("Can do simple includes with interpolated params in config", function(done) {
github Crossbow-js / crossbow-sites / test / specs / collections / collections.posts.js View on Github external
it("should loop through and render links to posts in categories", function(done) {

        var index = multiline.stripIndent(function(){/*
{{#each categories}}
<p>{{this.title}}</p>
<ul>
    {{#each this.items}}
    <li>{{this.title}} - {{this.url}}</li>
    {{/each}}
</ul>
{{/each}}
*/});

        var expected = multiline.stripIndent(function () {/*
<p>javascript</p>
<ul>
    <li>Blog 2 - /post2.html</li>
    <li>Blog 1 - /post1.html</li>
</ul>
github Crossbow-js / crossbow-sites / test / specs / helpers / content.js View on Github external
it("replaces {{content}} with page content", function(done) {

        var layout = multiline.stripIndent(function(){/*

{{content}}

         */});
        var index = multiline.stripIndent(function(){/*
---
layout: "default.hbs"
---
Some content
         */});

        crossbow.populateCache("_layouts/default.hbs", layout);

        var page = crossbow.addPage("index.html", index, {});

        crossbow.compileOne(page, {siteConfig:{}}, function (err, out) {
            if (err) {
                done(err);
            }
            assert.equal(out.compiled, "\nSome content\n");
            done();
github Crossbow-js / crossbow-sites / test / specs / layouts / nested.js View on Github external
it("Can render with no layout", function (done) {

        var post1 = multiline.stripIndent(function () {/*
         {{site.sitename}}
         */});

        var post = crossbow.addPost("_posts/post2.md", post1, {});

        crossbow.compileOne(post, {siteConfig: {sitename: "({shakyShane})"}}, function (err, out) {
            var compiled = out.compiled;
            assert.include(compiled, "({shakyShane})");
            done();
        });
    });
    it("Can render using a default layout in config", function (done) {
github Crossbow-js / crossbow-sites / test / specs / published / published.js View on Github external
it("Does not show any items with published:false in front matter", function() {
        var post = multiline.stripIndent(function(){/*
         ---
         layout: test
         title: "Homepage"
         published: false
         ---

         #{page.title}

         */});
        crossbow.addPost("_posts/post1.md", post);

        var actual = crossbow.getCache().posts().length;
        assert.equal(actual, 0);
    });
    it("Does not add any items starting with an underscore", function() {
github Crossbow-js / crossbow-sites / test / specs / items / post.dates.js View on Github external
var _             = require("lodash");
var assert        = require("chai").assert;
var multiline     = require("multiline");

var Post     = require("../../../lib/post");
var crossbow = require("../../../index");

var post1 = multiline.stripIndent(function(){/*
---
layout: post-test
---

{{post.date}}

 */});

describe("Creating a Post date from the filename", function(){

    beforeEach(function () {
        crossbow.clearCache();
        crossbow.populateCache("_layouts/post-test.html", "{{ content }}");
    });

    it("uses date from the filename if not available in front-matter", function() {
github Crossbow-js / crossbow-sites / test / specs / pagination / pagination.list.js View on Github external
it("Can use site variables", function(done) {

        var post1 = multiline.stripIndent(function(){/*
         ---
         layout: post-test
         title: "Post 1"
         date: 2013-11-13
         ---

         Post 1

         */});
        var post2 = multiline.stripIndent(function(){/*
         ---
         layout: post-test
         title: "Post 2"
         date: 2013-11-14
         ---
github ninetwozero / gradle-to-js / test / parser.js View on Github external
it('can parse a multiple &lt;&gt; combinations', function() {
      var dsl = multiline.stripIndent(function() {/*
             key "value"
             key2 "value2"
             */
      });
      var expected = {key: 'value', key2: 'value2'};

      return parser.parseText(dsl).then(function(parsedValue) {
        expect(parsedValue).to.deep.equal(expected);
      });
    });

multiline

Multiline strings in JavaScript

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis

Popular multiline functions