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

directives not making it through to parser #41

Closed
curiouslychase opened this issue Mar 3, 2020 · 2 comments · Fixed by #42
Closed

directives not making it through to parser #41

curiouslychase opened this issue Mar 3, 2020 · 2 comments · Fixed by #42
Labels

Comments

@curiouslychase
Copy link

curiouslychase commented Mar 3, 2020

I have a directive in my call to posthtml:

posthtml([transformer]).process(
      fs.readFileSync(filename).toString(),
      {
        directives: [{ name: "njk", start: "{{%", end: "%}}" }]
      }
    )

I noticed that the directive doesn't make it through to the parser and found that last here is undefined so the loop returns early. Should the return be a continue? I don't understand the purpose of bufArray here, if it's necessary can someone help me understand what the right way to pass a directive through is?

posthtml-parser/index.js

Lines 49 to 57 in 009fe5a

if (isDirective(directive, name)) {
if (!last) {
results.push(directiveText);
return;
}
last.content || (last.content = []);
last.content.push(directiveText);
}

@Scrum
Copy link
Member

Scrum commented Mar 4, 2020

@chaseadamsio Hi, can you lay out or describe more criteria for reproducing this?

Scrum added a commit that referenced this issue Mar 4, 2020
@Scrum
Copy link
Member

Scrum commented Mar 4, 2020

i create test for you description #42

@Scrum Scrum linked a pull request Mar 4, 2020 that will close this issue
@Scrum Scrum added the question label Mar 4, 2020
@Scrum Scrum closed this as completed in #42 Mar 17, 2020
Scrum added a commit that referenced this issue Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants