Skip to content

Commit 455f3f0

Browse files
authored
Merge pull request #7 from dennisinteractive/dennis-master
Dennis master
2 parents f1a5430 + 1d003ea commit 455f3f0

File tree

4 files changed

+127
-5
lines changed

4 files changed

+127
-5
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "lullabot/amp",
2+
"name": "dennisdigital/amp-library",
33
"description": "A set of useful classes and utilities to convert html to AMP html (See https://www.ampproject.org/)",
44
"authors": [
55
{
@@ -15,7 +15,7 @@
1515
"querypath/QueryPath": ">=3.0.4",
1616
"sebastian/diff": "^1.2 || ^2 || ^3",
1717
"marc1706/fast-image-size": "1.*",
18-
"masterminds/html5": "^2.2.0",
18+
"masterminds/html5": "~2.3.0",
1919
"sabberworm/php-css-parser": "^8.0.0",
2020
"guzzlehttp/guzzle": "~6.1"
2121
},

src/Pass/StandardFixPass.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public function pass()
6363
$this->addComponentJsToHead('amp-ad');
6464
}
6565

66+
$all_amp_sticky_ad = $this->q->top()->find('amp-sticky-ad');
67+
if ($all_amp_sticky_ad->length > 0) {
68+
$this->addComponentJsToHead('amp-sticky-ad');
69+
}
70+
6671
/** @var SValidationError $error */
6772
foreach ($this->validation_result->errors as $error) {
6873
// If the error was resolved, continue

src/Spec/validator-generated.php

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,9 @@ public static function createValidationRules() {
919919
$o_148->allow_relative = true;
920920
$o_147->value_url = $o_148;
921921
$o_146->attrs[] = $o_147;
922+
$o_148a = new AttrSpec();
923+
$o_148a->name = 'href';
924+
$o_146->attrs[] = $o_148a;
922925
$o_149 = new AttrSpec();
923926
$o_149->name = 'hreflang';
924927
$o_146->attrs[] = $o_149;
@@ -2365,6 +2368,9 @@ public static function createValidationRules() {
23652368
$o_567 = new AttrSpec();
23662369
$o_567->name = 'json';
23672370
$o_565->attrs[] = $o_567;
2371+
$o_567a = new AttrSpec();
2372+
$o_567a->name = 'rtc-config';
2373+
$o_565->attrs[] = $o_567a;
23682374
$o_568 = new AttrSpec();
23692375
$o_568->name = 'src';
23702376
$o_569 = new UrlSpec();
@@ -3714,6 +3720,9 @@ public static function createValidationRules() {
37143720
$o_878 = new AttrSpec();
37153721
$o_878->name = 'template';
37163722
$o_874->attrs[] = $o_878;
3723+
$o_878a = new AttrSpec();
3724+
$o_878a->name = 'data-amp-bind-property';
3725+
$o_874->attrs[] = $o_878a;
37173726
$o_874->attr_lists = ['extended-amp-global'];
37183727
$o_874->spec_url = 'https://www.ampproject.org/docs/reference/extended/amp-list.html';
37193728
$o_879 = new AmpLayout();
@@ -5270,7 +5279,115 @@ public static function createValidationRules() {
52705279
$o_1287->code = ValidationErrorCode::CSS_SYNTAX_INVALID_ATTR_SELECTOR;
52715280
$o_1287->format = 'CSS syntax error in tag \'%1\' - invalid attribute selector.';
52725281
$o_0->error_formats[] = $o_1287;
5282+
$o_1295 = new TagSpec();
5283+
$o_1295->tag_name = 'script';
5284+
$o_1295->spec_name = 'amp-selector extension .js script';
5285+
$o_1295->mandatory_parent = 'head';
5286+
$o_1296 = new AttrSpec();
5287+
$o_1296->name = 'async';
5288+
$o_1296->mandatory = TRUE;
5289+
$o_1296->value = '';
5290+
$o_1295->attrs[] = $o_1296;
5291+
$o_1297 = new AttrSpec();
5292+
$o_1297->name = 'custom-element';
5293+
$o_1297->mandatory = TRUE;
5294+
$o_1297->value = 'amp-selector';
5295+
$o_1297->dispatch_key = TRUE;
5296+
$o_1295->attrs[] = $o_1297;
5297+
$o_1298 = new AttrSpec();
5298+
$o_1298->name = 'src';
5299+
$o_1298->mandatory = TRUE;
5300+
$o_1298->value_regex = 'https://cdn\\.ampproject\\.org/v0/amp-selector-(latest|0\\.1).js';
5301+
$o_1295->attrs[] = $o_1298;
5302+
$o_1299 = new AttrSpec();
5303+
$o_1299->name = 'type';
5304+
$o_1299->value = 'text/javascript';
5305+
$o_1295->attrs[] = $o_1299;
5306+
$o_1295->spec_url = 'https://www.ampproject.org/docs/reference/extended/amp-selector.html';
5307+
$o_1300 = new CdataSpec();
5308+
$o_1301 = new BlackListedCDataRegex();
5309+
$o_1301->regex = '.';
5310+
$o_1301->error_message = 'contents';
5311+
$o_1300->blacklisted_cdata_regex[] = $o_1301;
5312+
$o_1295->cdata = $o_1300;
5313+
$o_0->tags[] = $o_1295;
5314+
$o_1302 = new TagSpec();
5315+
$o_1302->tag_name = 'amp-selector';
5316+
$o_1302->unique = TRUE;
5317+
$o_1302->attr_lists = ['extended-amp-global'];
5318+
$o_1302->spec_url = 'https://github.com/ampproject/amphtml/blob/master/extensions/amp-selector/amp-selector.md';
5319+
$o_1303 = new AttrSpec();
5320+
$o_1303->name = 'name';
5321+
$o_1302->attrs[] = $o_1303;
5322+
$o_1304 = new AttrSpec();
5323+
$o_1304->name = 'layout';
5324+
$o_1302->attrs[] = $o_1304;
5325+
$o_1305 = new AmpLayout();
5326+
$o_1305->supported_layouts = [
5327+
AmpLayoutLayout::FILL,
5328+
AmpLayoutLayout::FIXED,
5329+
AmpLayoutLayout::FIXED_HEIGHT,
5330+
AmpLayoutLayout::FLEX_ITEM,
5331+
AmpLayoutLayout::NODISPLAY,
5332+
AmpLayoutLayout::RESPONSIVE,
5333+
AmpLayoutLayout::CONTAINER,
5334+
];
5335+
$o_1302->amp_layout = $o_1305;
5336+
$o_1302->disallowed_ancestor = ['head', 'amp-selector'];
5337+
$o_1302->also_requires_tag = ['amp-selector extension .js script'];
5338+
$o_0->tags[] = $o_1302;
5339+
$o_1306 = new TagSpec();
5340+
$o_1306->tag_name = 'amp-state';
5341+
$o_1306->attr_lists = ['extended-amp-global'];
5342+
$o_1306->spec_url = 'https://github.com/ampproject/amphtml/blob/master/extensions/amp-selector/amp-selector.md';
5343+
$o_1307 = new AttrSpec();
5344+
$o_1307->name = 'id';
5345+
$o_1306->attrs[] = $o_1307;
5346+
$o_1308 = new AttrSpec();
5347+
$o_1308->name = 'src';
5348+
$o_1306->attrs[] = $o_1308;
5349+
$o_0->tags[] = $o_1306;
5350+
$o_1309 = new TagSpec();
5351+
$o_1309->tag_name = 'select';
5352+
$o_1310 = new AttrSpec();
5353+
$o_1310->name = 'id';
5354+
$o_1309->attrs[] = $o_1310;
5355+
$o_1311 = new AttrSpec();
5356+
$o_1311->name = '0n';
5357+
$o_1309->attrs[] = $o_1311;
5358+
$o_1312 = new AttrSpec();
5359+
$o_1312->name = 'disabled';
5360+
$o_1309->attrs[] = $o_1312;
5361+
$o_1312_a = new AttrSpec();
5362+
$o_1312_a->name = 'data-amp-bind-disabled';
5363+
$o_1309->attrs[] = $o_1312_a;
5364+
$o_0->tags[] = $o_1309;
5365+
$o_1313 = new TagSpec();
5366+
$o_1313->tag_name = 'option';
5367+
$o_1314 = new AttrSpec();
5368+
$o_1314->name = 'value';
5369+
$o_1313->attrs[] = $o_1314;
5370+
$o_0->tags[] = $o_1313;
5371+
$o_1315 = new TagSpec();
5372+
$o_1315->tag_name = 'script';
5373+
$o_1315->spec_name = 'amp-bind extension .js script';
5374+
$o_1315->mandatory_parent = 'head';
5375+
$o_1316 = new AttrSpec();
5376+
$o_1316->name = 'async';
5377+
$o_1316->mandatory = TRUE;
5378+
$o_1316->value = '';
5379+
$o_1315->attrs[] = $o_1316;
5380+
$o_1317 = new AttrSpec();
5381+
$o_1317->name = 'custom-element';
5382+
$o_1317->mandatory = TRUE;
5383+
$o_1317->value = 'amp-bind';
5384+
$o_1317->dispatch_key = TRUE;
5385+
$o_1315->attrs[] = $o_1317;
5386+
$o_1318 = new AttrSpec();
5387+
$o_1318->name = 'src';
5388+
$o_1318->mandatory = TRUE;
5389+
$o_1318->value_regex = 'https://cdn\\.ampproject\\.org/v0/amp-bind-(latest|0\\.1).js';
5390+
$o_1315->attrs[] = $o_1318;
52735391
return $o_0;
52745392
}
52755393
}
5276-

src/Validate/Context.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class Context
7575

7676
public static $component_mappings = [
7777
'amp-ad' => 'https://cdn.ampproject.org/v0/amp-ad-0.1.js',
78+
'amp-sticky-ad' => 'https://cdn.ampproject.org/v0/amp-sticky-ad-1.0.js',
7879
'amp-analytics' => 'https://cdn.ampproject.org/v0/amp-analytics-0.1.js',
7980
'amp-anim' => 'https://cdn.ampproject.org/v0/amp-anim-0.1.js',
8081
'amp-audio' => 'https://cdn.ampproject.org/v0/amp-audio-0.1.js',
@@ -98,8 +99,7 @@ class Context
9899
'amp-vimeo' => 'https://cdn.ampproject.org/v0/amp-vimeo-0.1.js',
99100
'amp-youtube' => 'https://cdn.ampproject.org/v0/amp-youtube-0.1.js',
100101
'amp-sidebar' => 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js',
101-
'amp-accordion' => 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js',
102-
'template' => 'https://cdn.ampproject.org/v0/amp-mustache-0.1.js'
102+
'amp-accordion' => 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js'
103103
];
104104

105105
/**

0 commit comments

Comments
 (0)