posthtml / posthtml-parser

Parse HTML/XML to PostHTMLTree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subsequent Runs Use Previous Options if Empty

trisys3 opened this issue · comments

✏️ Briefly describe the issue you are experiencing (or the feature you want to see added to the plugin). Tell us what you were trying to do and what happened instead. Remember, this is not a place to ask questions. For that, go to http://gitter.im/posthtml/posthtml

Details

✏️ Describe in more detail the problem you have been experiencing, if necessary.

When I run process multiple times, the options seem to be "merged". For any empty options, the previous version seems to be used. I would expect all runs to be completely independent.

Error (Logs|Stacks)

👉 Create a gist which is a paste of your full logs, and link them here.

⚠️ Do not paste your full logs here (or at least hide them by using a <details></details> block), as it will make this issue long and hard to read! If you are reporting a bug, always include logs!

Reproduction (Code)

⚠️ Please remember that, with sample code; it's easier to reproduce a bug and much faster to fix it.

🔗 Please refer to a simple code example.

$ git clone https://github.com/<user>/<sample>
const posthtml = require('posthtml');

const text = '<?php echo $myVar; ?>';

let {html} = posthtml().process(text, {sync: true});
console.log(html); // ''

({html} = posthtml().process(text, {
    sync: true,
    directives: [{name: '<?php', start: '<', end: '>'}],
}));
console.log(html); // '<?php echo $myVar; ?>'

({html} = posthtml().process(text, {sync: true}));
console.log(html); // '<?php echo $myVar; ?>'

Environment

ℹ️ Please provide information about your current environment.

OS node npm/yarn package
CentOS 7 13.14.0 npm 6.14.7 posthtml 0.13.2