Open pieterw2w opened 3 years ago
lang
attributes will flow from the template to the html, so you could add it there.
Since the transpiler is an instance of DOMDocument
, that means we can use php dom functions to manipulate the output. (and in 2023, that's quite a lot of functions) This means you could edit all the table attributes after transpilation.
<?php
use Pinky;
//set lang attributes to some elements
$transpiled = Pinky\transformString(<<<XML
<container>
<row>
<columns lang="en-GB">This is cool, isn't it?</columns>
<columns lang="en-CA">This is cool, eh?</columns>
</row>
</container>
XML);
//set role attribute for some tables
foreach($transpiled->getElementsByTagName('table') as $table){
$p->setAttribute('role','presentation');
}
echo $transpiled->saveHTML();
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.