lorenzo / pinky Goto Github PK
View Code? Open in Web Editor NEWA Foundation for Emails (Inky) template transpiler
License: MIT License
A Foundation for Emails (Inky) template transpiler
License: MIT License
The library currently has tests, but no CI setup.
It would be great to configure a CI, which would enforce tests to run on contributions, and could run tests on all supported PHP versions.
When I use following cake layout:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<?php echo $this->Html->css('Psa/Newsletters.newsletter.css'); ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<title><?php echo $newsletter['subject']; ?></title>
</head>
<body>
<table class="body">
<tr>
<td class="center" align="center" valign="top">
<center>
<container>
<?php
echo $this->fetch('content');
?>
</container>
</center>
</td>
</tr>
</table>
<!-- prevent Gmail on iOS font size manipulation -->
<div style="display:none; white-space:nowrap; font:15px courier; line-height:0;"> </div>
</body>
</html>
Then the container inky tag is not parsed correctly.
The Container tag gets only some styles but is not parsed as a table.
Why did I use a center tag as surrounding tag?
The boilerplate from foundation-email has one: https://foundation.zurb.com/emails/docs/sass-guide.html#boilerplate
;)
I am not sure if this is a bug or just nonsense to have a center tag surrounding the container and rows of inky.
We pass the whole markup directly to Pinky\transformString($html);
What seems not to work:
<?php
use Pinky;
$transpiled = Pinky\transformString('<center><container><row>Contents</row></container></center>');
echo $transpiled->saveHTML();
I,
In our application, we have a strange bug. Sometimes, the belowed error appears:
Warning: DOMDocument::load(): I/O warning : failed to load external entity "/path/to/vendor/lorenzo/pinky/src/inky.xsl"
Our application is a Symfony one, which use the Mailer component and the twig/inky-extra
which use this library.
We send many email without any problem, but sometimes this happens and we are not able to understand why.
What's even stranger is that for the same email template, but with a different context (input data, code used to before calling the service which send it) sometimes it it works and sometimes the error occure... ๐
I thought that it was linked to the data we used, but the offending code is the loading of inky.xsl
and inky-center.xsl
, so it comes before our template is processed.
The only way we found to fix this was to add this code before the call of Inky:
if (\PHP_VERSION_ID < 80000) {
libxml_disable_entity_loader(false);
}
Have you any idea of what's happening? There is not many literature about this on the internet. ๐
After update to version 1.0.8 stopped wort cyrillic support, On version 1.0.7 work fine.
Hi
I notice you require PHP >= 5.6.0. Is there a strong reason to do so ?
We're looking at using your library for gremo/ZurbInkBundle#3 and keeping the low requirements would be a good thing for us.
I have not seen anything in https://secure.php.net/manual/en/migration54.incompatible.php (and the subsequent changes) that would break your library, but I may be missing something.
Thanks a lot
We use this project quite extensively and it looks like development has picked up again on Inky: https://github.com/foundation/inky/releases
Just wondering how you track changes to Inky and determine if/when updates need to be made here?
Is the responsibility in this library or Inky for escaping certain characters that we do now want HTML endcoed?
Specifically a URL with a query-string inside the Inky template will have ampersands converted to &
- this causes a conflict with another built-in feature for the front-end I'm using where the semi-colon is double-encoded. But I don't think the URL should have the ampersands encoded in the first place.
Any thoughts on this or have I missed some docs on it? TIA.
otherwise you get the notice:
Notice: Use of undefined constant XSL_SECPREF_READ_FILE - assumed 'XSL_SECPREF_READ_FILE'
which took me a while to figure out why it was not working :)
What is the best solution to add your own modifications?
For example we use litmus to test if e-mails look correct in all applications. It also does a few checks if the mail contains good metadata. Two issues were given by litmus that requires me to modify the html that was generated from this library.
How do I add a lang attribute on if pinky adds/modifies this?
How do I add role=presentation to the tables pinky adds?
If I read the code all it does is executing 2 xsd files.
Without finding a fix or further investigating the issue, it seems that center doesn't work as it should. here is my layout:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width"/>
</head>
<body>
<table class="body">
<tr>
<td class="center" align="center" valign="top">
<center>
<div>
<container class="body-drip">
<spacer size="16"></spacer>
<div>
<!-- this doesn't work -->
<center>
<img src="path to image"/>
</center>
</div>
</container>
</div>
</center>
</td>
</tr>
</table>
<!-- prevent Gmail on iOS font size manipulation -->
<div style="display:none; white-space:nowrap; font:15px courier; line-height:0;"> </div>
</body>
</html>
this does work:
<div class="center" align="center">
<img src="path to image"/>
</div>
If I use the container
in a center
element, the container
will be not rendered as a table
. In src/inky.xsl in line 104 my container will be matched and a class float-center is added to the element. It will be not changed to a table
element.
The expected behaviour for me were an table with the added class="float-center". It seems that the matching from line 11 ist not working. I don't know why is it so ( I'm not familiar with this xsl stuff).
To fix this problem for the moment I changed the code in line 104 in this way:
<xsl:template match="center/*[position() = 1 and not(contains(@class, 'float-center')) and not('container')]">
This solves the problem for me but I believe that's not the right way. Nevertheless I want to understand why the first matching, to change the container (line 11), is not working.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.