Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for rawInclude and upgrade to pug-walk 0.0.3 #2

Open
kavaro opened this issue Dec 4, 2015 · 0 comments
Open

support for rawInclude and upgrade to pug-walk 0.0.3 #2

kavaro opened this issue Dec 4, 2015 · 0 comments

Comments

@kavaro
Copy link

kavaro commented Dec 4, 2015

An error is thrown when the ast contains a rawInclude.
Upgrading to pug-walk 0.0.3 and adding the following visit function seems to fix the issue:

visitRawInclude: function(include) {
    this.bufLine('include');
    if (include.filter) {
      this.buffer(':' + include.filter + this.attrs(include.attrs));
    }
    this.buffer(' ');
    this.visit(include.file);
  }

Seems the above does not generate filter(s). I tried the following and it covers my use-case, though not sure whether this is ok in general. There seems to be an outdated ast format issue.

visitInclude: function(include) {
    this.bufLine('include');
    if (include.filters) {
      include.filters.forEach(function(filter) {
        if (filter.type === 'IncludeFilter') this.buffer(':' + filter.name);
      }, this);
      if (include.attrs) this.buffer(this.attrs(include.attrs));
    }
    this.buffer(' ');
    this.visit(include.file);
    this.visit(include.block);
  },

  visitRawInclude: function(include) {
    this.bufLine('include');
    if (include.filters) {
      include.filters.forEach(function(filter) {
        if (filter.type === 'IncludeFilter') this.buffer(':' + filter.name);
      }, this);
      if (include.attrs) this.buffer(this.attrs(include.attrs));
    }
    this.buffer(' ');
    this.visit(include.file);
  },
@ForbesLindesay ForbesLindesay changed the title support for rawInclude and upgrade to jade-walk 0.0.3 support for rawInclude and upgrade to pug-walk 0.0.3 Apr 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant