Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#804 Update Allowed Tags And Attributes #823

Merged
merged 27 commits into from
Dec 12, 2017
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0b987a6
804 : Update allowed AMP tags in sanitizer file.
Dec 5, 2017
30064ca
804 : Prevent errors on amp_wp_build.py, update extensions dir.
Dec 5, 2017
ba459a2
Create is_mandatory_attribute_missing method
Dec 6, 2017
8cff768
804 : Modify PHPUnit tests for tag and attribute validation.
Dec 7, 2017
dd807a8
804 : Remove the requirement that 'data-multi-size' be empty.
Dec 7, 2017
a698eea
804 : PHPUnit tests for newly-allowed tags.
Dec 7, 2017
a066117
804 : Move logic for missing attributes.
Dec 7, 2017
cfcf730
804 : Remove the unused $spec_value variable.
Dec 7, 2017
8f0a925
804 : Improve variable alignment and add PHPDoc tags.
Dec 7, 2017
a400fa5
804 : Exclude the generated allowed tags file from PHPCS checks.
Dec 7, 2017
cfc0247
804 : Align 'array' keywords vertically.
Dec 7, 2017
7f9a2db
804 : Change the conditional to simply compare to true.
Dec 7, 2017
b4bfd81
804 : Array and equal sign alignment fixes.
Dec 7, 2017
6f5e39d
804 : Prevent accessing an object as an array.
Dec 7, 2017
2b1443e
Suppress DoubleError phpcs errors in test-tag-and-attribute-sanitizer…
westonruter Dec 8, 2017
c73f92b
[WIP] AMP HTML bash updater draft
ThierryA Dec 8, 2017
f67041d
[WIP] AMP HTML bash updater improvements
ThierryA Dec 8, 2017
236968b
Wrap up AMP HTML bash updater
ThierryA Dec 8, 2017
eab6207
804 : Add a contributing.md file, with steps to use build script.
Dec 9, 2017
eef4b8b
804 : Test that 'amp-playbuzz' is sanitized properly.
Dec 9, 2017
ae92a58
804 : Add allowed protocols to sanitization file.
Dec 9, 2017
4597be5
Fix WPCS warning
ThierryA Dec 11, 2017
44554c5
804 : Add to contributing.md, including unit test information.
Dec 11, 2017
ed3c93d
Merge branch 'feature/804-allowed-tags' of https://github.com/Automat…
Dec 11, 2017
c3b28c0
804 : Merge in develop, resolve conflicts.
Dec 11, 2017
4b3ec53
804 : Correct PHPUnit test for <script> validation.
Dec 12, 2017
af7b830
804 : Add spaces to correct PHPCS errors.
Dec 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# AMP Contributing Guide

Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps add a welcoming sentence (ex. "Thanks for taking the time to contribute!")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @ThierryA. This commit adds your sentence to contributing.md:

Thanks for taking the time to contribute!

To clone this repository
``` bash
$ git clone --recursive [email protected]:Automattic/amp-wp.git
```

### Updating Allowed Tags And Attributes

The file `class-amp-allowed-tags-generated.php` has the AMP specification's allowed tags and attributes. It's used in sanitization.
To update that file:
1. `cd` to the root of this plugin
2. run `bash bin/amphtml-update.sh`
That script is intended for a Linux environment like [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV).

### PHPUnit Testing
Copy link
Collaborator

Choose a reason for hiding this comment

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

The way the dev lib runs PHPUnit (run_phpunit_local) needs to run in an environment which has WordPress Unit Test installed, for example VVV. I would advise to add that as a note.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this came up in #828,.along with questions about how to get pre-commit hook working from wp-dev-lib.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @ThierryA. This commit adds your point to contributing.md:

Please run these tests in an environment with WordPress unit tests installed, like [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV).


Run tests:

``` bash
$ phpunit
```

Run tests with an HTML coverage report:

``` bash
$ phpunit --coverage-html /tmp/report
```

When you push a commit to your PR, Travis CI will run the PHPUnit tests and sniffs against the WordPress Coding Standards.