File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Adapter to generate embed code from SassMeister.
5+ */
6+ namespace Embed \Adapters ;
7+
8+ use Embed \Request ;
9+
10+ class Sassmeister extends Webpage implements AdapterInterface
11+ {
12+ /**
13+ * {@inheritdoc}
14+ */
15+ public static function check (Request $ request )
16+ {
17+ return $ request ->isValid () && $ request ->match ([
18+ 'http://sassmeister.com/gist/* ' ,
19+ ]);
20+ }
21+
22+ /**
23+ * {@inheritdoc}
24+ */
25+ public function getCode ()
26+ {
27+ $ id = $ this ->request ->getDirectoryPosition (1 );
28+
29+ return "<p class= \"sassmeister \" data-gist-id= \"{$ id }\" data-height= \"480 \" data-theme= \"tomorrow \"> " .
30+ "<a href= \"http://sassmeister.com/gist/ {$ id }\">Play with this gist on SassMeister.</a> " .
31+ "</p> " .
32+ "<script src= \"http://cdn.sassmeister.com/js/embed.js \" async></script> " ;
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ class SassmeisterTest extends TestCaseBase
4+ {
5+ public function testGist ()
6+ {
7+ $ this ->assertEmbed (
8+ 'http://sassmeister.com/gist/1122e441f0434ec6eb2a ' ,
9+ [
10+ 'title ' => 'SassMeister | The Sass Playground! ' ,
11+ 'imageWidth ' => 240 ,
12+ 'imageHeight ' => 240 ,
13+ 'type ' => 'rich ' ,
14+ 'providerName ' => 'sassmeister ' ,
15+ ]
16+ );
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments