Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Handles <img> tag inside <p> and other tags #124

Merged
merged 8 commits into from
Jun 15, 2016

Conversation

everton-rosario
Copy link
Contributor

This PR

  • Created new Rule ImageRuleParagraph
  • Changed Transformer to comply with access to initial context
  • Added test cases to comply with this new feature

Fixes #91 and #92

@ghost ghost added the CLA Signed label Jun 10, 2016
use Facebook\InstantArticles\Elements\InstantArticle;
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;

class ImageRuleParagraph extends ConfigurationSelectorRule
Copy link
Contributor

@diegoquinteiro diegoquinteiro Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the naming standard is that all rule classes ends with Rule. What about ImageInsideTextContainerRule?

@everton-rosario everton-rosario self-assigned this Jun 10, 2016
$instant_article = $transformer->getInstantArticle();
if ($instant_article) {
$instant_article->addChild($image);
//$context->enableIgnoreEmpty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎅

@@ -86,4 +88,30 @@ protected function emptyElement($document)
$fragment->appendChild($document->createTextNode(''));
return $fragment;
}

/**
* Method that returns the status of ignoring empty for this Element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment what this actually do: "Suppress the empty tag warning on validation".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants