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

Commit

Permalink
Merge pull request #814 from Automattic/feature/twitter-rule
Browse files Browse the repository at this point in the history
Add default rule for Twitter blockquote
  • Loading branch information
timjacobi authored Nov 13, 2017
2 parents 7ecf630 + d966e2c commit cf6788b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
17 changes: 17 additions & 0 deletions rules-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@
]
}
}
}, {
"class": "InteractiveRule",
"selector" : "blockquote.twitter-tweet",
"properties" : {
"interactive.iframe" : {
"type" : "multiple",
"children": [
{
"type": "element",
"selector": "blockquote"
}, {
"type": "next-sibling-element-of",
"selector": "blockquote"
}
]
}
}
}, {
"class": "IgnoreRule",
"selector" : "script"
Expand Down
9 changes: 9 additions & 0 deletions tests/Facebook/InstantArticles/Transformer/wp-ia.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@
<script async="" defer="defer" src="//platform.instagram.com/en_US/embeds.js"></script>
</iframe>
</figure>
<figure class="op-interactive">
<iframe class="no-margin">
<blockquote class="twitter-tweet" data-lang="en">
<p lang="en" dir="ltr">In an effort to establish stronger ties with the news industry, we're launching The Facebook Journalism Project: <a href="https://t.co/pSxENUU9aa">https://t.co/pSxENUU9aa</a></p>
— Facebook (@facebook) <a href="https://twitter.com/facebook/status/819685391355748354?ref_src=twsrc%5Etfw">January 12, 2017</a>
</blockquote>
<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</iframe>
</figure>
<figure>
<img src="http://example.com/img.jpg"/>
<figcaption>blue eyes</figcaption>
Expand Down
17 changes: 17 additions & 0 deletions tests/Facebook/InstantArticles/Transformer/wp-rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,23 @@
]
}
}
}, {
"class": "InteractiveRule",
"selector" : "blockquote.twitter-tweet",
"properties" : {
"interactive.iframe" : {
"type" : "multiple",
"children": [
{
"type": "element",
"selector": "blockquote"
}, {
"type": "next-sibling-element-of",
"selector": "blockquote"
}
]
}
}
}, {
"class": "InteractiveRule",
"selector" : "iframe",
Expand Down
5 changes: 5 additions & 0 deletions tests/Facebook/InstantArticles/Transformer/wp.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ <h1>some embed here</h1>
</div>
</blockquote>
<script async defer src="//platform.instagram.com/en_US/embeds.js"></script>
<blockquote class="twitter-tweet" data-lang="en">
<p lang="en" dir="ltr">In an effort to establish stronger ties with the news industry, we&#39;re launching The Facebook Journalism Project: <a href="https://t.co/pSxENUU9aa">https://t.co/pSxENUU9aa</a></p>
&mdash; Facebook (@facebook) <a href="https://twitter.com/facebook/status/819685391355748354?ref_src=twsrc%5Etfw">January 12, 2017</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>
<figure style="width: 1280px" class="wp-caption alignnone">
<img src="http://example.com/img.jpg" width="1280" height="740" class />
Expand Down

0 comments on commit cf6788b

Please sign in to comment.