knpwrs / gulp-cheerio

Manipulate HTML and XML files with Cheerio in Gulp.
MIT License
98 stars 13 forks source link

Allow parser options as param #2

Closed dsmoosh0 closed 10 years ago

dsmoosh0 commented 10 years ago

Unfortunately I couldn't test this one. But I need the parser options very badly. Especially for parsing camel case tags and self closing tags.

Check for run function and options could be done better. But it's just quick and dirty.

knpwrs commented 10 years ago

Thanks for your contribution! I've added a unit test and as soon as Travis passes one more time I'll push to NPM.

dsmoosh0 commented 10 years ago

Nice! Thanks for compacting the code! ;)

dsmoosh0 commented 10 years ago

Hmm seems that parser options are being ignored completely. Anyone else experiencing this problem?

knpwrs commented 10 years ago

Can you provide a (non)working example? I've never had a need for parsing options, so testing is kind of strange for me.

dsmoosh0 commented 10 years ago

Yeah sure. A very simple example would be this:

<html>
<body>
<p></p>
<br/>
<p></p>
</body>
</html>

Now for example try to set text on the <p> tag via cheerio. The output HTML doesn't contain self closing <br/> tags.

They just look like this: <br>
But what I do need here is this: <br/>

Passing recognizeSelfClosing: true to parser options should normally fix this problem. Can you reproduce this?

knpwrs commented 10 years ago

I'll have to take a look at this later today. I'll get back to you.

dsmoosh0 commented 10 years ago

Ok thank you! :)

dsmoosh0 commented 10 years ago

Found anything?

knpwrs commented 10 years ago

Sorry, I've been really busy. It's on my todo list though.

image

Overdue, as you can see...

dsmoosh0 commented 10 years ago

Ye no problem.