Closed katazina closed 8 years ago
@katazina Can you help us validating this PR that fixes your issue?
unfortunately it's not working for me. I downloaded a patch file, after that I downloaded the whole paragraph-with-image branch, but no success.
Try with the attached post content. paragraph-image.txt
@katazina did you configure the new rule on your ruleset JSON? If so, can you share how your JSON looks like?
Sorry, it's night here. I refreshed the json file, but now I got an error when the feed is generated:
PHP Fatal error: Call to undefined method Facebook\InstantArticles\Elements\InstantArticle::appendText() in facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TextNodeRule.php on line 48
I'm trying to figure it out what happened.
I'm sorry, I had no time to check it. Now I did. It's half good, but still not perfect.
Here is a code which on the transformer fails:
<p><img class="alignleft size-medium wp-image-5545280" src="https://pixabay.com/static/uploads/photo/2015/10/01/20/15/landscape-967630_960_720.jpg" alt="something" width="320" height="213" />almafa fsdfsdff8</p>
<p>sfsdfsd</p>
<p>3333sdfsdfsd</p>
<ul>
<li>some text <a href="https://pixabay.com/static/uploads/photo/2015/10/01/20/15/landscape-967630_960_720.jpg"><img src="https://pixabay.com/static/uploads/photo/2015/10/01/20/15/landscape-967630_960_720.jpg" width="600" height="360" /></a></li>
</ul>
<p>sfdsfsdf</p>
<p>sfsdfsd</p>
<p>fssd</p>
And here is the current result:
<figure>
<img src="https://pixabay.com/static/uploads/photo/2015/10/01/20/15/landscape-967630_960_720.jpg"/>
</figure>
<p>almafa fsdfsdff8</p>
<p>sfsdfsd</p>
<p>3333sdfsdfsd</p>
<ul>
<li>some text <a href="https://pixabay.com/static/uploads/photo/2015/10/01/20/15/landscape-967630_960_720.jpg"></a></li>
</ul>
<p>sfdsfsdf</p>
<p>sfsdfsd</p>
<p>fssd</p>
You can see, beside the some text the image is not processed, but an empty a tag was kept.
With the p tag in the first line, it worked perfectly.
The content:
<p><a href="http://example.com/image.jpg"><img class="alignnone size-medium wp-image-45" src="http://example.com/image.jpg" alt="imagealt" width="300" height="169" /></a>Some text comes here and some more and more ... and some.</p>
After the closing
<a>
tag, there is some text, and the sdk drops that text.Same happens when I reorder the inside:
<p>Some text comes here and some more and more ... and some.<a href="http://example.com/image.jpg"><img class="alignnone size-medium wp-image-45" src="http://example.com/image.jpg" alt="imagealt" width="300" height="169" /></a></p>
Or if there is text before and after:
<p>Some text comes here and some more and more ... and some.<a href="http://example.com/image.jpg"><img class="alignnone size-medium wp-image-45" src="http://example.com/image.jpg" alt="imagealt" width="300" height="169" /></a>Some text comes here and some more and more ... and some.</p>
The below expexted result is just for the first content example.
Expected Result
Actual Result