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 cheerio options #25

Closed
dherges opened this issue Apr 4, 2016 · 7 comments
Closed

Support for cheerio options #25

dherges opened this issue Apr 4, 2016 · 7 comments

Comments

@dherges
Copy link

dherges commented Apr 4, 2016

Right now, releaseTheKraken() replaces " with " (and other entties as well).

Issue 1: componentFactory should use elem.html() instead of $.html(elem)

Issue 2: it should be possible to pass cherio options to the inky() function --> already done on master

dherges added a commit to dherges/inky that referenced this issue Apr 4, 2016
Use element.html() instead of $.html(element), see foundation#25
dherges added a commit to dherges/inky that referenced this issue Apr 4, 2016
Use element.html() instead of $.html(element) ... see issue foundation#25
@ibarral
Copy link

ibarral commented Apr 4, 2016

Hello,

Do you have an example to pass cherio options to the inky() function? I can't make it work.

Thanks!

@dherges
Copy link
Author

dherges commented Apr 5, 2016

Yes, use it like this with gulp/vinyl (inky from the master branch):

vfs.src('somefile.html')
  .pipe(inky({cheerio: {decodeEntities: false}}))
  .pipe(vfs.dest('output'))

somefile.html:

"mytext"

output:

"mytext"

So, the options are actually passed to cheerio.load(input, opts), but entities (") go missing in the final output (after releaseTheKraken().html() ... guess that happens in componentFactory.js

@dherges
Copy link
Author

dherges commented Apr 7, 2016

I was able to drill down the issue

this input results in decoded entities for the text "broken" .. output &quot;broken&quot;" despite passing {decodeEntities: false}. "works" is outputted as "works" (since its outside the <center> tag ?).

<table class="body">
  <tr>
    <td class="center" align="center" valign="top">
      <center>
"broken"
      </center>
"works"
    </td>
  </tr>
</table>

putting an attribute data-parsed on the <center> tag works for both texts. inside and outside the center tag, output is "works"

<table class="body">
  <tr>
    <td class="center" align="center" valign="top">
      <center data-parsed>
"works"
      </center>
"works"
    </td>
  </tr>
</table>

@ibarral
Copy link

ibarral commented Apr 7, 2016

Thanks for the update!

But I have a doub't: I have installed Inky using NPM (https://www.npmjs.com/package/inky).

I'm using Gulp to compile the files, and if I pass the cheerio options to Inky, for example:

.pipe(inky({cheerio: {decodeEntities: false}}))

It won't work.

This feature works ok from the NPM version?

Thanks!

@dherges
Copy link
Author

dherges commented Apr 7, 2016

No, the feature was introduced here 9fda83e#diff-168726dbe96b3ce427e7fedce31bb0bc and is included in the master branch ...

try npm install github:zurb/inky#master to get it

@ibarral
Copy link

ibarral commented Apr 7, 2016

Ok, thanks for your help! :)

@rafibomb
Copy link
Member

@dherges @ibarral Just published the Foundation for Emails 2.1 release blog post and the release went out this morning! We also started a discussion on the future of Inky and what amazing integrations can be made. I'm sure you have some comments, questions, or ideas: http://foundation.zurb.com/forum/posts/39717-architecting-the-future-of-foundation-for-emails

@rafibomb rafibomb closed this as completed Jun 8, 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

3 participants