diff options
Diffstat (limited to 'plugins/af_readability/vendor/masterminds')
55 files changed, 20046 insertions, 0 deletions
diff --git a/plugins/af_readability/vendor/masterminds/html5/.gitattributes b/plugins/af_readability/vendor/masterminds/html5/.gitattributes new file mode 100644 index 000000000..3d291a027 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/.gitattributes @@ -0,0 +1,8 @@ +.gitattributes export-ignore +.gitignore export-ignore +.php_cs.dist export-ignore +.scrutinizer.yml export-ignore +.travis.yml export-ignore +example.php export-ignore +phpunit.xml.dist export-ignore +/test export-ignore diff --git a/plugins/af_readability/vendor/masterminds/html5/.gitignore b/plugins/af_readability/vendor/masterminds/html5/.gitignore new file mode 100644 index 000000000..1fa9e5861 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/.gitignore @@ -0,0 +1,5 @@ +vendor/ +scratch.php +composer.lock +build/ +.php_cs.cache diff --git a/plugins/af_readability/vendor/masterminds/html5/.php_cs.dist b/plugins/af_readability/vendor/masterminds/html5/.php_cs.dist new file mode 100644 index 000000000..d5e49183d --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/.php_cs.dist @@ -0,0 +1,14 @@ +<?php + +$finder = PhpCsFixer\Finder::create() + ->in(__DIR__) +; + +return PhpCsFixer\Config::create() + ->setRules(array( + '@Symfony' => true, + 'concat_space' => array('spacing' => 'one'), + 'phpdoc_annotation_without_dot' => false, + )) + ->setFinder($finder) +; diff --git a/plugins/af_readability/vendor/masterminds/html5/.scrutinizer.yml b/plugins/af_readability/vendor/masterminds/html5/.scrutinizer.yml new file mode 100644 index 000000000..dcdd2047c --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/.scrutinizer.yml @@ -0,0 +1,41 @@ +tools: + php_mess_detector: true + php_analyzer: + config: + parameter_reference_check: { enabled: false } + checkstyle: { enabled: false, no_trailing_whitespace: true, naming: { enabled: true, local_variable: '^[a-z][a-zA-Z0-9]*$', abstract_class_name: ^Abstract|Factory$, utility_class_name: 'Utils?$', constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$', property_name: '^[a-z][a-zA-Z0-9]*$', method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$', parameter_name: '^[a-z][a-zA-Z0-9]*$', interface_name: '^[A-Z][a-zA-Z0-9]*Interface$', type_name: '^[A-Z][a-zA-Z0-9]*$', exception_name: '^[A-Z][a-zA-Z0-9]*Exception$', isser_method_name: '^(?:is|has|should|may|supports)' } } + unreachable_code: { enabled: false } + check_access_control: { enabled: false } + typo_checks: { enabled: false } + check_variables: { enabled: false } + check_calls: { enabled: true, too_many_arguments: true, missing_argument: true, argument_type_checks: lenient } + suspicious_code: { enabled: false, overriding_parameter: false, overriding_closure_use: false, parameter_closure_use_conflict: false, parameter_multiple_times: false, non_existent_class_in_instanceof_check: false, non_existent_class_in_catch_clause: false, assignment_of_null_return: false, non_commented_switch_fallthrough: false, non_commented_empty_catch_block: false, overriding_private_members: false, use_statement_alias_conflict: false, precedence_in_condition_assignment: false } + dead_assignments: { enabled: false } + verify_php_doc_comments: { enabled: false, parameters: false, return: false, suggest_more_specific_types: false, ask_for_return_if_not_inferrable: false, ask_for_param_type_annotation: false } + loops_must_use_braces: { enabled: false } + check_usage_context: { enabled: true, foreach: { value_as_reference: true, traversable: true } } + simplify_boolean_return: { enabled: false } + phpunit_checks: { enabled: false } + reflection_checks: { enabled: false } + precedence_checks: { enabled: true, assignment_in_condition: true, comparison_of_bit_result: true } + basic_semantic_checks: { enabled: false } + unused_code: { enabled: false } + deprecation_checks: { enabled: false } + useless_function_calls: { enabled: false } + metrics_lack_of_cohesion_methods: { enabled: false } + metrics_coupling: { enabled: true, stable_code: { namespace_prefixes: { }, classes: { } } } + doctrine_parameter_binding: { enabled: false } + doctrine_entity_manager_injection: { enabled: false } + symfony_request_injection: { enabled: false } + doc_comment_fixes: { enabled: false } + reflection_fixes: { enabled: false } + use_statement_fixes: { enabled: true, remove_unused: true, preserve_multiple: false, preserve_blanklines: false, order_alphabetically: false } + php_code_sniffer: true + sensiolabs_security_checker: true + php_cpd: true + php_loc: true + php_pdepend: true + external_code_coverage: true +filter: + paths: + - src/* diff --git a/plugins/af_readability/vendor/masterminds/html5/.travis.yml b/plugins/af_readability/vendor/masterminds/html5/.travis.yml new file mode 100644 index 000000000..44661b1d2 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/.travis.yml @@ -0,0 +1,47 @@ +language: php +dist: trusty +sudo: false + +matrix: + include: + - php: 5.3 + dist: precise + env: COMPOSER_FLAGS="--prefer-lowest" + - php: 5.4 + - php: 5.5 + - php: 5.6 + env: SCRUTINIZER=1 PHPUNIT_FLAGS="--coverage-clover=coverage.xml" + - php: 7.0 + env: COMPOSER_FLAGS="--prefer-lowest" + - php: 7.1 + env: CS_FIXER=1 + - php: 7.2 + - php: 7.3 + env: BENCHMARK=1 + - php: 7.4 + - php: 8.0 + dist: bionic + fast_finish: true + +cache: + directories: + - $HOME/.composer/cache + +before_script: + - if [[ SCRUTINIZER != '1' ]]; then phpenv config-rm xdebug.ini || true; fi + - composer self-update + - if [[ ${TRAVIS_PHP_VERSION:0:1} == "8" ]]; then composer config platform.php 7.4; fi + - composer update $COMPOSER_FLAGS --prefer-dist + +script: + - stty cols 120 + - if [ "$CS_FIXER" == 1 ]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.1/php-cs-fixer.phar && php php-cs-fixer.phar fix --dry-run --diff; fi + - mkdir -p build/logs + - ./vendor/bin/phpunit $PHPUNIT_FLAGS + +after_script: + - if [ "$SCRUTINIZER" == 1 ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.xml; fi + - if [ "$BENCHMARK" == 1 ]; then php test/benchmark/run.php 10; fi + +notifications: + irc: "irc.freenode.net#masterminds" diff --git a/plugins/af_readability/vendor/masterminds/html5/CREDITS b/plugins/af_readability/vendor/masterminds/html5/CREDITS new file mode 100644 index 000000000..c2dbc4b64 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/CREDITS @@ -0,0 +1,11 @@ +Matt Butcher [technosophos] <[email protected]> (lead) +Matt Farina [mattfarina] <[email protected]> (lead) +Asmir Mustafic [goetas] <[email protected]> (contributor) +Edward Z. Yang [ezyang] <[email protected]> (contributor) +Geoffrey Sneddon [gsnedders] <[email protected]> (contributor) +Kukhar Vasily [ngreduce] <[email protected]> (contributor) +Rune Christensen [MrElectronic] <[email protected]> (contributor) +Mišo Belica [miso-belica] <[email protected]> (contributor) +Asmir Mustafic [goetas] <[email protected]> (contributor) +KITAITI Makoto [KitaitiMakoto] <[email protected]> (contributor) +Jacob Floyd [cognifloyd] <[email protected]> (contributor) diff --git a/plugins/af_readability/vendor/masterminds/html5/LICENSE.txt b/plugins/af_readability/vendor/masterminds/html5/LICENSE.txt new file mode 100644 index 000000000..3c275b54a --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/LICENSE.txt @@ -0,0 +1,66 @@ +## HTML5-PHP License + +Copyright (c) 2013 The Authors of HTML5-PHP + +Matt Butcher - [email protected] +Matt Farina - [email protected] +Asmir Mustafic - [email protected] + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +## HTML5Lib License + +Portions of this are based on html5lib's PHP version, which was a +sub-project of html5lib. The following is the list of contributors from +html5lib: + +html5lib: + +Copyright (c) 2006-2009 The Authors + +Contributors: +James Graham - [email protected] +Anne van Kesteren - [email protected] +Lachlan Hunt - [email protected] +Matt McDonald - [email protected] +Sam Ruby - [email protected] +Ian Hickson (Google) - [email protected] +Thomas Broyer - [email protected] +Jacques Distler - [email protected] +Henri Sivonen - [email protected] +Adam Barth - [email protected] +Eric Seidel - [email protected] +The Mozilla Foundation (contributions from Henri Sivonen since 2008) +David Flanagan (Mozilla) - [email protected] + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/af_readability/vendor/masterminds/html5/README.md b/plugins/af_readability/vendor/masterminds/html5/README.md new file mode 100644 index 000000000..546d3e24c --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/README.md @@ -0,0 +1,254 @@ +# HTML5-PHP + +HTML5 is a standards-compliant HTML5 parser and writer written entirely in PHP. +It is stable and used in many production websites, and has +well over [five million downloads](https://packagist.org/packages/masterminds/html5). + +HTML5 provides the following features. + +- An HTML5 serializer +- Support for PHP namespaces +- Composer support +- Event-based (SAX-like) parser +- A DOM tree builder +- Interoperability with [QueryPath](https://github.com/technosophos/querypath) +- Runs on **PHP** 5.3.0 or newer + +[![Build Status](https://travis-ci.org/Masterminds/html5-php.png?branch=master)](https://travis-ci.org/Masterminds/html5-php) +[![Latest Stable Version](https://poser.pugx.org/masterminds/html5/v/stable.png)](https://packagist.org/packages/masterminds/html5) +[![Code Coverage](https://scrutinizer-ci.com/g/Masterminds/html5-php/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Masterminds/html5-php/?branch=master) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Masterminds/html5-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Masterminds/html5-php/?branch=master) +[![Stability: Sustained](https://masterminds.github.io/stability/sustained.svg)](https://masterminds.github.io/stability/sustained.html) + +## Installation + +Install HTML5-PHP using [composer](http://getcomposer.org/). + +By adding the `masterminds/html5` dependency to your `composer.json` file: + +```json +{ + "require" : { + "masterminds/html5": "^2.0" + }, +} +``` + +By invoking require command via composer executable: + +```bash +composer require masterminds/html5 +``` + +## Basic Usage + +HTML5-PHP has a high-level API and a low-level API. + +Here is how you use the high-level `HTML5` library API: + +```php +<?php +// Assuming you installed from Composer: +require "vendor/autoload.php"; + +use Masterminds\HTML5; + +// An example HTML document: +$html = <<< 'HERE' + <html> + <head> + <title>TEST</title> + </head> + <body id='foo'> + <h1>Hello World</h1> + <p>This is a test of the HTML5 parser.</p> + </body> + </html> +HERE; + +// Parse the document. $dom is a DOMDocument. +$html5 = new HTML5(); +$dom = $html5->loadHTML($html); + +// Render it as HTML5: +print $html5->saveHTML($dom); + +// Or save it to a file: +$html5->save($dom, 'out.html'); +``` + +The `$dom` created by the parser is a full `DOMDocument` object. And the +`save()` and `saveHTML()` methods will take any DOMDocument. + +### Options + +It is possible to pass in an array of configuration options when loading +an HTML5 document. + +```php +// An associative array of options +$options = array( + 'option_name' => 'option_value', +); + +// Provide the options to the constructor +$html5 = new HTML5($options); + +$dom = $html5->loadHTML($html); +``` + +The following options are supported: + +* `encode_entities` (boolean): Indicates that the serializer should aggressively + encode characters as entities. Without this, it only encodes the bare + minimum. +* `disable_html_ns` (boolean): Prevents the parser from automatically + assigning the HTML5 namespace to the DOM document. This is for + non-namespace aware DOM tools. +* `target_document` (\DOMDocument): A DOM document that will be used as the + destination for the parsed nodes. +* `implicit_namespaces` (array): An assoc array of namespaces that should be + used by the parser. Name is tag prefix, value is NS URI. + +## The Low-Level API + +This library provides the following low-level APIs that you can use to +create more customized HTML5 tools: + +- A SAX-like event-based parser that you can hook into for special kinds +of parsing. +- A flexible error-reporting mechanism that can be tuned to document +syntax checking. +- A DOM implementation that uses PHP's built-in DOM library. + +The unit tests exercise each piece of the API, and every public function +is well-documented. + +### Parser Design + +The parser is designed as follows: + +- The `Scanner` handles scanning on behalf of the parser. +- The `Tokenizer` requests data off of the scanner, parses it, clasifies +it, and sends it to an `EventHandler`. It is a *recursive descent parser.* +- The `EventHandler` receives notifications and data for each specific +semantic event that occurs during tokenization. +- The `DOMBuilder` is an `EventHandler` that listens for tokenizing +events and builds a document tree (`DOMDocument`) based on the events. + +### Serializer Design + +The serializer takes a data structure (the `DOMDocument`) and transforms +it into a character representation -- an HTML5 document. + +The serializer is broken into three parts: + +- The `OutputRules` contain the rules to turn DOM elements into strings. The +rules are an implementation of the interface `RulesInterface` allowing for +different rule sets to be used. +- The `Traverser`, which is a special-purpose tree walker. It visits +each node node in the tree and uses the `OutputRules` to transform the node +into a string. +- `HTML5` manages the `Traverser` and stores the resultant data +in the correct place. + +The serializer (`save()`, `saveHTML()`) follows the +[section 8.9 of the HTML 5.0 spec](http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#serializing-html-fragments). +So tags are serialized according to these rules: + +- A tag with children: <foo>CHILDREN</foo> +- A tag that cannot have content: <foo> (no closing tag) +- A tag that could have content, but doesn't: <foo></foo> + +## Known Issues (Or, Things We Designed Against the Spec) + +Please check the issue queue for a full list, but the following are +issues known issues that are not presently on the roadmap: + +- Namespaces: HTML5 only [supports a selected list of namespaces](http://www.w3.org/TR/html5/infrastructure.html#namespaces) + and they do not operate in the same way as XML namespaces. A `:` has no special + meaning. + By default the parser does not support XML style namespaces via `:`; + to enable the XML namespaces see the [XML Namespaces section](#xml-namespaces) +- Scripts: This parser does not contain a JavaScript or a CSS + interpreter. While one may be supplied, not all features will be + supported. +- Rentrance: The current parser is not re-entrant. (Thus you can't pause + the parser to modify the HTML string mid-parse.) +- Validation: The current tree builder is **not** a validating parser. + While it will correct some HTML, it does not check that the HTML + conforms to the standard. (Should you wish, you can build a validating + parser by extending DOMTree or building your own EventHandler + implementation.) + * There is limited support for insertion modes. + * Some autocorrection is done automatically. + * Per the spec, many legacy tags are admitted and correctly handled, + even though they are technically not part of HTML5. +- Attribute names and values: Due to the implementation details of the + PHP implementation of DOM, attribute names that do not follow the + XML 1.0 standard are not inserted into the DOM. (Effectively, they + are ignored.) If you've got a clever fix for this, jump in! +- Processor Instructions: The HTML5 spec does not allow processor + instructions. We do. Since this is a server-side library, we think + this is useful. And that means, dear reader, that in some cases you + can parse the HTML from a mixed PHP/HTML document. This, however, + is an incidental feature, not a core feature. +- HTML manifests: Unsupported. +- PLAINTEXT: Unsupported. +- Adoption Agency Algorithm: Not yet implemented. (8.2.5.4.7) + +## XML Namespaces + +To use XML style namespaces you have to configure well the main `HTML5` instance. + +```php +use Masterminds\HTML5; +$html = new HTML5(array( + "xmlNamespaces" => true +)); + +$dom = $html->loadHTML('<t:tag xmlns:t="http://www.example.com"/>'); + +$dom->documentElement->namespaceURI; // http://www.example.com + +``` + +You can also add some default prefixes that will not require the namespace declaration, +but its elements will be namespaced. + +```php +use Masterminds\HTML5; +$html = new HTML5(array( + "implicitNamespaces"=>array( + "t"=>"http://www.example.com" + ) +)); + +$dom = $html->loadHTML('<t:tag/>'); + +$dom->documentElement->namespaceURI; // http://www.example.com + +``` + +## Thanks to... + +The dedicated (and patient) contributors of patches small and large, +who have already made this library better.See the CREDITS file for +a list of contributors. + +We owe a huge debt of gratitude to the original authors of html5lib. + +While not much of the original parser remains, we learned a lot from +reading the html5lib library. And some pieces remain here. In +particular, much of the UTF-8 and Unicode handling is derived from the +html5lib project. + +## License + +This software is released under the MIT license. The original html5lib +library was also released under the MIT license. + +See LICENSE.txt + +Certain files contain copyright assertions by specific individuals +involved with html5lib. Those have been retained where appropriate. diff --git a/plugins/af_readability/vendor/masterminds/html5/RELEASE.md b/plugins/af_readability/vendor/masterminds/html5/RELEASE.md new file mode 100644 index 000000000..86c0dac3f --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/RELEASE.md @@ -0,0 +1,153 @@ +# Release Notes + +2.7.5 (2021-07-01) + +- #204: Travis: Enable tests on PHP 8.0 +- #207: Fix PHP 8.1 deprecations + +2.7.4 (2020-10-01) + +- #191: Fix travisci build +- #195: Add .gitattributes file with export-ignore rules +- #194: Fix query parameter parsed as character entity + +2.7.3 (2020-07-05) + +- #190: mitigate cyclic reference between output rules and the traverser objects + +2.7.2 (2020-07-01) + +- #187: Fixed memory leak in HTML5::saveHTML() +- #186: Add special case for end tag </br> + +2.7.1 (2020-06-14) + +- #171: add PHP 7.4 job +- #178: Prevent infinite loop on un-terminated entity declaration at EOF + +2.7.0 (2019-07-25) + +- #164: Drop HHVM support +- #168: Set default encoding in the DOMDocument object + +2.6.0 (2019-03-10) + +- #163: Allow to pass a charset to the Scanner + +2.5.0 (2018-12-27) + +- #162, #161, #155, #154, #153, #151: big performance improvements +- #156: fixed typos +- #160: adopt and enforce code style +- #159: remove deprecated php unit base test case +- #150: backport changes from old master branch + +2.4.0 (2018-11-17) + +- #148: Improve performance by moving sequence matching +- #147: Improve the Tokenizer performance +- #146: Improve performance by relying on a native string instead of InputStream +- #144: Add DOM extension in composer.json +- #145: Add more extensions on composer.json, improve phpdocs and remove dead code +- #143: Remove experimental comment + +2.3.1 (2018-10-18) + +- #121: Audio is not a block tag (fixed by #141) +- #136: Handle illegal self-closing according to spec (fixed by #137) +- #141: Minor fixes in the README + +2.3.0 (2017-09-04) + +- #129: image within inline svg breaks system (fixed by #133) +- #131: ² does not work (fixed by #132) +- #134: Improve tokenizer performance by 20% (alternative version of #130 thanks to @MichaelHeerklotz) +- #135: Raw & in attributes + +2.2.2 (2016-09-22) + +- #116: In XML mode, tags are case sensitive +- #115: Fix PHP Notice in OutputRules +- #112: fix parsing of options of an optgroup +- #111: Adding test for the address tag + +2.2.1 (2016-05-10) + +- #109: Fixed issue where address tag could be written without closing tag (thanks sylus) + +2.2.0 (2016-04-11) + +- #105: Enable composer cache (for CI/CD) +- #100: Use mb_substitute_character inset of ini_set for environments where ini_set is disable (e.g., shared hosting) +- #98: Allow link, meta, style tags in noscript tags +- #96: Fixed xml:href on svgs that use the "use" breaking +- #94: Counting UTF8 characters performance improvement +- #93: Use newer version of coveralls package +- #90: Remove duplicate test +- #87: Allow multiple root nodes + +2.1.2 (2015-06-07) +- #82: Support for PHP7 +- #84: Improved boolean attribute handling + +2.1.1 (2015-03-23) +- #78: Fixes bug where unmatched entity like string drops everything after &. + +2.1.0 (2015-02-01) +- #74: Added `disable_html_ns` and `target_doc` dom parsing options +- Unified option names +- #73: Fixed alphabet, ß now can be detected +- #75 and #76: Allow whitespace in RCDATA tags +- #77: Fixed parsing blunder for json embeds +- #72: Add options to HTML methods + +2.0.2 (2014-12-17) +- #50: empty document handling +- #63: tags with strange capitalization +- #65: dashes and underscores as allowed characters in tag names +- #68: Fixed issue with non-inline elements inside inline containers + +2.0.1 (2014-09-23) +- #59: Fixed issue parsing some fragments. +- #56: Incorrectly saw 0 as empty string +- Sami as new documentation generator + +2.0.0 (2014-07-28) +- #53: Improved boolean attributes handling +- #52: Facebook HHVM compatibility +- #48: Adopted PSR-2 as coding standard +- #47: Moved everything to Masterminds namespace +- #45: Added custom namespaces +- #44: Added support to XML-style namespaces +- #37: Refactored HTML5 class removing static methods + +1.0.5 (2014-06-10) +- #38: Set the dev-master branch as the 1.0.x branch for composer (goetas) +- #34: Tests use PSR-4 for autoloading. (goetas) +- #40, #41: Fix entity handling in RCDATA sections. (KitaitiMakoto) +- #32: Fixed issue where wharacter references were being incorrectly encoded in style tags. + +1.0.4 (2014-04-29) +- #30/#31 Don't throw an exception for invalid tag names. + +1.0.3 (2014-02-28) +- #23 and #29: Ignore attributes with illegal chars in name for the PHP DOM. + +1.0.2 (2014-02-12) +- #23: Handle missing tag close in attribute list. +- #25: Fixed text escaping in the serializer (HTML% 8.3). +- #27: Fixed tests on Windows: changed "\n" -> PHP_EOL. +- #28: Fixed infinite loop for char "&" in unquoted attribute in parser. +- #26: Updated tag name case handling to deal with uppercase usage. +- #24: Newlines and tabs are allowed inside quoted attributes (HTML5 8.2.4). +- Fixed Travis CI testing. + +1.0.1 (2013-11-07) +- CDATA encoding is improved. (Non-standard; Issue #19) +- Some parser rules were not returning the new current element. (Issue #20) +- Added, to the README, details on code test coverage and to packagist version. +- Fixed processor instructions. +- Improved test coverage and documentation coverage. + +1.0.0 (2013-10-02) +- Initial release. diff --git a/plugins/af_readability/vendor/masterminds/html5/UPGRADING.md b/plugins/af_readability/vendor/masterminds/html5/UPGRADING.md new file mode 100644 index 000000000..76e3a19bc --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/UPGRADING.md @@ -0,0 +1,21 @@ +From 1.x to 2.x +================= + +- All classes uses `Masterminds` namespace. +- All public static methods has been removed from `HTML5` class and the general API to access the HTML5 functionalities has changed. + + Before: + + $dom = \HTML5::loadHTML('<html>....'); + \HTML5::saveHTML($dom); + + After: + + use Masterminds\HTML5; + + $html5 = new HTML5(); + + $dom = $html5->loadHTML('<html>....'); + echo $html5->saveHTML($dom); + + diff --git a/plugins/af_readability/vendor/masterminds/html5/bin/entities.php b/plugins/af_readability/vendor/masterminds/html5/bin/entities.php new file mode 100644 index 000000000..56323a341 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/bin/entities.php @@ -0,0 +1,26 @@ +<?php +/** + * Fetch the entities.json file and convert to PHP datastructure. + */ + +// The URL to the official entities JSON file. +$ENTITIES_URL = 'http://www.w3.org/TR/2012/CR-html5-20121217/entities.json'; + +$payload = file_get_contents($ENTITIES_URL); +$json = json_decode($payload); + +$table = array(); +foreach ($json as $name => $obj) { + $sname = substr($name, 1, -1); + $table[$sname] = $obj->characters; +} + +echo '<?php +namespace Masterminds\\HTML5; +/** Entity lookup tables. This class is automatically generated. */ +class Entities { + public static $byName = '; +var_export($table); +echo '; +}' . PHP_EOL; +//print serialize($table); diff --git a/plugins/af_readability/vendor/masterminds/html5/composer.json b/plugins/af_readability/vendor/masterminds/html5/composer.json new file mode 100644 index 000000000..fb7674e05 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/composer.json @@ -0,0 +1,42 @@ +{ + "name": "masterminds/html5", + "description": "An HTML5 parser and serializer.", + "type": "library", + "homepage": "http://masterminds.github.io/html5-php", + "license": "MIT", + "keywords": ["xml", "html", "html5", "dom", "parser", "serializer", "querypath"], + "authors": [ + { + "name": "Matt Butcher", + "email": "[email protected]" + }, + { + "name": "Matt Farina", + "email": "[email protected]" + }, + { + "name": "Asmir Mustafic", + "email": "[email protected]" + } + ], + "require" : { + "ext-ctype": "*", + "ext-dom": "*", + "ext-libxml" : "*", + "php" : ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7" + }, + "autoload": { + "psr-4": {"Masterminds\\": "src"} + }, + "autoload-dev": { + "psr-4": {"Masterminds\\HTML5\\Tests\\": "test/HTML5"} + }, + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/example.php b/plugins/af_readability/vendor/masterminds/html5/example.php new file mode 100644 index 000000000..e4e1f22f9 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/example.php @@ -0,0 +1,32 @@ +<?php + +require 'vendor/autoload.php'; +use Masterminds\HTML5; + +$html = <<< 'HERE' + <html> + <head> + <title>TEST</title> + <script language="javascript"> + if (2 > 1) { alert("Math wins."); } + </script> + </head> + <body id='foo'> + <!-- This space intentionally left blank. --> + <section class="section-a pretty" id="bar1"> + <h1>Hello World</h1><p>This is a test of the HTML5 parser.</p> + <hr> + & Nobody nowhere. + </section> + <test xmlns:foo="http://example.com/foo">TEST</test> + <![CDATA[Because we can.]]> + © + </body></html> +HERE; + +$html5 = new HTML5(); +$dom = $html5->loadHTML($html); + +echo "Converting to HTML 5\n"; + +$html5->save($dom, fopen('php://stdin', 'w')); diff --git a/plugins/af_readability/vendor/masterminds/html5/phpunit.xml.dist b/plugins/af_readability/vendor/masterminds/html5/phpunit.xml.dist new file mode 100644 index 000000000..8e7750d5b --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/phpunit.xml.dist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit colors="true" bootstrap="vendor/autoload.php"> + <testsuites> + <testsuite name="PHPUnit"> + <directory>test/HTML5/</directory> + </testsuite> + </testsuites> +</phpunit> diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5.php new file mode 100644 index 000000000..c857145fb --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5.php @@ -0,0 +1,246 @@ +<?php + +namespace Masterminds; + +use Masterminds\HTML5\Parser\DOMTreeBuilder; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Serializer\OutputRules; +use Masterminds\HTML5\Serializer\Traverser; + +/** + * This class offers convenience methods for parsing and serializing HTML5. + * It is roughly designed to mirror the \DOMDocument native class. + */ +class HTML5 +{ + /** + * Global options for the parser and serializer. + * + * @var array + */ + private $defaultOptions = array( + // Whether the serializer should aggressively encode all characters as entities. + 'encode_entities' => false, + + // Prevents the parser from automatically assigning the HTML5 namespace to the DOM document. + 'disable_html_ns' => false, + ); + + protected $errors = array(); + + public function __construct(array $defaultOptions = array()) + { + $this->defaultOptions = array_merge($this->defaultOptions, $defaultOptions); + } + + /** + * Get the current default options. + * + * @return array + */ + public function getOptions() + { + return $this->defaultOptions; + } + + /** + * Load and parse an HTML file. + * + * This will apply the HTML5 parser, which is tolerant of many + * varieties of HTML, including XHTML 1, HTML 4, and well-formed HTML + * 3. Note that in these cases, not all of the old data will be + * preserved. For example, XHTML's XML declaration will be removed. + * + * The rules governing parsing are set out in the HTML 5 spec. + * + * @param string|resource $file The path to the file to parse. If this is a resource, it is + * assumed to be an open stream whose pointer is set to the first + * byte of input. + * @param array $options Configuration options when parsing the HTML. + * + * @return \DOMDocument A DOM document. These object type is defined by the libxml + * library, and should have been included with your version of PHP. + */ + public function load($file, array $options = array()) + { + // Handle the case where file is a resource. + if (is_resource($file)) { + return $this->parse(stream_get_contents($file), $options); + } + + return $this->parse(file_get_contents($file), $options); + } + + /** + * Parse a HTML Document from a string. + * + * Take a string of HTML 5 (or earlier) and parse it into a + * DOMDocument. + * + * @param string $string A html5 document as a string. + * @param array $options Configuration options when parsing the HTML. + * + * @return \DOMDocument A DOM document. DOM is part of libxml, which is included with + * almost all distribtions of PHP. + */ + public function loadHTML($string, array $options = array()) + { + return $this->parse($string, $options); + } + + /** + * Convenience function to load an HTML file. + * + * This is here to provide backwards compatibility with the + * PHP DOM implementation. It simply calls load(). + * + * @param string $file The path to the file to parse. If this is a resource, it is + * assumed to be an open stream whose pointer is set to the first + * byte of input. + * @param array $options Configuration options when parsing the HTML. + * + * @return \DOMDocument A DOM document. These object type is defined by the libxml + * library, and should have been included with your version of PHP. + */ + public function loadHTMLFile($file, array $options = array()) + { + return $this->load($file, $options); + } + + /** + * Parse a HTML fragment from a string. + * + * @param string $string the HTML5 fragment as a string + * @param array $options Configuration options when parsing the HTML + * + * @return \DOMDocumentFragment A DOM fragment. The DOM is part of libxml, which is included with + * almost all distributions of PHP. + */ + public function loadHTMLFragment($string, array $options = array()) + { + return $this->parseFragment($string, $options); + } + + /** + * Return all errors encountered into parsing phase. + * + * @return array + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Return true it some errors were encountered into parsing phase. + * + * @return bool + */ + public function hasErrors() + { + return count($this->errors) > 0; + } + + /** + * Parse an input string. + * + * @param string $input + * @param array $options + * + * @return \DOMDocument + */ + public function parse($input, array $options = array()) + { + $this->errors = array(); + $options = array_merge($this->defaultOptions, $options); + $events = new DOMTreeBuilder(false, $options); + $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); + $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); + + $parser->parse(); + $this->errors = $events->getErrors(); + + return $events->document(); + } + + /** + * Parse an input stream where the stream is a fragment. + * + * Lower-level loading function. This requires an input stream instead + * of a string, file, or resource. + * + * @param string $input The input data to parse in the form of a string. + * @param array $options An array of options. + * + * @return \DOMDocumentFragment + */ + public function parseFragment($input, array $options = array()) + { + $options = array_merge($this->defaultOptions, $options); + $events = new DOMTreeBuilder(true, $options); + $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); + $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); + + $parser->parse(); + $this->errors = $events->getErrors(); + + return $events->fragment(); + } + + /** + * Save a DOM into a given file as HTML5. + * + * @param mixed $dom The DOM to be serialized. + * @param string|resource $file The filename to be written or resource to write to. + * @param array $options Configuration options when serializing the DOM. These include: + * - encode_entities: Text written to the output is escaped by default and not all + * entities are encoded. If this is set to true all entities will be encoded. + * Defaults to false. + */ + public function save($dom, $file, $options = array()) + { + $close = true; + if (is_resource($file)) { + $stream = $file; + $close = false; + } else { + $stream = fopen($file, 'wb'); + } + $options = array_merge($this->defaultOptions, $options); + $rules = new OutputRules($stream, $options); + $trav = new Traverser($dom, $stream, $rules, $options); + + $trav->walk(); + /* + * release the traverser to avoid cyclic references and allow PHP to free memory without waiting for gc_collect_cycles + */ + $rules->unsetTraverser(); + if ($close) { + fclose($stream); + } + } + + /** + * Convert a DOM into an HTML5 string. + * + * @param mixed $dom The DOM to be serialized. + * @param array $options Configuration options when serializing the DOM. These include: + * - encode_entities: Text written to the output is escaped by default and not all + * entities are encoded. If this is set to true all entities will be encoded. + * Defaults to false. + * + * @return string A HTML5 documented generated from the DOM. + */ + public function saveHTML($dom, $options = array()) + { + $stream = fopen('php://temp', 'wb'); + $this->save($dom, $stream, array_merge($this->defaultOptions, $options)); + + $html = stream_get_contents($stream, -1, 0); + + fclose($stream); + + return $html; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Elements.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Elements.php new file mode 100644 index 000000000..8fe798789 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Elements.php @@ -0,0 +1,619 @@ +<?php +/** + * Provide general element functions. + */ + +namespace Masterminds\HTML5; + +/** + * This class provides general information about HTML5 elements, + * including syntactic and semantic issues. + * Parsers and serializers can + * use this class as a reference point for information about the rules + * of various HTML5 elements. + * + * @todo consider using a bitmask table lookup. There is enough overlap in + * naming that this could significantly shrink the size and maybe make it + * faster. See the Go teams implementation at https://code.google.com/p/go/source/browse/html/atom. + */ +class Elements +{ + /** + * Indicates an element is described in the specification. + */ + const KNOWN_ELEMENT = 1; + + // From section 8.1.2: "script", "style" + // From 8.2.5.4.7 ("in body" insertion mode): "noembed" + // From 8.4 "style", "xmp", "iframe", "noembed", "noframes" + /** + * Indicates the contained text should be processed as raw text. + */ + const TEXT_RAW = 2; + + // From section 8.1.2: "textarea", "title" + /** + * Indicates the contained text should be processed as RCDATA. + */ + const TEXT_RCDATA = 4; + + /** + * Indicates the tag cannot have content. + */ + const VOID_TAG = 8; + + // "address", "article", "aside", "blockquote", "center", "details", "dialog", "dir", "div", "dl", + // "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", + // "nav", "ol", "p", "section", "summary", "ul" + // "h1", "h2", "h3", "h4", "h5", "h6" + // "pre", "listing" + // "form" + // "plaintext" + /** + * Indicates that if a previous event is for a P tag, that element + * should be considered closed. + */ + const AUTOCLOSE_P = 16; + + /** + * Indicates that the text inside is plaintext (pre). + */ + const TEXT_PLAINTEXT = 32; + + // See https://developer.mozilla.org/en-US/docs/HTML/Block-level_elements + /** + * Indicates that the tag is a block. + */ + const BLOCK_TAG = 64; + + /** + * Indicates that the tag allows only inline elements as child nodes. + */ + const BLOCK_ONLY_INLINE = 128; + + /** + * The HTML5 elements as defined in http://dev.w3.org/html5/markup/elements.html. + * + * @var array + */ + public static $html5 = array( + 'a' => 1, + 'abbr' => 1, + 'address' => 65, // NORMAL | BLOCK_TAG + 'area' => 9, // NORMAL | VOID_TAG + 'article' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'aside' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'audio' => 1, // NORMAL + 'b' => 1, + 'base' => 9, // NORMAL | VOID_TAG + 'bdi' => 1, + 'bdo' => 1, + 'blockquote' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'body' => 1, + 'br' => 9, // NORMAL | VOID_TAG + 'button' => 1, + 'canvas' => 65, // NORMAL | BLOCK_TAG + 'caption' => 1, + 'cite' => 1, + 'code' => 1, + 'col' => 9, // NORMAL | VOID_TAG + 'colgroup' => 1, + 'command' => 9, // NORMAL | VOID_TAG + // "data" => 1, // This is highly experimental and only part of the whatwg spec (not w3c). See https://developer.mozilla.org/en-US/docs/HTML/Element/data + 'datalist' => 1, + 'dd' => 65, // NORMAL | BLOCK_TAG + 'del' => 1, + 'details' => 17, // NORMAL | AUTOCLOSE_P, + 'dfn' => 1, + 'dialog' => 17, // NORMAL | AUTOCLOSE_P, + 'div' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'dl' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'dt' => 1, + 'em' => 1, + 'embed' => 9, // NORMAL | VOID_TAG + 'fieldset' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'figcaption' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'figure' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'footer' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'form' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h1' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h2' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h3' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h4' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h5' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h6' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'head' => 1, + 'header' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'hgroup' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'hr' => 73, // NORMAL | VOID_TAG + 'html' => 1, + 'i' => 1, + 'iframe' => 3, // NORMAL | TEXT_RAW + 'img' => 9, // NORMAL | VOID_TAG + 'input' => 9, // NORMAL | VOID_TAG + 'kbd' => 1, + 'ins' => 1, + 'keygen' => 9, // NORMAL | VOID_TAG + 'label' => 1, + 'legend' => 1, + 'li' => 1, + 'link' => 9, // NORMAL | VOID_TAG + 'map' => 1, + 'mark' => 1, + 'menu' => 17, // NORMAL | AUTOCLOSE_P, + 'meta' => 9, // NORMAL | VOID_TAG + 'meter' => 1, + 'nav' => 17, // NORMAL | AUTOCLOSE_P, + 'noscript' => 65, // NORMAL | BLOCK_TAG + 'object' => 1, + 'ol' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'optgroup' => 1, + 'option' => 1, + 'output' => 65, // NORMAL | BLOCK_TAG + 'p' => 209, // NORMAL | AUTOCLOSE_P | BLOCK_TAG | BLOCK_ONLY_INLINE + 'param' => 9, // NORMAL | VOID_TAG + 'pre' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'progress' => 1, + 'q' => 1, + 'rp' => 1, + 'rt' => 1, + 'ruby' => 1, + 's' => 1, + 'samp' => 1, + 'script' => 3, // NORMAL | TEXT_RAW + 'section' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'select' => 1, + 'small' => 1, + 'source' => 9, // NORMAL | VOID_TAG + 'span' => 1, + 'strong' => 1, + 'style' => 3, // NORMAL | TEXT_RAW + 'sub' => 1, + 'summary' => 17, // NORMAL | AUTOCLOSE_P, + 'sup' => 1, + 'table' => 65, // NORMAL | BLOCK_TAG + 'tbody' => 1, + 'td' => 1, + 'textarea' => 5, // NORMAL | TEXT_RCDATA + 'tfoot' => 65, // NORMAL | BLOCK_TAG + 'th' => 1, + 'thead' => 1, + 'time' => 1, + 'title' => 5, // NORMAL | TEXT_RCDATA + 'tr' => 1, + 'track' => 9, // NORMAL | VOID_TAG + 'u' => 1, + 'ul' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'var' => 1, + 'video' => 65, // NORMAL | BLOCK_TAG + 'wbr' => 9, // NORMAL | VOID_TAG + + // Legacy? + 'basefont' => 8, // VOID_TAG + 'bgsound' => 8, // VOID_TAG + 'noframes' => 2, // RAW_TEXT + 'frame' => 9, // NORMAL | VOID_TAG + 'frameset' => 1, + 'center' => 16, + 'dir' => 16, + 'listing' => 16, // AUTOCLOSE_P + 'plaintext' => 48, // AUTOCLOSE_P | TEXT_PLAINTEXT + 'applet' => 0, + 'marquee' => 0, + 'isindex' => 8, // VOID_TAG + 'xmp' => 20, // AUTOCLOSE_P | VOID_TAG | RAW_TEXT + 'noembed' => 2, // RAW_TEXT + ); + + /** + * The MathML elements. + * See http://www.w3.org/wiki/MathML/Elements. + * + * In our case we are only concerned with presentation MathML and not content + * MathML. There is a nice list of this subset at https://developer.mozilla.org/en-US/docs/MathML/Element. + * + * @var array + */ + public static $mathml = array( + 'maction' => 1, + 'maligngroup' => 1, + 'malignmark' => 1, + 'math' => 1, + 'menclose' => 1, + 'merror' => 1, + 'mfenced' => 1, + 'mfrac' => 1, + 'mglyph' => 1, + 'mi' => 1, + 'mlabeledtr' => 1, + 'mlongdiv' => 1, + 'mmultiscripts' => 1, + 'mn' => 1, + 'mo' => 1, + 'mover' => 1, + 'mpadded' => 1, + 'mphantom' => 1, + 'mroot' => 1, + 'mrow' => 1, + 'ms' => 1, + 'mscarries' => 1, + 'mscarry' => 1, + 'msgroup' => 1, + 'msline' => 1, + 'mspace' => 1, + 'msqrt' => 1, + 'msrow' => 1, + 'mstack' => 1, + 'mstyle' => 1, + 'msub' => 1, + 'msup' => 1, + 'msubsup' => 1, + 'mtable' => 1, + 'mtd' => 1, + 'mtext' => 1, + 'mtr' => 1, + 'munder' => 1, + 'munderover' => 1, + ); + + /** + * The svg elements. + * + * The Mozilla documentation has a good list at https://developer.mozilla.org/en-US/docs/SVG/Element. + * The w3c list appears to be lacking in some areas like filter effect elements. + * That list can be found at http://www.w3.org/wiki/SVG/Elements. + * + * Note, FireFox appears to do a better job rendering filter effects than chrome. + * While they are in the spec I'm not sure how widely implemented they are. + * + * @var array + */ + public static $svg = array( + 'a' => 1, + 'altGlyph' => 1, + 'altGlyphDef' => 1, + 'altGlyphItem' => 1, + 'animate' => 1, + 'animateColor' => 1, + 'animateMotion' => 1, + 'animateTransform' => 1, + 'circle' => 1, + 'clipPath' => 1, + 'color-profile' => 1, + 'cursor' => 1, + 'defs' => 1, + 'desc' => 1, + 'ellipse' => 1, + 'feBlend' => 1, + 'feColorMatrix' => 1, + 'feComponentTransfer' => 1, + 'feComposite' => 1, + 'feConvolveMatrix' => 1, + 'feDiffuseLighting' => 1, + 'feDisplacementMap' => 1, + 'feDistantLight' => 1, + 'feFlood' => 1, + 'feFuncA' => 1, + 'feFuncB' => 1, + 'feFuncG' => 1, + 'feFuncR' => 1, + 'feGaussianBlur' => 1, + 'feImage' => 1, + 'feMerge' => 1, + 'feMergeNode' => 1, + 'feMorphology' => 1, + 'feOffset' => 1, + 'fePointLight' => 1, + 'feSpecularLighting' => 1, + 'feSpotLight' => 1, + 'feTile' => 1, + 'feTurbulence' => 1, + 'filter' => 1, + 'font' => 1, + 'font-face' => 1, + 'font-face-format' => 1, + 'font-face-name' => 1, + 'font-face-src' => 1, + 'font-face-uri' => 1, + 'foreignObject' => 1, + 'g' => 1, + 'glyph' => 1, + 'glyphRef' => 1, + 'hkern' => 1, + 'image' => 1, + 'line' => 1, + 'linearGradient' => 1, + 'marker' => 1, + 'mask' => 1, + 'metadata' => 1, + 'missing-glyph' => 1, + 'mpath' => 1, + 'path' => 1, + 'pattern' => 1, + 'polygon' => 1, + 'polyline' => 1, + 'radialGradient' => 1, + 'rect' => 1, + 'script' => 3, // NORMAL | RAW_TEXT + 'set' => 1, + 'stop' => 1, + 'style' => 3, // NORMAL | RAW_TEXT + 'svg' => 1, + 'switch' => 1, + 'symbol' => 1, + 'text' => 1, + 'textPath' => 1, + 'title' => 1, + 'tref' => 1, + 'tspan' => 1, + 'use' => 1, + 'view' => 1, + 'vkern' => 1, + ); + + /** + * Some attributes in SVG are case sensitive. + * + * This map contains key/value pairs with the key as the lowercase attribute + * name and the value with the correct casing. + */ + public static $svgCaseSensitiveAttributeMap = array( + 'attributename' => 'attributeName', + 'attributetype' => 'attributeType', + 'basefrequency' => 'baseFrequency', + 'baseprofile' => 'baseProfile', + 'calcmode' => 'calcMode', + 'clippathunits' => 'clipPathUnits', + 'contentscripttype' => 'contentScriptType', + 'contentstyletype' => 'contentStyleType', + 'diffuseconstant' => 'diffuseConstant', + 'edgemode' => 'edgeMode', + 'externalresourcesrequired' => 'externalResourcesRequired', + 'filterres' => 'filterRes', + 'filterunits' => 'filterUnits', + 'glyphref' => 'glyphRef', + 'gradienttransform' => 'gradientTransform', + 'gradientunits' => 'gradientUnits', + 'kernelmatrix' => 'kernelMatrix', + 'kernelunitlength' => 'kernelUnitLength', + 'keypoints' => 'keyPoints', + 'keysplines' => 'keySplines', + 'keytimes' => 'keyTimes', + 'lengthadjust' => 'lengthAdjust', + 'limitingconeangle' => 'limitingConeAngle', + 'markerheight' => 'markerHeight', + 'markerunits' => 'markerUnits', + 'markerwidth' => 'markerWidth', + 'maskcontentunits' => 'maskContentUnits', + 'maskunits' => 'maskUnits', + 'numoctaves' => 'numOctaves', + 'pathlength' => 'pathLength', + 'patterncontentunits' => 'patternContentUnits', + 'patterntransform' => 'patternTransform', + 'patternunits' => 'patternUnits', + 'pointsatx' => 'pointsAtX', + 'pointsaty' => 'pointsAtY', + 'pointsatz' => 'pointsAtZ', + 'preservealpha' => 'preserveAlpha', + 'preserveaspectratio' => 'preserveAspectRatio', + 'primitiveunits' => 'primitiveUnits', + 'refx' => 'refX', + 'refy' => 'refY', + 'repeatcount' => 'repeatCount', + 'repeatdur' => 'repeatDur', + 'requiredextensions' => 'requiredExtensions', + 'requiredfeatures' => 'requiredFeatures', + 'specularconstant' => 'specularConstant', + 'specularexponent' => 'specularExponent', + 'spreadmethod' => 'spreadMethod', + 'startoffset' => 'startOffset', + 'stddeviation' => 'stdDeviation', + 'stitchtiles' => 'stitchTiles', + 'surfacescale' => 'surfaceScale', + 'systemlanguage' => 'systemLanguage', + 'tablevalues' => 'tableValues', + 'targetx' => 'targetX', + 'targety' => 'targetY', + 'textlength' => 'textLength', + 'viewbox' => 'viewBox', + 'viewtarget' => 'viewTarget', + 'xchannelselector' => 'xChannelSelector', + 'ychannelselector' => 'yChannelSelector', + 'zoomandpan' => 'zoomAndPan', + ); + + /** + * Some SVG elements are case sensitive. + * This map contains these. + * + * The map contains key/value store of the name is lowercase as the keys and + * the correct casing as the value. + */ + public static $svgCaseSensitiveElementMap = array( + 'altglyph' => 'altGlyph', + 'altglyphdef' => 'altGlyphDef', + 'altglyphitem' => 'altGlyphItem', + 'animatecolor' => 'animateColor', + 'animatemotion' => 'animateMotion', + 'animatetransform' => 'animateTransform', + 'clippath' => 'clipPath', + 'feblend' => 'feBlend', + 'fecolormatrix' => 'feColorMatrix', + 'fecomponenttransfer' => 'feComponentTransfer', + 'fecomposite' => 'feComposite', + 'feconvolvematrix' => 'feConvolveMatrix', + 'fediffuselighting' => 'feDiffuseLighting', + 'fedisplacementmap' => 'feDisplacementMap', + 'fedistantlight' => 'feDistantLight', + 'feflood' => 'feFlood', + 'fefunca' => 'feFuncA', + 'fefuncb' => 'feFuncB', + 'fefuncg' => 'feFuncG', + 'fefuncr' => 'feFuncR', + 'fegaussianblur' => 'feGaussianBlur', + 'feimage' => 'feImage', + 'femerge' => 'feMerge', + 'femergenode' => 'feMergeNode', + 'femorphology' => 'feMorphology', + 'feoffset' => 'feOffset', + 'fepointlight' => 'fePointLight', + 'fespecularlighting' => 'feSpecularLighting', + 'fespotlight' => 'feSpotLight', + 'fetile' => 'feTile', + 'feturbulence' => 'feTurbulence', + 'foreignobject' => 'foreignObject', + 'glyphref' => 'glyphRef', + 'lineargradient' => 'linearGradient', + 'radialgradient' => 'radialGradient', + 'textpath' => 'textPath', + ); + + /** + * Check whether the given element meets the given criterion. + * + * Example: + * + * Elements::isA('script', Elements::TEXT_RAW); // Returns true. + * + * Elements::isA('script', Elements::TEXT_RCDATA); // Returns false. + * + * @param string $name The element name. + * @param int $mask One of the constants on this class. + * + * @return bool true if the element matches the mask, false otherwise. + */ + public static function isA($name, $mask) + { + return (static::element($name) & $mask) === $mask; + } + + /** + * Test if an element is a valid html5 element. + * + * @param string $name The name of the element. + * + * @return bool true if a html5 element and false otherwise. + */ + public static function isHtml5Element($name) + { + // html5 element names are case insensitive. Forcing lowercase for the check. + // Do we need this check or will all data passed here already be lowercase? + return isset(static::$html5[strtolower($name)]); + } + + /** + * Test if an element name is a valid MathML presentation element. + * + * @param string $name The name of the element. + * + * @return bool true if a MathML name and false otherwise. + */ + public static function isMathMLElement($name) + { + // MathML is case-sensitive unlike html5 elements. + return isset(static::$mathml[$name]); + } + + /** + * Test if an element is a valid SVG element. + * + * @param string $name The name of the element. + * + * @return bool true if a SVG element and false otherise. + */ + public static function isSvgElement($name) + { + // SVG is case-sensitive unlike html5 elements. + return isset(static::$svg[$name]); + } + + /** + * Is an element name valid in an html5 document. + * This includes html5 elements along with other allowed embedded content + * such as svg and mathml. + * + * @param string $name The name of the element. + * + * @return bool true if valid and false otherwise. + */ + public static function isElement($name) + { + return static::isHtml5Element($name) || static::isMathMLElement($name) || static::isSvgElement($name); + } + + /** + * Get the element mask for the given element name. + * + * @param string $name The name of the element. + * + * @return int the element mask. + */ + public static function element($name) + { + if (isset(static::$html5[$name])) { + return static::$html5[$name]; + } + if (isset(static::$svg[$name])) { + return static::$svg[$name]; + } + if (isset(static::$mathml[$name])) { + return static::$mathml[$name]; + } + + return 0; + } + + /** + * Normalize a SVG element name to its proper case and form. + * + * @param string $name The name of the element. + * + * @return string the normalized form of the element name. + */ + public static function normalizeSvgElement($name) + { + $name = strtolower($name); + if (isset(static::$svgCaseSensitiveElementMap[$name])) { + $name = static::$svgCaseSensitiveElementMap[$name]; + } + + return $name; + } + + /** + * Normalize a SVG attribute name to its proper case and form. + * + * @param string $name The name of the attribute. + * + * @return string The normalized form of the attribute name. + */ + public static function normalizeSvgAttribute($name) + { + $name = strtolower($name); + if (isset(static::$svgCaseSensitiveAttributeMap[$name])) { + $name = static::$svgCaseSensitiveAttributeMap[$name]; + } + + return $name; + } + + /** + * Normalize a MathML attribute name to its proper case and form. + * Note, all MathML element names are lowercase. + * + * @param string $name The name of the attribute. + * + * @return string The normalized form of the attribute name. + */ + public static function normalizeMathMlAttribute($name) + { + $name = strtolower($name); + + // Only one attribute has a mixed case form for MathML. + if ('definitionurl' === $name) { + $name = 'definitionURL'; + } + + return $name; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Entities.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Entities.php new file mode 100644 index 000000000..0e7227dc1 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Entities.php @@ -0,0 +1,2236 @@ +<?php + +namespace Masterminds\HTML5; + +/** + * Entity lookup tables. + * This class is automatically generated. + */ +class Entities +{ + public static $byName = array( + 'Aacute' => 'Á', + 'Aacut' => 'Á', + 'aacute' => 'á', + 'aacut' => 'á', + 'Abreve' => 'Ă', + 'abreve' => 'ă', + 'ac' => '∾', + 'acd' => '∿', + 'acE' => '∾̳', + 'Acirc' => 'Â', + 'Acir' => 'Â', + 'acirc' => 'â', + 'acir' => 'â', + 'acute' => '´', + 'acut' => '´', + 'Acy' => 'А', + 'acy' => 'а', + 'AElig' => 'Æ', + 'AEli' => 'Æ', + 'aelig' => 'æ', + 'aeli' => 'æ', + 'af' => '', + 'Afr' => '𝔄', + 'afr' => '𝔞', + 'Agrave' => 'À', + 'Agrav' => 'À', + 'agrave' => 'à', + 'agrav' => 'à', + 'alefsym' => 'ℵ', + 'aleph' => 'ℵ', + 'Alpha' => 'Α', + 'alpha' => 'α', + 'Amacr' => 'Ā', + 'amacr' => 'ā', + 'amalg' => '⨿', + 'AMP' => '&', + 'AM' => '&', + 'amp' => '&', + 'am' => '&', + 'And' => '⩓', + 'and' => '∧', + 'andand' => '⩕', + 'andd' => '⩜', + 'andslope' => '⩘', + 'andv' => '⩚', + 'ang' => '∠', + 'ange' => '⦤', + 'angle' => '∠', + 'angmsd' => '∡', + 'angmsdaa' => '⦨', + 'angmsdab' => '⦩', + 'angmsdac' => '⦪', + 'angmsdad' => '⦫', + 'angmsdae' => '⦬', + 'angmsdaf' => '⦭', + 'angmsdag' => '⦮', + 'angmsdah' => '⦯', + 'angrt' => '∟', + 'angrtvb' => '⊾', + 'angrtvbd' => '⦝', + 'angsph' => '∢', + 'angst' => 'Å', + 'angzarr' => '⍼', + 'Aogon' => 'Ą', + 'aogon' => 'ą', + 'Aopf' => '𝔸', + 'aopf' => '𝕒', + 'ap' => '≈', + 'apacir' => '⩯', + 'apE' => '⩰', + 'ape' => '≊', + 'apid' => '≋', + 'apos' => '\'', + 'ApplyFunction' => '', + 'approx' => '≈', + 'approxeq' => '≊', + 'Aring' => 'Å', + 'Arin' => 'Å', + 'aring' => 'å', + 'arin' => 'å', + 'Ascr' => '𝒜', + 'ascr' => '𝒶', + 'Assign' => '≔', + 'ast' => '*', + 'asymp' => '≈', + 'asympeq' => '≍', + 'Atilde' => 'Ã', + 'Atild' => 'Ã', + 'atilde' => 'ã', + 'atild' => 'ã', + 'Auml' => 'Ä', + 'Aum' => 'Ä', + 'auml' => 'ä', + 'aum' => 'ä', + 'awconint' => '∳', + 'awint' => '⨑', + 'backcong' => '≌', + 'backepsilon' => '϶', + 'backprime' => '‵', + 'backsim' => '∽', + 'backsimeq' => '⋍', + 'Backslash' => '∖', + 'Barv' => '⫧', + 'barvee' => '⊽', + 'Barwed' => '⌆', + 'barwed' => '⌅', + 'barwedge' => '⌅', + 'bbrk' => '⎵', + 'bbrktbrk' => '⎶', + 'bcong' => '≌', + 'Bcy' => 'Б', + 'bcy' => 'б', + 'bdquo' => '„', + 'becaus' => '∵', + 'Because' => '∵', + 'because' => '∵', + 'bemptyv' => '⦰', + 'bepsi' => '϶', + 'bernou' => 'ℬ', + 'Bernoullis' => 'ℬ', + 'Beta' => 'Β', + 'beta' => 'β', + 'beth' => 'ℶ', + 'between' => '≬', + 'Bfr' => '𝔅', + 'bfr' => '𝔟', + 'bigcap' => '⋂', + 'bigcirc' => '◯', + 'bigcup' => '⋃', + 'bigodot' => '⨀', + 'bigoplus' => '⨁', + 'bigotimes' => '⨂', + 'bigsqcup' => '⨆', + 'bigstar' => '★', + 'bigtriangledown' => '▽', + 'bigtriangleup' => '△', + 'biguplus' => '⨄', + 'bigvee' => '⋁', + 'bigwedge' => '⋀', + 'bkarow' => '⤍', + 'blacklozenge' => '⧫', + 'blacksquare' => '▪', + 'blacktriangle' => '▴', + 'blacktriangledown' => '▾', + 'blacktriangleleft' => '◂', + 'blacktriangleright' => '▸', + 'blank' => '␣', + 'blk12' => '▒', + 'blk14' => '░', + 'blk34' => '▓', + 'block' => '█', + 'bne' => '=⃥', + 'bnequiv' => '≡⃥', + 'bNot' => '⫭', + 'bnot' => '⌐', + 'Bopf' => '𝔹', + 'bopf' => '𝕓', + 'bot' => '⊥', + 'bottom' => '⊥', + 'bowtie' => '⋈', + 'boxbox' => '⧉', + 'boxDL' => '╗', + 'boxDl' => '╖', + 'boxdL' => '╕', + 'boxdl' => '┐', + 'boxDR' => '╔', + 'boxDr' => '╓', + 'boxdR' => '╒', + 'boxdr' => '┌', + 'boxH' => '═', + 'boxh' => '─', + 'boxHD' => '╦', + 'boxHd' => '╤', + 'boxhD' => '╥', + 'boxhd' => '┬', + 'boxHU' => '╩', + 'boxHu' => '╧', + 'boxhU' => '╨', + 'boxhu' => '┴', + 'boxminus' => '⊟', + 'boxplus' => '⊞', + 'boxtimes' => '⊠', + 'boxUL' => '╝', + 'boxUl' => '╜', + 'boxuL' => '╛', + 'boxul' => '┘', + 'boxUR' => '╚', + 'boxUr' => '╙', + 'boxuR' => '╘', + 'boxur' => '└', + 'boxV' => '║', + 'boxv' => '│', + 'boxVH' => '╬', + 'boxVh' => '╫', + 'boxvH' => '╪', + 'boxvh' => '┼', + 'boxVL' => '╣', + 'boxVl' => '╢', + 'boxvL' => '╡', + 'boxvl' => '┤', + 'boxVR' => '╠', + 'boxVr' => '╟', + 'boxvR' => '╞', + 'boxvr' => '├', + 'bprime' => '‵', + 'Breve' => '˘', + 'breve' => '˘', + 'brvbar' => '¦', + 'brvba' => '¦', + 'Bscr' => 'ℬ', + 'bscr' => '𝒷', + 'bsemi' => '⁏', + 'bsim' => '∽', + 'bsime' => '⋍', + 'bsol' => '\\', + 'bsolb' => '⧅', + 'bsolhsub' => '⟈', + 'bull' => '•', + 'bullet' => '•', + 'bump' => '≎', + 'bumpE' => '⪮', + 'bumpe' => '≏', + 'Bumpeq' => '≎', + 'bumpeq' => '≏', + 'Cacute' => 'Ć', + 'cacute' => 'ć', + 'Cap' => '⋒', + 'cap' => '∩', + 'capand' => '⩄', + 'capbrcup' => '⩉', + 'capcap' => '⩋', + 'capcup' => '⩇', + 'capdot' => '⩀', + 'CapitalDifferentialD' => 'ⅅ', + 'caps' => '∩︀', + 'caret' => '⁁', + 'caron' => 'ˇ', + 'Cayleys' => 'ℭ', + 'ccaps' => '⩍', + 'Ccaron' => 'Č', + 'ccaron' => 'č', + 'Ccedil' => 'Ç', + 'Ccedi' => 'Ç', + 'ccedil' => 'ç', + 'ccedi' => 'ç', + 'Ccirc' => 'Ĉ', + 'ccirc' => 'ĉ', + 'Cconint' => '∰', + 'ccups' => '⩌', + 'ccupssm' => '⩐', + 'Cdot' => 'Ċ', + 'cdot' => 'ċ', + 'cedil' => '¸', + 'cedi' => '¸', + 'Cedilla' => '¸', + 'cemptyv' => '⦲', + 'cent' => '¢', + 'cen' => '¢', + 'CenterDot' => '·', + 'centerdot' => '·', + 'Cfr' => 'ℭ', + 'cfr' => '𝔠', + 'CHcy' => 'Ч', + 'chcy' => 'ч', + 'check' => '✓', + 'checkmark' => '✓', + 'Chi' => 'Χ', + 'chi' => 'χ', + 'cir' => '○', + 'circ' => 'ˆ', + 'circeq' => '≗', + 'circlearrowleft' => '↺', + 'circlearrowright' => '↻', + 'circledast' => '⊛', + 'circledcirc' => '⊚', + 'circleddash' => '⊝', + 'CircleDot' => '⊙', + 'circledR' => '®', + 'circledS' => 'Ⓢ', + 'CircleMinus' => '⊖', + 'CirclePlus' => '⊕', + 'CircleTimes' => '⊗', + 'cirE' => '⧃', + 'cire' => '≗', + 'cirfnint' => '⨐', + 'cirmid' => '⫯', + 'cirscir' => '⧂', + 'ClockwiseContourIntegral' => '∲', + 'CloseCurlyDoubleQuote' => '”', + 'CloseCurlyQuote' => '’', + 'clubs' => '♣', + 'clubsuit' => '♣', + 'Colon' => '∷', + 'colon' => ':', + 'Colone' => '⩴', + 'colone' => '≔', + 'coloneq' => '≔', + 'comma' => ',', + 'commat' => '@', + 'comp' => '∁', + 'compfn' => '∘', + 'complement' => '∁', + 'complexes' => 'ℂ', + 'cong' => '≅', + 'congdot' => '⩭', + 'Congruent' => '≡', + 'Conint' => '∯', + 'conint' => '∮', + 'ContourIntegral' => '∮', + 'Copf' => 'ℂ', + 'copf' => '𝕔', + 'coprod' => '∐', + 'Coproduct' => '∐', + 'COPY' => '©', + 'COP' => '©', + 'copy' => '©', + 'cop' => '©', + 'copysr' => '℗', + 'CounterClockwiseContourIntegral' => '∳', + 'crarr' => '↵', + 'Cross' => '⨯', + 'cross' => '✗', + 'Cscr' => '𝒞', + 'cscr' => '𝒸', + 'csub' => '⫏', + 'csube' => '⫑', + 'csup' => '⫐', + 'csupe' => '⫒', + 'ctdot' => '⋯', + 'cudarrl' => '⤸', + 'cudarrr' => '⤵', + 'cuepr' => '⋞', + 'cuesc' => '⋟', + 'cularr' => '↶', + 'cularrp' => '⤽', + 'Cup' => '⋓', + 'cup' => '∪', + 'cupbrcap' => '⩈', + 'CupCap' => '≍', + 'cupcap' => '⩆', + 'cupcup' => '⩊', + 'cupdot' => '⊍', + 'cupor' => '⩅', + 'cups' => '∪︀', + 'curarr' => '↷', + 'curarrm' => '⤼', + 'curlyeqprec' => '⋞', + 'curlyeqsucc' => '⋟', + 'curlyvee' => '⋎', + 'curlywedge' => '⋏', + 'curren' => '¤', + 'curre' => '¤', + 'curvearrowleft' => '↶', + 'curvearrowright' => '↷', + 'cuvee' => '⋎', + 'cuwed' => '⋏', + 'cwconint' => '∲', + 'cwint' => '∱', + 'cylcty' => '⌭', + 'Dagger' => '‡', + 'dagger' => '†', + 'daleth' => 'ℸ', + 'Darr' => '↡', + 'dArr' => '⇓', + 'darr' => '↓', + 'dash' => '‐', + 'Dashv' => '⫤', + 'dashv' => '⊣', + 'dbkarow' => '⤏', + 'dblac' => '˝', + 'Dcaron' => 'Ď', + 'dcaron' => 'ď', + 'Dcy' => 'Д', + 'dcy' => 'д', + 'DD' => 'ⅅ', + 'dd' => 'ⅆ', + 'ddagger' => '‡', + 'ddarr' => '⇊', + 'DDotrahd' => '⤑', + 'ddotseq' => '⩷', + 'deg' => '°', + 'de' => '°', + 'Del' => '∇', + 'Delta' => 'Δ', + 'delta' => 'δ', + 'demptyv' => '⦱', + 'dfisht' => '⥿', + 'Dfr' => '𝔇', + 'dfr' => '𝔡', + 'dHar' => '⥥', + 'dharl' => '⇃', + 'dharr' => '⇂', + 'DiacriticalAcute' => '´', + 'DiacriticalDot' => '˙', + 'DiacriticalDoubleAcute' => '˝', + 'DiacriticalGrave' => '`', + 'DiacriticalTilde' => '˜', + 'diam' => '⋄', + 'Diamond' => '⋄', + 'diamond' => '⋄', + 'diamondsuit' => '♦', + 'diams' => '♦', + 'die' => '¨', + 'DifferentialD' => 'ⅆ', + 'digamma' => 'ϝ', + 'disin' => '⋲', + 'div' => '÷', + 'divide' => '÷', + 'divid' => '÷', + 'divideontimes' => '⋇', + 'divonx' => '⋇', + 'DJcy' => 'Ђ', + 'djcy' => 'ђ', + 'dlcorn' => '⌞', + 'dlcrop' => '⌍', + 'dollar' => '$', + 'Dopf' => '𝔻', + 'dopf' => '𝕕', + 'Dot' => '¨', + 'dot' => '˙', + 'DotDot' => '⃜', + 'doteq' => '≐', + 'doteqdot' => '≑', + 'DotEqual' => '≐', + 'dotminus' => '∸', + 'dotplus' => '∔', + 'dotsquare' => '⊡', + 'doublebarwedge' => '⌆', + 'DoubleContourIntegral' => '∯', + 'DoubleDot' => '¨', + 'DoubleDownArrow' => '⇓', + 'DoubleLeftArrow' => '⇐', + 'DoubleLeftRightArrow' => '⇔', + 'DoubleLeftTee' => '⫤', + 'DoubleLongLeftArrow' => '⟸', + 'DoubleLongLeftRightArrow' => '⟺', + 'DoubleLongRightArrow' => '⟹', + 'DoubleRightArrow' => '⇒', + 'DoubleRightTee' => '⊨', + 'DoubleUpArrow' => '⇑', + 'DoubleUpDownArrow' => '⇕', + 'DoubleVerticalBar' => '∥', + 'DownArrow' => '↓', + 'Downarrow' => '⇓', + 'downarrow' => '↓', + 'DownArrowBar' => '⤓', + 'DownArrowUpArrow' => '⇵', + 'DownBreve' => '̑', + 'downdownarrows' => '⇊', + 'downharpoonleft' => '⇃', + 'downharpoonright' => '⇂', + 'DownLeftRightVector' => '⥐', + 'DownLeftTeeVector' => '⥞', + 'DownLeftVector' => '↽', + 'DownLeftVectorBar' => '⥖', + 'DownRightTeeVector' => '⥟', + 'DownRightVector' => '⇁', + 'DownRightVectorBar' => '⥗', + 'DownTee' => '⊤', + 'DownTeeArrow' => '↧', + 'drbkarow' => '⤐', + 'drcorn' => '⌟', + 'drcrop' => '⌌', + 'Dscr' => '𝒟', + 'dscr' => '𝒹', + 'DScy' => 'Ѕ', + 'dscy' => 'ѕ', + 'dsol' => '⧶', + 'Dstrok' => 'Đ', + 'dstrok' => 'đ', + 'dtdot' => '⋱', + 'dtri' => '▿', + 'dtrif' => '▾', + 'duarr' => '⇵', + 'duhar' => '⥯', + 'dwangle' => '⦦', + 'DZcy' => 'Џ', + 'dzcy' => 'џ', + 'dzigrarr' => '⟿', + 'Eacute' => 'É', + 'Eacut' => 'É', + 'eacute' => 'é', + 'eacut' => 'é', + 'easter' => '⩮', + 'Ecaron' => 'Ě', + 'ecaron' => 'ě', + 'ecir' => 'ê', + 'Ecirc' => 'Ê', + 'Ecir' => 'Ê', + 'ecirc' => 'ê', + 'ecolon' => '≕', + 'Ecy' => 'Э', + 'ecy' => 'э', + 'eDDot' => '⩷', + 'Edot' => 'Ė', + 'eDot' => '≑', + 'edot' => 'ė', + 'ee' => 'ⅇ', + 'efDot' => '≒', + 'Efr' => '𝔈', + 'efr' => '𝔢', + 'eg' => '⪚', + 'Egrave' => 'È', + 'Egrav' => 'È', + 'egrave' => 'è', + 'egrav' => 'è', + 'egs' => '⪖', + 'egsdot' => '⪘', + 'el' => '⪙', + 'Element' => '∈', + 'elinters' => '⏧', + 'ell' => 'ℓ', + 'els' => '⪕', + 'elsdot' => '⪗', + 'Emacr' => 'Ē', + 'emacr' => 'ē', + 'empty' => '∅', + 'emptyset' => '∅', + 'EmptySmallSquare' => '◻', + 'emptyv' => '∅', + 'EmptyVerySmallSquare' => '▫', + 'emsp' => ' ', + 'emsp13' => ' ', + 'emsp14' => ' ', + 'ENG' => 'Ŋ', + 'eng' => 'ŋ', + 'ensp' => ' ', + 'Eogon' => 'Ę', + 'eogon' => 'ę', + 'Eopf' => '𝔼', + 'eopf' => '𝕖', + 'epar' => '⋕', + 'eparsl' => '⧣', + 'eplus' => '⩱', + 'epsi' => 'ε', + 'Epsilon' => 'Ε', + 'epsilon' => 'ε', + 'epsiv' => 'ϵ', + 'eqcirc' => '≖', + 'eqcolon' => '≕', + 'eqsim' => '≂', + 'eqslantgtr' => '⪖', + 'eqslantless' => '⪕', + 'Equal' => '⩵', + 'equals' => '=', + 'EqualTilde' => '≂', + 'equest' => '≟', + 'Equilibrium' => '⇌', + 'equiv' => '≡', + 'equivDD' => '⩸', + 'eqvparsl' => '⧥', + 'erarr' => '⥱', + 'erDot' => '≓', + 'Escr' => 'ℰ', + 'escr' => 'ℯ', + 'esdot' => '≐', + 'Esim' => '⩳', + 'esim' => '≂', + 'Eta' => 'Η', + 'eta' => 'η', + 'ETH' => 'Ð', + 'ET' => 'Ð', + 'eth' => 'ð', + 'et' => 'ð', + 'Euml' => 'Ë', + 'Eum' => 'Ë', + 'euml' => 'ë', + 'eum' => 'ë', + 'euro' => '€', + 'excl' => '!', + 'exist' => '∃', + 'Exists' => '∃', + 'expectation' => 'ℰ', + 'ExponentialE' => 'ⅇ', + 'exponentiale' => 'ⅇ', + 'fallingdotseq' => '≒', + 'Fcy' => 'Ф', + 'fcy' => 'ф', + 'female' => '♀', + 'ffilig' => 'ffi', + 'fflig' => 'ff', + 'ffllig' => 'ffl', + 'Ffr' => '𝔉', + 'ffr' => '𝔣', + 'filig' => 'fi', + 'FilledSmallSquare' => '◼', + 'FilledVerySmallSquare' => '▪', + 'fjlig' => 'fj', + 'flat' => '♭', + 'fllig' => 'fl', + 'fltns' => '▱', + 'fnof' => 'ƒ', + 'Fopf' => '𝔽', + 'fopf' => '𝕗', + 'ForAll' => '∀', + 'forall' => '∀', + 'fork' => '⋔', + 'forkv' => '⫙', + 'Fouriertrf' => 'ℱ', + 'fpartint' => '⨍', + 'frac12' => '½', + 'frac1' => '¼', + 'frac13' => '⅓', + 'frac14' => '¼', + 'frac15' => '⅕', + 'frac16' => '⅙', + 'frac18' => '⅛', + 'frac23' => '⅔', + 'frac25' => '⅖', + 'frac34' => '¾', + 'frac3' => '¾', + 'frac35' => '⅗', + 'frac38' => '⅜', + 'frac45' => '⅘', + 'frac56' => '⅚', + 'frac58' => '⅝', + 'frac78' => '⅞', + 'frasl' => '⁄', + 'frown' => '⌢', + 'Fscr' => 'ℱ', + 'fscr' => '𝒻', + 'gacute' => 'ǵ', + 'Gamma' => 'Γ', + 'gamma' => 'γ', + 'Gammad' => 'Ϝ', + 'gammad' => 'ϝ', + 'gap' => '⪆', + 'Gbreve' => 'Ğ', + 'gbreve' => 'ğ', + 'Gcedil' => 'Ģ', + 'Gcirc' => 'Ĝ', + 'gcirc' => 'ĝ', + 'Gcy' => 'Г', + 'gcy' => 'г', + 'Gdot' => 'Ġ', + 'gdot' => 'ġ', + 'gE' => '≧', + 'ge' => '≥', + 'gEl' => '⪌', + 'gel' => '⋛', + 'geq' => '≥', + 'geqq' => '≧', + 'geqslant' => '⩾', + 'ges' => '⩾', + 'gescc' => '⪩', + 'gesdot' => '⪀', + 'gesdoto' => '⪂', + 'gesdotol' => '⪄', + 'gesl' => '⋛︀', + 'gesles' => '⪔', + 'Gfr' => '𝔊', + 'gfr' => '𝔤', + 'Gg' => '⋙', + 'gg' => '≫', + 'ggg' => '⋙', + 'gimel' => 'ℷ', + 'GJcy' => 'Ѓ', + 'gjcy' => 'ѓ', + 'gl' => '≷', + 'gla' => '⪥', + 'glE' => '⪒', + 'glj' => '⪤', + 'gnap' => '⪊', + 'gnapprox' => '⪊', + 'gnE' => '≩', + 'gne' => '⪈', + 'gneq' => '⪈', + 'gneqq' => '≩', + 'gnsim' => '⋧', + 'Gopf' => '𝔾', + 'gopf' => '𝕘', + 'grave' => '`', + 'GreaterEqual' => '≥', + 'GreaterEqualLess' => '⋛', + 'GreaterFullEqual' => '≧', + 'GreaterGreater' => '⪢', + 'GreaterLess' => '≷', + 'GreaterSlantEqual' => '⩾', + 'GreaterTilde' => '≳', + 'Gscr' => '𝒢', + 'gscr' => 'ℊ', + 'gsim' => '≳', + 'gsime' => '⪎', + 'gsiml' => '⪐', + 'GT' => '>', + 'G' => '>', + 'Gt' => '≫', + 'gt' => '>', + 'g' => '>', + 'gtcc' => '⪧', + 'gtcir' => '⩺', + 'gtdot' => '⋗', + 'gtlPar' => '⦕', + 'gtquest' => '⩼', + 'gtrapprox' => '⪆', + 'gtrarr' => '⥸', + 'gtrdot' => '⋗', + 'gtreqless' => '⋛', + 'gtreqqless' => '⪌', + 'gtrless' => '≷', + 'gtrsim' => '≳', + 'gvertneqq' => '≩︀', + 'gvnE' => '≩︀', + 'Hacek' => 'ˇ', + 'hairsp' => ' ', + 'half' => '½', + 'hamilt' => 'ℋ', + 'HARDcy' => 'Ъ', + 'hardcy' => 'ъ', + 'hArr' => '⇔', + 'harr' => '↔', + 'harrcir' => '⥈', + 'harrw' => '↭', + 'Hat' => '^', + 'hbar' => 'ℏ', + 'Hcirc' => 'Ĥ', + 'hcirc' => 'ĥ', + 'hearts' => '♥', + 'heartsuit' => '♥', + 'hellip' => '…', + 'hercon' => '⊹', + 'Hfr' => 'ℌ', + 'hfr' => '𝔥', + 'HilbertSpace' => 'ℋ', + 'hksearow' => '⤥', + 'hkswarow' => '⤦', + 'hoarr' => '⇿', + 'homtht' => '∻', + 'hookleftarrow' => '↩', + 'hookrightarrow' => '↪', + 'Hopf' => 'ℍ', + 'hopf' => '𝕙', + 'horbar' => '―', + 'HorizontalLine' => '─', + 'Hscr' => 'ℋ', + 'hscr' => '𝒽', + 'hslash' => 'ℏ', + 'Hstrok' => 'Ħ', + 'hstrok' => 'ħ', + 'HumpDownHump' => '≎', + 'HumpEqual' => '≏', + 'hybull' => '⁃', + 'hyphen' => '‐', + 'Iacute' => 'Í', + 'Iacut' => 'Í', + 'iacute' => 'í', + 'iacut' => 'í', + 'ic' => '', + 'Icirc' => 'Î', + 'Icir' => 'Î', + 'icirc' => 'î', + 'icir' => 'î', + 'Icy' => 'И', + 'icy' => 'и', + 'Idot' => 'İ', + 'IEcy' => 'Е', + 'iecy' => 'е', + 'iexcl' => '¡', + 'iexc' => '¡', + 'iff' => '⇔', + 'Ifr' => 'ℑ', + 'ifr' => '𝔦', + 'Igrave' => 'Ì', + 'Igrav' => 'Ì', + 'igrave' => 'ì', + 'igrav' => 'ì', + 'ii' => 'ⅈ', + 'iiiint' => '⨌', + 'iiint' => '∭', + 'iinfin' => '⧜', + 'iiota' => '℩', + 'IJlig' => 'IJ', + 'ijlig' => 'ij', + 'Im' => 'ℑ', + 'Imacr' => 'Ī', + 'imacr' => 'ī', + 'image' => 'ℑ', + 'ImaginaryI' => 'ⅈ', + 'imagline' => 'ℐ', + 'imagpart' => 'ℑ', + 'imath' => 'ı', + 'imof' => '⊷', + 'imped' => 'Ƶ', + 'Implies' => '⇒', + 'in' => '∈', + 'incare' => '℅', + 'infin' => '∞', + 'infintie' => '⧝', + 'inodot' => 'ı', + 'Int' => '∬', + 'int' => '∫', + 'intcal' => '⊺', + 'integers' => 'ℤ', + 'Integral' => '∫', + 'intercal' => '⊺', + 'Intersection' => '⋂', + 'intlarhk' => '⨗', + 'intprod' => '⨼', + 'InvisibleComma' => '', + 'InvisibleTimes' => '', + 'IOcy' => 'Ё', + 'iocy' => 'ё', + 'Iogon' => 'Į', + 'iogon' => 'į', + 'Iopf' => '𝕀', + 'iopf' => '𝕚', + 'Iota' => 'Ι', + 'iota' => 'ι', + 'iprod' => '⨼', + 'iquest' => '¿', + 'iques' => '¿', + 'Iscr' => 'ℐ', + 'iscr' => '𝒾', + 'isin' => '∈', + 'isindot' => '⋵', + 'isinE' => '⋹', + 'isins' => '⋴', + 'isinsv' => '⋳', + 'isinv' => '∈', + 'it' => '', + 'Itilde' => 'Ĩ', + 'itilde' => 'ĩ', + 'Iukcy' => 'І', + 'iukcy' => 'і', + 'Iuml' => 'Ï', + 'Ium' => 'Ï', + 'iuml' => 'ï', + 'ium' => 'ï', + 'Jcirc' => 'Ĵ', + 'jcirc' => 'ĵ', + 'Jcy' => 'Й', + 'jcy' => 'й', + 'Jfr' => '𝔍', + 'jfr' => '𝔧', + 'jmath' => 'ȷ', + 'Jopf' => '𝕁', + 'jopf' => '𝕛', + 'Jscr' => '𝒥', + 'jscr' => '𝒿', + 'Jsercy' => 'Ј', + 'jsercy' => 'ј', + 'Jukcy' => 'Є', + 'jukcy' => 'є', + 'Kappa' => 'Κ', + 'kappa' => 'κ', + 'kappav' => 'ϰ', + 'Kcedil' => 'Ķ', + 'kcedil' => 'ķ', + 'Kcy' => 'К', + 'kcy' => 'к', + 'Kfr' => '𝔎', + 'kfr' => '𝔨', + 'kgreen' => 'ĸ', + 'KHcy' => 'Х', + 'khcy' => 'х', + 'KJcy' => 'Ќ', + 'kjcy' => 'ќ', + 'Kopf' => '𝕂', + 'kopf' => '𝕜', + 'Kscr' => '𝒦', + 'kscr' => '𝓀', + 'lAarr' => '⇚', + 'Lacute' => 'Ĺ', + 'lacute' => 'ĺ', + 'laemptyv' => '⦴', + 'lagran' => 'ℒ', + 'Lambda' => 'Λ', + 'lambda' => 'λ', + 'Lang' => '⟪', + 'lang' => '⟨', + 'langd' => '⦑', + 'langle' => '⟨', + 'lap' => '⪅', + 'Laplacetrf' => 'ℒ', + 'laquo' => '«', + 'laqu' => '«', + 'Larr' => '↞', + 'lArr' => '⇐', + 'larr' => '←', + 'larrb' => '⇤', + 'larrbfs' => '⤟', + 'larrfs' => '⤝', + 'larrhk' => '↩', + 'larrlp' => '↫', + 'larrpl' => '⤹', + 'larrsim' => '⥳', + 'larrtl' => '↢', + 'lat' => '⪫', + 'lAtail' => '⤛', + 'latail' => '⤙', + 'late' => '⪭', + 'lates' => '⪭︀', + 'lBarr' => '⤎', + 'lbarr' => '⤌', + 'lbbrk' => '❲', + 'lbrace' => '{', + 'lbrack' => '[', + 'lbrke' => '⦋', + 'lbrksld' => '⦏', + 'lbrkslu' => '⦍', + 'Lcaron' => 'Ľ', + 'lcaron' => 'ľ', + 'Lcedil' => 'Ļ', + 'lcedil' => 'ļ', + 'lceil' => '⌈', + 'lcub' => '{', + 'Lcy' => 'Л', + 'lcy' => 'л', + 'ldca' => '⤶', + 'ldquo' => '“', + 'ldquor' => '„', + 'ldrdhar' => '⥧', + 'ldrushar' => '⥋', + 'ldsh' => '↲', + 'lE' => '≦', + 'le' => '≤', + 'LeftAngleBracket' => '⟨', + 'LeftArrow' => '←', + 'Leftarrow' => '⇐', + 'leftarrow' => '←', + 'LeftArrowBar' => '⇤', + 'LeftArrowRightArrow' => '⇆', + 'leftarrowtail' => '↢', + 'LeftCeiling' => '⌈', + 'LeftDoubleBracket' => '⟦', + 'LeftDownTeeVector' => '⥡', + 'LeftDownVector' => '⇃', + 'LeftDownVectorBar' => '⥙', + 'LeftFloor' => '⌊', + 'leftharpoondown' => '↽', + 'leftharpoonup' => '↼', + 'leftleftarrows' => '⇇', + 'LeftRightArrow' => '↔', + 'Leftrightarrow' => '⇔', + 'leftrightarrow' => '↔', + 'leftrightarrows' => '⇆', + 'leftrightharpoons' => '⇋', + 'leftrightsquigarrow' => '↭', + 'LeftRightVector' => '⥎', + 'LeftTee' => '⊣', + 'LeftTeeArrow' => '↤', + 'LeftTeeVector' => '⥚', + 'leftthreetimes' => '⋋', + 'LeftTriangle' => '⊲', + 'LeftTriangleBar' => '⧏', + 'LeftTriangleEqual' => '⊴', + 'LeftUpDownVector' => '⥑', + 'LeftUpTeeVector' => '⥠', + 'LeftUpVector' => '↿', + 'LeftUpVectorBar' => '⥘', + 'LeftVector' => '↼', + 'LeftVectorBar' => '⥒', + 'lEg' => '⪋', + 'leg' => '⋚', + 'leq' => '≤', + 'leqq' => '≦', + 'leqslant' => '⩽', + 'les' => '⩽', + 'lescc' => '⪨', + 'lesdot' => '⩿', + 'lesdoto' => '⪁', + 'lesdotor' => '⪃', + 'lesg' => '⋚︀', + 'lesges' => '⪓', + 'lessapprox' => '⪅', + 'lessdot' => '⋖', + 'lesseqgtr' => '⋚', + 'lesseqqgtr' => '⪋', + 'LessEqualGreater' => '⋚', + 'LessFullEqual' => '≦', + 'LessGreater' => '≶', + 'lessgtr' => '≶', + 'LessLess' => '⪡', + 'lesssim' => '≲', + 'LessSlantEqual' => '⩽', + 'LessTilde' => '≲', + 'lfisht' => '⥼', + 'lfloor' => '⌊', + 'Lfr' => '𝔏', + 'lfr' => '𝔩', + 'lg' => '≶', + 'lgE' => '⪑', + 'lHar' => '⥢', + 'lhard' => '↽', + 'lharu' => '↼', + 'lharul' => '⥪', + 'lhblk' => '▄', + 'LJcy' => 'Љ', + 'ljcy' => 'љ', + 'Ll' => '⋘', + 'll' => '≪', + 'llarr' => '⇇', + 'llcorner' => '⌞', + 'Lleftarrow' => '⇚', + 'llhard' => '⥫', + 'lltri' => '◺', + 'Lmidot' => 'Ŀ', + 'lmidot' => 'ŀ', + 'lmoust' => '⎰', + 'lmoustache' => '⎰', + 'lnap' => '⪉', + 'lnapprox' => '⪉', + 'lnE' => '≨', + 'lne' => '⪇', + 'lneq' => '⪇', + 'lneqq' => '≨', + 'lnsim' => '⋦', + 'loang' => '⟬', + 'loarr' => '⇽', + 'lobrk' => '⟦', + 'LongLeftArrow' => '⟵', + 'Longleftarrow' => '⟸', + 'longleftarrow' => '⟵', + 'LongLeftRightArrow' => '⟷', + 'Longleftrightarrow' => '⟺', + 'longleftrightarrow' => '⟷', + 'longmapsto' => '⟼', + 'LongRightArrow' => '⟶', + 'Longrightarrow' => '⟹', + 'longrightarrow' => '⟶', + 'looparrowleft' => '↫', + 'looparrowright' => '↬', + 'lopar' => '⦅', + 'Lopf' => '𝕃', + 'lopf' => '𝕝', + 'loplus' => '⨭', + 'lotimes' => '⨴', + 'lowast' => '∗', + 'lowbar' => '_', + 'LowerLeftArrow' => '↙', + 'LowerRightArrow' => '↘', + 'loz' => '◊', + 'lozenge' => '◊', + 'lozf' => '⧫', + 'lpar' => '(', + 'lparlt' => '⦓', + 'lrarr' => '⇆', + 'lrcorner' => '⌟', + 'lrhar' => '⇋', + 'lrhard' => '⥭', + 'lrm' => '', + 'lrtri' => '⊿', + 'lsaquo' => '‹', + 'Lscr' => 'ℒ', + 'lscr' => '𝓁', + 'Lsh' => '↰', + 'lsh' => '↰', + 'lsim' => '≲', + 'lsime' => '⪍', + 'lsimg' => '⪏', + 'lsqb' => '[', + 'lsquo' => '‘', + 'lsquor' => '‚', + 'Lstrok' => 'Ł', + 'lstrok' => 'ł', + 'LT' => '<', + 'L' => '<', + 'Lt' => '≪', + 'lt' => '<', + 'l' => '<', + 'ltcc' => '⪦', + 'ltcir' => '⩹', + 'ltdot' => '⋖', + 'lthree' => '⋋', + 'ltimes' => '⋉', + 'ltlarr' => '⥶', + 'ltquest' => '⩻', + 'ltri' => '◃', + 'ltrie' => '⊴', + 'ltrif' => '◂', + 'ltrPar' => '⦖', + 'lurdshar' => '⥊', + 'luruhar' => '⥦', + 'lvertneqq' => '≨︀', + 'lvnE' => '≨︀', + 'macr' => '¯', + 'mac' => '¯', + 'male' => '♂', + 'malt' => '✠', + 'maltese' => '✠', + 'Map' => '⤅', + 'map' => '↦', + 'mapsto' => '↦', + 'mapstodown' => '↧', + 'mapstoleft' => '↤', + 'mapstoup' => '↥', + 'marker' => '▮', + 'mcomma' => '⨩', + 'Mcy' => 'М', + 'mcy' => 'м', + 'mdash' => '—', + 'mDDot' => '∺', + 'measuredangle' => '∡', + 'MediumSpace' => ' ', + 'Mellintrf' => 'ℳ', + 'Mfr' => '𝔐', + 'mfr' => '𝔪', + 'mho' => '℧', + 'micro' => 'µ', + 'micr' => 'µ', + 'mid' => '∣', + 'midast' => '*', + 'midcir' => '⫰', + 'middot' => '·', + 'middo' => '·', + 'minus' => '−', + 'minusb' => '⊟', + 'minusd' => '∸', + 'minusdu' => '⨪', + 'MinusPlus' => '∓', + 'mlcp' => '⫛', + 'mldr' => '…', + 'mnplus' => '∓', + 'models' => '⊧', + 'Mopf' => '𝕄', + 'mopf' => '𝕞', + 'mp' => '∓', + 'Mscr' => 'ℳ', + 'mscr' => '𝓂', + 'mstpos' => '∾', + 'Mu' => 'Μ', + 'mu' => 'μ', + 'multimap' => '⊸', + 'mumap' => '⊸', + 'nabla' => '∇', + 'Nacute' => 'Ń', + 'nacute' => 'ń', + 'nang' => '∠⃒', + 'nap' => '≉', + 'napE' => '⩰̸', + 'napid' => '≋̸', + 'napos' => 'ʼn', + 'napprox' => '≉', + 'natur' => '♮', + 'natural' => '♮', + 'naturals' => 'ℕ', + 'nbsp' => ' ', + 'nbs' => ' ', + 'nbump' => '≎̸', + 'nbumpe' => '≏̸', + 'ncap' => '⩃', + 'Ncaron' => 'Ň', + 'ncaron' => 'ň', + 'Ncedil' => 'Ņ', + 'ncedil' => 'ņ', + 'ncong' => '≇', + 'ncongdot' => '⩭̸', + 'ncup' => '⩂', + 'Ncy' => 'Н', + 'ncy' => 'н', + 'ndash' => '–', + 'ne' => '≠', + 'nearhk' => '⤤', + 'neArr' => '⇗', + 'nearr' => '↗', + 'nearrow' => '↗', + 'nedot' => '≐̸', + 'NegativeMediumSpace' => '', + 'NegativeThickSpace' => '', + 'NegativeThinSpace' => '', + 'NegativeVeryThinSpace' => '', + 'nequiv' => '≢', + 'nesear' => '⤨', + 'nesim' => '≂̸', + 'NestedGreaterGreater' => '≫', + 'NestedLessLess' => '≪', + 'NewLine' => ' +', + 'nexist' => '∄', + 'nexists' => '∄', + 'Nfr' => '𝔑', + 'nfr' => '𝔫', + 'ngE' => '≧̸', + 'nge' => '≱', + 'ngeq' => '≱', + 'ngeqq' => '≧̸', + 'ngeqslant' => '⩾̸', + 'nges' => '⩾̸', + 'nGg' => '⋙̸', + 'ngsim' => '≵', + 'nGt' => '≫⃒', + 'ngt' => '≯', + 'ngtr' => '≯', + 'nGtv' => '≫̸', + 'nhArr' => '⇎', + 'nharr' => '↮', + 'nhpar' => '⫲', + 'ni' => '∋', + 'nis' => '⋼', + 'nisd' => '⋺', + 'niv' => '∋', + 'NJcy' => 'Њ', + 'njcy' => 'њ', + 'nlArr' => '⇍', + 'nlarr' => '↚', + 'nldr' => '‥', + 'nlE' => '≦̸', + 'nle' => '≰', + 'nLeftarrow' => '⇍', + 'nleftarrow' => '↚', + 'nLeftrightarrow' => '⇎', + 'nleftrightarrow' => '↮', + 'nleq' => '≰', + 'nleqq' => '≦̸', + 'nleqslant' => '⩽̸', + 'nles' => '⩽̸', + 'nless' => '≮', + 'nLl' => '⋘̸', + 'nlsim' => '≴', + 'nLt' => '≪⃒', + 'nlt' => '≮', + 'nltri' => '⋪', + 'nltrie' => '⋬', + 'nLtv' => '≪̸', + 'nmid' => '∤', + 'NoBreak' => '', + 'NonBreakingSpace' => ' ', + 'Nopf' => 'ℕ', + 'nopf' => '𝕟', + 'Not' => '⫬', + 'not' => '¬', + 'no' => '¬', + 'NotCongruent' => '≢', + 'NotCupCap' => '≭', + 'NotDoubleVerticalBar' => '∦', + 'NotElement' => '∉', + 'NotEqual' => '≠', + 'NotEqualTilde' => '≂̸', + 'NotExists' => '∄', + 'NotGreater' => '≯', + 'NotGreaterEqual' => '≱', + 'NotGreaterFullEqual' => '≧̸', + 'NotGreaterGreater' => '≫̸', + 'NotGreaterLess' => '≹', + 'NotGreaterSlantEqual' => '⩾̸', + 'NotGreaterTilde' => '≵', + 'NotHumpDownHump' => '≎̸', + 'NotHumpEqual' => '≏̸', + 'notin' => '∉', + 'notindot' => '⋵̸', + 'notinE' => '⋹̸', + 'notinva' => '∉', + 'notinvb' => '⋷', + 'notinvc' => '⋶', + 'NotLeftTriangle' => '⋪', + 'NotLeftTriangleBar' => '⧏̸', + 'NotLeftTriangleEqual' => '⋬', + 'NotLess' => '≮', + 'NotLessEqual' => '≰', + 'NotLessGreater' => '≸', + 'NotLessLess' => '≪̸', + 'NotLessSlantEqual' => '⩽̸', + 'NotLessTilde' => '≴', + 'NotNestedGreaterGreater' => '⪢̸', + 'NotNestedLessLess' => '⪡̸', + 'notni' => '∌', + 'notniva' => '∌', + 'notnivb' => '⋾', + 'notnivc' => '⋽', + 'NotPrecedes' => '⊀', + 'NotPrecedesEqual' => '⪯̸', + 'NotPrecedesSlantEqual' => '⋠', + 'NotReverseElement' => '∌', + 'NotRightTriangle' => '⋫', + 'NotRightTriangleBar' => '⧐̸', + 'NotRightTriangleEqual' => '⋭', + 'NotSquareSubset' => '⊏̸', + 'NotSquareSubsetEqual' => '⋢', + 'NotSquareSuperset' => '⊐̸', + 'NotSquareSupersetEqual' => '⋣', + 'NotSubset' => '⊂⃒', + 'NotSubsetEqual' => '⊈', + 'NotSucceeds' => '⊁', + 'NotSucceedsEqual' => '⪰̸', + 'NotSucceedsSlantEqual' => '⋡', + 'NotSucceedsTilde' => '≿̸', + 'NotSuperset' => '⊃⃒', + 'NotSupersetEqual' => '⊉', + 'NotTilde' => '≁', + 'NotTildeEqual' => '≄', + 'NotTildeFullEqual' => '≇', + 'NotTildeTilde' => '≉', + 'NotVerticalBar' => '∤', + 'npar' => '∦', + 'nparallel' => '∦', + 'nparsl' => '⫽⃥', + 'npart' => '∂̸', + 'npolint' => '⨔', + 'npr' => '⊀', + 'nprcue' => '⋠', + 'npre' => '⪯̸', + 'nprec' => '⊀', + 'npreceq' => '⪯̸', + 'nrArr' => '⇏', + 'nrarr' => '↛', + 'nrarrc' => '⤳̸', + 'nrarrw' => '↝̸', + 'nRightarrow' => '⇏', + 'nrightarrow' => '↛', + 'nrtri' => '⋫', + 'nrtrie' => '⋭', + 'nsc' => '⊁', + 'nsccue' => '⋡', + 'nsce' => '⪰̸', + 'Nscr' => '𝒩', + 'nscr' => '𝓃', + 'nshortmid' => '∤', + 'nshortparallel' => '∦', + 'nsim' => '≁', + 'nsime' => '≄', + 'nsimeq' => '≄', + 'nsmid' => '∤', + 'nspar' => '∦', + 'nsqsube' => '⋢', + 'nsqsupe' => '⋣', + 'nsub' => '⊄', + 'nsubE' => '⫅̸', + 'nsube' => '⊈', + 'nsubset' => '⊂⃒', + 'nsubseteq' => '⊈', + 'nsubseteqq' => '⫅̸', + 'nsucc' => '⊁', + 'nsucceq' => '⪰̸', + 'nsup' => '⊅', + 'nsupE' => '⫆̸', + 'nsupe' => '⊉', + 'nsupset' => '⊃⃒', + 'nsupseteq' => '⊉', + 'nsupseteqq' => '⫆̸', + 'ntgl' => '≹', + 'Ntilde' => 'Ñ', + 'Ntild' => 'Ñ', + 'ntilde' => 'ñ', + 'ntild' => 'ñ', + 'ntlg' => '≸', + 'ntriangleleft' => '⋪', + 'ntrianglelefteq' => '⋬', + 'ntriangleright' => '⋫', + 'ntrianglerighteq' => '⋭', + 'Nu' => 'Ν', + 'nu' => 'ν', + 'num' => '#', + 'numero' => '№', + 'numsp' => ' ', + 'nvap' => '≍⃒', + 'nVDash' => '⊯', + 'nVdash' => '⊮', + 'nvDash' => '⊭', + 'nvdash' => '⊬', + 'nvge' => '≥⃒', + 'nvgt' => '>⃒', + 'nvHarr' => '⤄', + 'nvinfin' => '⧞', + 'nvlArr' => '⤂', + 'nvle' => '≤⃒', + 'nvlt' => '<⃒', + 'nvltrie' => '⊴⃒', + 'nvrArr' => '⤃', + 'nvrtrie' => '⊵⃒', + 'nvsim' => '∼⃒', + 'nwarhk' => '⤣', + 'nwArr' => '⇖', + 'nwarr' => '↖', + 'nwarrow' => '↖', + 'nwnear' => '⤧', + 'Oacute' => 'Ó', + 'Oacut' => 'Ó', + 'oacute' => 'ó', + 'oacut' => 'ó', + 'oast' => '⊛', + 'ocir' => 'ô', + 'Ocirc' => 'Ô', + 'Ocir' => 'Ô', + 'ocirc' => 'ô', + 'Ocy' => 'О', + 'ocy' => 'о', + 'odash' => '⊝', + 'Odblac' => 'Ő', + 'odblac' => 'ő', + 'odiv' => '⨸', + 'odot' => '⊙', + 'odsold' => '⦼', + 'OElig' => 'Œ', + 'oelig' => 'œ', + 'ofcir' => '⦿', + 'Ofr' => '𝔒', + 'ofr' => '𝔬', + 'ogon' => '˛', + 'Ograve' => 'Ò', + 'Ograv' => 'Ò', + 'ograve' => 'ò', + 'ograv' => 'ò', + 'ogt' => '⧁', + 'ohbar' => '⦵', + 'ohm' => 'Ω', + 'oint' => '∮', + 'olarr' => '↺', + 'olcir' => '⦾', + 'olcross' => '⦻', + 'oline' => '‾', + 'olt' => '⧀', + 'Omacr' => 'Ō', + 'omacr' => 'ō', + 'Omega' => 'Ω', + 'omega' => 'ω', + 'Omicron' => 'Ο', + 'omicron' => 'ο', + 'omid' => '⦶', + 'ominus' => '⊖', + 'Oopf' => '𝕆', + 'oopf' => '𝕠', + 'opar' => '⦷', + 'OpenCurlyDoubleQuote' => '“', + 'OpenCurlyQuote' => '‘', + 'operp' => '⦹', + 'oplus' => '⊕', + 'Or' => '⩔', + 'or' => '∨', + 'orarr' => '↻', + 'ord' => 'º', + 'order' => 'ℴ', + 'orderof' => 'ℴ', + 'ordf' => 'ª', + 'ordm' => 'º', + 'origof' => '⊶', + 'oror' => '⩖', + 'orslope' => '⩗', + 'orv' => '⩛', + 'oS' => 'Ⓢ', + 'Oscr' => '𝒪', + 'oscr' => 'ℴ', + 'Oslash' => 'Ø', + 'Oslas' => 'Ø', + 'oslash' => 'ø', + 'oslas' => 'ø', + 'osol' => '⊘', + 'Otilde' => 'Õ', + 'Otild' => 'Õ', + 'otilde' => 'õ', + 'otild' => 'õ', + 'Otimes' => '⨷', + 'otimes' => '⊗', + 'otimesas' => '⨶', + 'Ouml' => 'Ö', + 'Oum' => 'Ö', + 'ouml' => 'ö', + 'oum' => 'ö', + 'ovbar' => '⌽', + 'OverBar' => '‾', + 'OverBrace' => '⏞', + 'OverBracket' => '⎴', + 'OverParenthesis' => '⏜', + 'par' => '¶', + 'para' => '¶', + 'parallel' => '∥', + 'parsim' => '⫳', + 'parsl' => '⫽', + 'part' => '∂', + 'PartialD' => '∂', + 'Pcy' => 'П', + 'pcy' => 'п', + 'percnt' => '%', + 'period' => '.', + 'permil' => '‰', + 'perp' => '⊥', + 'pertenk' => '‱', + 'Pfr' => '𝔓', + 'pfr' => '𝔭', + 'Phi' => 'Φ', + 'phi' => 'φ', + 'phiv' => 'ϕ', + 'phmmat' => 'ℳ', + 'phone' => '☎', + 'Pi' => 'Π', + 'pi' => 'π', + 'pitchfork' => '⋔', + 'piv' => 'ϖ', + 'planck' => 'ℏ', + 'planckh' => 'ℎ', + 'plankv' => 'ℏ', + 'plus' => '+', + 'plusacir' => '⨣', + 'plusb' => '⊞', + 'pluscir' => '⨢', + 'plusdo' => '∔', + 'plusdu' => '⨥', + 'pluse' => '⩲', + 'PlusMinus' => '±', + 'plusmn' => '±', + 'plusm' => '±', + 'plussim' => '⨦', + 'plustwo' => '⨧', + 'pm' => '±', + 'Poincareplane' => 'ℌ', + 'pointint' => '⨕', + 'Popf' => 'ℙ', + 'popf' => '𝕡', + 'pound' => '£', + 'poun' => '£', + 'Pr' => '⪻', + 'pr' => '≺', + 'prap' => '⪷', + 'prcue' => '≼', + 'prE' => '⪳', + 'pre' => '⪯', + 'prec' => '≺', + 'precapprox' => '⪷', + 'preccurlyeq' => '≼', + 'Precedes' => '≺', + 'PrecedesEqual' => '⪯', + 'PrecedesSlantEqual' => '≼', + 'PrecedesTilde' => '≾', + 'preceq' => '⪯', + 'precnapprox' => '⪹', + 'precneqq' => '⪵', + 'precnsim' => '⋨', + 'precsim' => '≾', + 'Prime' => '″', + 'prime' => '′', + 'primes' => 'ℙ', + 'prnap' => '⪹', + 'prnE' => '⪵', + 'prnsim' => '⋨', + 'prod' => '∏', + 'Product' => '∏', + 'profalar' => '⌮', + 'profline' => '⌒', + 'profsurf' => '⌓', + 'prop' => '∝', + 'Proportion' => '∷', + 'Proportional' => '∝', + 'propto' => '∝', + 'prsim' => '≾', + 'prurel' => '⊰', + 'Pscr' => '𝒫', + 'pscr' => '𝓅', + 'Psi' => 'Ψ', + 'psi' => 'ψ', + 'puncsp' => ' ', + 'Qfr' => '𝔔', + 'qfr' => '𝔮', + 'qint' => '⨌', + 'Qopf' => 'ℚ', + 'qopf' => '𝕢', + 'qprime' => '⁗', + 'Qscr' => '𝒬', + 'qscr' => '𝓆', + 'quaternions' => 'ℍ', + 'quatint' => '⨖', + 'quest' => '?', + 'questeq' => '≟', + 'QUOT' => '"', + 'QUO' => '"', + 'quot' => '"', + 'quo' => '"', + 'rAarr' => '⇛', + 'race' => '∽̱', + 'Racute' => 'Ŕ', + 'racute' => 'ŕ', + 'radic' => '√', + 'raemptyv' => '⦳', + 'Rang' => '⟫', + 'rang' => '⟩', + 'rangd' => '⦒', + 'range' => '⦥', + 'rangle' => '⟩', + 'raquo' => '»', + 'raqu' => '»', + 'Rarr' => '↠', + 'rArr' => '⇒', + 'rarr' => '→', + 'rarrap' => '⥵', + 'rarrb' => '⇥', + 'rarrbfs' => '⤠', + 'rarrc' => '⤳', + 'rarrfs' => '⤞', + 'rarrhk' => '↪', + 'rarrlp' => '↬', + 'rarrpl' => '⥅', + 'rarrsim' => '⥴', + 'Rarrtl' => '⤖', + 'rarrtl' => '↣', + 'rarrw' => '↝', + 'rAtail' => '⤜', + 'ratail' => '⤚', + 'ratio' => '∶', + 'rationals' => 'ℚ', + 'RBarr' => '⤐', + 'rBarr' => '⤏', + 'rbarr' => '⤍', + 'rbbrk' => '❳', + 'rbrace' => '}', + 'rbrack' => ']', + 'rbrke' => '⦌', + 'rbrksld' => '⦎', + 'rbrkslu' => '⦐', + 'Rcaron' => 'Ř', + 'rcaron' => 'ř', + 'Rcedil' => 'Ŗ', + 'rcedil' => 'ŗ', + 'rceil' => '⌉', + 'rcub' => '}', + 'Rcy' => 'Р', + 'rcy' => 'р', + 'rdca' => '⤷', + 'rdldhar' => '⥩', + 'rdquo' => '”', + 'rdquor' => '”', + 'rdsh' => '↳', + 'Re' => 'ℜ', + 'real' => 'ℜ', + 'realine' => 'ℛ', + 'realpart' => 'ℜ', + 'reals' => 'ℝ', + 'rect' => '▭', + 'REG' => '®', + 'RE' => '®', + 'reg' => '®', + 're' => '®', + 'ReverseElement' => '∋', + 'ReverseEquilibrium' => '⇋', + 'ReverseUpEquilibrium' => '⥯', + 'rfisht' => '⥽', + 'rfloor' => '⌋', + 'Rfr' => 'ℜ', + 'rfr' => '𝔯', + 'rHar' => '⥤', + 'rhard' => '⇁', + 'rharu' => '⇀', + 'rharul' => '⥬', + 'Rho' => 'Ρ', + 'rho' => 'ρ', + 'rhov' => 'ϱ', + 'RightAngleBracket' => '⟩', + 'RightArrow' => '→', + 'Rightarrow' => '⇒', + 'rightarrow' => '→', + 'RightArrowBar' => '⇥', + 'RightArrowLeftArrow' => '⇄', + 'rightarrowtail' => '↣', + 'RightCeiling' => '⌉', + 'RightDoubleBracket' => '⟧', + 'RightDownTeeVector' => '⥝', + 'RightDownVector' => '⇂', + 'RightDownVectorBar' => '⥕', + 'RightFloor' => '⌋', + 'rightharpoondown' => '⇁', + 'rightharpoonup' => '⇀', + 'rightleftarrows' => '⇄', + 'rightleftharpoons' => '⇌', + 'rightrightarrows' => '⇉', + 'rightsquigarrow' => '↝', + 'RightTee' => '⊢', + 'RightTeeArrow' => '↦', + 'RightTeeVector' => '⥛', + 'rightthreetimes' => '⋌', + 'RightTriangle' => '⊳', + 'RightTriangleBar' => '⧐', + 'RightTriangleEqual' => '⊵', + 'RightUpDownVector' => '⥏', + 'RightUpTeeVector' => '⥜', + 'RightUpVector' => '↾', + 'RightUpVectorBar' => '⥔', + 'RightVector' => '⇀', + 'RightVectorBar' => '⥓', + 'ring' => '˚', + 'risingdotseq' => '≓', + 'rlarr' => '⇄', + 'rlhar' => '⇌', + 'rlm' => '', + 'rmoust' => '⎱', + 'rmoustache' => '⎱', + 'rnmid' => '⫮', + 'roang' => '⟭', + 'roarr' => '⇾', + 'robrk' => '⟧', + 'ropar' => '⦆', + 'Ropf' => 'ℝ', + 'ropf' => '𝕣', + 'roplus' => '⨮', + 'rotimes' => '⨵', + 'RoundImplies' => '⥰', + 'rpar' => ')', + 'rpargt' => '⦔', + 'rppolint' => '⨒', + 'rrarr' => '⇉', + 'Rrightarrow' => '⇛', + 'rsaquo' => '›', + 'Rscr' => 'ℛ', + 'rscr' => '𝓇', + 'Rsh' => '↱', + 'rsh' => '↱', + 'rsqb' => ']', + 'rsquo' => '’', + 'rsquor' => '’', + 'rthree' => '⋌', + 'rtimes' => '⋊', + 'rtri' => '▹', + 'rtrie' => '⊵', + 'rtrif' => '▸', + 'rtriltri' => '⧎', + 'RuleDelayed' => '⧴', + 'ruluhar' => '⥨', + 'rx' => '℞', + 'Sacute' => 'Ś', + 'sacute' => 'ś', + 'sbquo' => '‚', + 'Sc' => '⪼', + 'sc' => '≻', + 'scap' => '⪸', + 'Scaron' => 'Š', + 'scaron' => 'š', + 'sccue' => '≽', + 'scE' => '⪴', + 'sce' => '⪰', + 'Scedil' => 'Ş', + 'scedil' => 'ş', + 'Scirc' => 'Ŝ', + 'scirc' => 'ŝ', + 'scnap' => '⪺', + 'scnE' => '⪶', + 'scnsim' => '⋩', + 'scpolint' => '⨓', + 'scsim' => '≿', + 'Scy' => 'С', + 'scy' => 'с', + 'sdot' => '⋅', + 'sdotb' => '⊡', + 'sdote' => '⩦', + 'searhk' => '⤥', + 'seArr' => '⇘', + 'searr' => '↘', + 'searrow' => '↘', + 'sect' => '§', + 'sec' => '§', + 'semi' => ';', + 'seswar' => '⤩', + 'setminus' => '∖', + 'setmn' => '∖', + 'sext' => '✶', + 'Sfr' => '𝔖', + 'sfr' => '𝔰', + 'sfrown' => '⌢', + 'sharp' => '♯', + 'SHCHcy' => 'Щ', + 'shchcy' => 'щ', + 'SHcy' => 'Ш', + 'shcy' => 'ш', + 'ShortDownArrow' => '↓', + 'ShortLeftArrow' => '←', + 'shortmid' => '∣', + 'shortparallel' => '∥', + 'ShortRightArrow' => '→', + 'ShortUpArrow' => '↑', + 'shy' => '', + 'sh' => '', + 'Sigma' => 'Σ', + 'sigma' => 'σ', + 'sigmaf' => 'ς', + 'sigmav' => 'ς', + 'sim' => '∼', + 'simdot' => '⩪', + 'sime' => '≃', + 'simeq' => '≃', + 'simg' => '⪞', + 'simgE' => '⪠', + 'siml' => '⪝', + 'simlE' => '⪟', + 'simne' => '≆', + 'simplus' => '⨤', + 'simrarr' => '⥲', + 'slarr' => '←', + 'SmallCircle' => '∘', + 'smallsetminus' => '∖', + 'smashp' => '⨳', + 'smeparsl' => '⧤', + 'smid' => '∣', + 'smile' => '⌣', + 'smt' => '⪪', + 'smte' => '⪬', + 'smtes' => '⪬︀', + 'SOFTcy' => 'Ь', + 'softcy' => 'ь', + 'sol' => '/', + 'solb' => '⧄', + 'solbar' => '⌿', + 'Sopf' => '𝕊', + 'sopf' => '𝕤', + 'spades' => '♠', + 'spadesuit' => '♠', + 'spar' => '∥', + 'sqcap' => '⊓', + 'sqcaps' => '⊓︀', + 'sqcup' => '⊔', + 'sqcups' => '⊔︀', + 'Sqrt' => '√', + 'sqsub' => '⊏', + 'sqsube' => '⊑', + 'sqsubset' => '⊏', + 'sqsubseteq' => '⊑', + 'sqsup' => '⊐', + 'sqsupe' => '⊒', + 'sqsupset' => '⊐', + 'sqsupseteq' => '⊒', + 'squ' => '□', + 'Square' => '□', + 'square' => '□', + 'SquareIntersection' => '⊓', + 'SquareSubset' => '⊏', + 'SquareSubsetEqual' => '⊑', + 'SquareSuperset' => '⊐', + 'SquareSupersetEqual' => '⊒', + 'SquareUnion' => '⊔', + 'squarf' => '▪', + 'squf' => '▪', + 'srarr' => '→', + 'Sscr' => '𝒮', + 'sscr' => '𝓈', + 'ssetmn' => '∖', + 'ssmile' => '⌣', + 'sstarf' => '⋆', + 'Star' => '⋆', + 'star' => '☆', + 'starf' => '★', + 'straightepsilon' => 'ϵ', + 'straightphi' => 'ϕ', + 'strns' => '¯', + 'Sub' => '⋐', + 'sub' => '⊂', + 'subdot' => '⪽', + 'subE' => '⫅', + 'sube' => '⊆', + 'subedot' => '⫃', + 'submult' => '⫁', + 'subnE' => '⫋', + 'subne' => '⊊', + 'subplus' => '⪿', + 'subrarr' => '⥹', + 'Subset' => '⋐', + 'subset' => '⊂', + 'subseteq' => '⊆', + 'subseteqq' => '⫅', + 'SubsetEqual' => '⊆', + 'subsetneq' => '⊊', + 'subsetneqq' => '⫋', + 'subsim' => '⫇', + 'subsub' => '⫕', + 'subsup' => '⫓', + 'succ' => '≻', + 'succapprox' => '⪸', + 'succcurlyeq' => '≽', + 'Succeeds' => '≻', + 'SucceedsEqual' => '⪰', + 'SucceedsSlantEqual' => '≽', + 'SucceedsTilde' => '≿', + 'succeq' => '⪰', + 'succnapprox' => '⪺', + 'succneqq' => '⪶', + 'succnsim' => '⋩', + 'succsim' => '≿', + 'SuchThat' => '∋', + 'Sum' => '∑', + 'sum' => '∑', + 'sung' => '♪', + 'Sup' => '⋑', + 'sup' => '³', + 'sup1' => '¹', + 'sup2' => '²', + 'sup3' => '³', + 'supdot' => '⪾', + 'supdsub' => '⫘', + 'supE' => '⫆', + 'supe' => '⊇', + 'supedot' => '⫄', + 'Superset' => '⊃', + 'SupersetEqual' => '⊇', + 'suphsol' => '⟉', + 'suphsub' => '⫗', + 'suplarr' => '⥻', + 'supmult' => '⫂', + 'supnE' => '⫌', + 'supne' => '⊋', + 'supplus' => '⫀', + 'Supset' => '⋑', + 'supset' => '⊃', + 'supseteq' => '⊇', + 'supseteqq' => '⫆', + 'supsetneq' => '⊋', + 'supsetneqq' => '⫌', + 'supsim' => '⫈', + 'supsub' => '⫔', + 'supsup' => '⫖', + 'swarhk' => '⤦', + 'swArr' => '⇙', + 'swarr' => '↙', + 'swarrow' => '↙', + 'swnwar' => '⤪', + 'szlig' => 'ß', + 'szli' => 'ß', + 'Tab' => ' ', + 'target' => '⌖', + 'Tau' => 'Τ', + 'tau' => 'τ', + 'tbrk' => '⎴', + 'Tcaron' => 'Ť', + 'tcaron' => 'ť', + 'Tcedil' => 'Ţ', + 'tcedil' => 'ţ', + 'Tcy' => 'Т', + 'tcy' => 'т', + 'tdot' => '⃛', + 'telrec' => '⌕', + 'Tfr' => '𝔗', + 'tfr' => '𝔱', + 'there4' => '∴', + 'Therefore' => '∴', + 'therefore' => '∴', + 'Theta' => 'Θ', + 'theta' => 'θ', + 'thetasym' => 'ϑ', + 'thetav' => 'ϑ', + 'thickapprox' => '≈', + 'thicksim' => '∼', + 'ThickSpace' => ' ', + 'thinsp' => ' ', + 'ThinSpace' => ' ', + 'thkap' => '≈', + 'thksim' => '∼', + 'THORN' => 'Þ', + 'THOR' => 'Þ', + 'thorn' => 'þ', + 'thor' => 'þ', + 'Tilde' => '∼', + 'tilde' => '˜', + 'TildeEqual' => '≃', + 'TildeFullEqual' => '≅', + 'TildeTilde' => '≈', + 'times' => '×', + 'time' => '×', + 'timesb' => '⊠', + 'timesbar' => '⨱', + 'timesd' => '⨰', + 'tint' => '∭', + 'toea' => '⤨', + 'top' => '⊤', + 'topbot' => '⌶', + 'topcir' => '⫱', + 'Topf' => '𝕋', + 'topf' => '𝕥', + 'topfork' => '⫚', + 'tosa' => '⤩', + 'tprime' => '‴', + 'TRADE' => '™', + 'trade' => '™', + 'triangle' => '▵', + 'triangledown' => '▿', + 'triangleleft' => '◃', + 'trianglelefteq' => '⊴', + 'triangleq' => '≜', + 'triangleright' => '▹', + 'trianglerighteq' => '⊵', + 'tridot' => '◬', + 'trie' => '≜', + 'triminus' => '⨺', + 'TripleDot' => '⃛', + 'triplus' => '⨹', + 'trisb' => '⧍', + 'tritime' => '⨻', + 'trpezium' => '⏢', + 'Tscr' => '𝒯', + 'tscr' => '𝓉', + 'TScy' => 'Ц', + 'tscy' => 'ц', + 'TSHcy' => 'Ћ', + 'tshcy' => 'ћ', + 'Tstrok' => 'Ŧ', + 'tstrok' => 'ŧ', + 'twixt' => '≬', + 'twoheadleftarrow' => '↞', + 'twoheadrightarrow' => '↠', + 'Uacute' => 'Ú', + 'Uacut' => 'Ú', + 'uacute' => 'ú', + 'uacut' => 'ú', + 'Uarr' => '↟', + 'uArr' => '⇑', + 'uarr' => '↑', + 'Uarrocir' => '⥉', + 'Ubrcy' => 'Ў', + 'ubrcy' => 'ў', + 'Ubreve' => 'Ŭ', + 'ubreve' => 'ŭ', + 'Ucirc' => 'Û', + 'Ucir' => 'Û', + 'ucirc' => 'û', + 'ucir' => 'û', + 'Ucy' => 'У', + 'ucy' => 'у', + 'udarr' => '⇅', + 'Udblac' => 'Ű', + 'udblac' => 'ű', + 'udhar' => '⥮', + 'ufisht' => '⥾', + 'Ufr' => '𝔘', + 'ufr' => '𝔲', + 'Ugrave' => 'Ù', + 'Ugrav' => 'Ù', + 'ugrave' => 'ù', + 'ugrav' => 'ù', + 'uHar' => '⥣', + 'uharl' => '↿', + 'uharr' => '↾', + 'uhblk' => '▀', + 'ulcorn' => '⌜', + 'ulcorner' => '⌜', + 'ulcrop' => '⌏', + 'ultri' => '◸', + 'Umacr' => 'Ū', + 'umacr' => 'ū', + 'uml' => '¨', + 'um' => '¨', + 'UnderBar' => '_', + 'UnderBrace' => '⏟', + 'UnderBracket' => '⎵', + 'UnderParenthesis' => '⏝', + 'Union' => '⋃', + 'UnionPlus' => '⊎', + 'Uogon' => 'Ų', + 'uogon' => 'ų', + 'Uopf' => '𝕌', + 'uopf' => '𝕦', + 'UpArrow' => '↑', + 'Uparrow' => '⇑', + 'uparrow' => '↑', + 'UpArrowBar' => '⤒', + 'UpArrowDownArrow' => '⇅', + 'UpDownArrow' => '↕', + 'Updownarrow' => '⇕', + 'updownarrow' => '↕', + 'UpEquilibrium' => '⥮', + 'upharpoonleft' => '↿', + 'upharpoonright' => '↾', + 'uplus' => '⊎', + 'UpperLeftArrow' => '↖', + 'UpperRightArrow' => '↗', + 'Upsi' => 'ϒ', + 'upsi' => 'υ', + 'upsih' => 'ϒ', + 'Upsilon' => 'Υ', + 'upsilon' => 'υ', + 'UpTee' => '⊥', + 'UpTeeArrow' => '↥', + 'upuparrows' => '⇈', + 'urcorn' => '⌝', + 'urcorner' => '⌝', + 'urcrop' => '⌎', + 'Uring' => 'Ů', + 'uring' => 'ů', + 'urtri' => '◹', + 'Uscr' => '𝒰', + 'uscr' => '𝓊', + 'utdot' => '⋰', + 'Utilde' => 'Ũ', + 'utilde' => 'ũ', + 'utri' => '▵', + 'utrif' => '▴', + 'uuarr' => '⇈', + 'Uuml' => 'Ü', + 'Uum' => 'Ü', + 'uuml' => 'ü', + 'uum' => 'ü', + 'uwangle' => '⦧', + 'vangrt' => '⦜', + 'varepsilon' => 'ϵ', + 'varkappa' => 'ϰ', + 'varnothing' => '∅', + 'varphi' => 'ϕ', + 'varpi' => 'ϖ', + 'varpropto' => '∝', + 'vArr' => '⇕', + 'varr' => '↕', + 'varrho' => 'ϱ', + 'varsigma' => 'ς', + 'varsubsetneq' => '⊊︀', + 'varsubsetneqq' => '⫋︀', + 'varsupsetneq' => '⊋︀', + 'varsupsetneqq' => '⫌︀', + 'vartheta' => 'ϑ', + 'vartriangleleft' => '⊲', + 'vartriangleright' => '⊳', + 'Vbar' => '⫫', + 'vBar' => '⫨', + 'vBarv' => '⫩', + 'Vcy' => 'В', + 'vcy' => 'в', + 'VDash' => '⊫', + 'Vdash' => '⊩', + 'vDash' => '⊨', + 'vdash' => '⊢', + 'Vdashl' => '⫦', + 'Vee' => '⋁', + 'vee' => '∨', + 'veebar' => '⊻', + 'veeeq' => '≚', + 'vellip' => '⋮', + 'Verbar' => '‖', + 'verbar' => '|', + 'Vert' => '‖', + 'vert' => '|', + 'VerticalBar' => '∣', + 'VerticalLine' => '|', + 'VerticalSeparator' => '❘', + 'VerticalTilde' => '≀', + 'VeryThinSpace' => ' ', + 'Vfr' => '𝔙', + 'vfr' => '𝔳', + 'vltri' => '⊲', + 'vnsub' => '⊂⃒', + 'vnsup' => '⊃⃒', + 'Vopf' => '𝕍', + 'vopf' => '𝕧', + 'vprop' => '∝', + 'vrtri' => '⊳', + 'Vscr' => '𝒱', + 'vscr' => '𝓋', + 'vsubnE' => '⫋︀', + 'vsubne' => '⊊︀', + 'vsupnE' => '⫌︀', + 'vsupne' => '⊋︀', + 'Vvdash' => '⊪', + 'vzigzag' => '⦚', + 'Wcirc' => 'Ŵ', + 'wcirc' => 'ŵ', + 'wedbar' => '⩟', + 'Wedge' => '⋀', + 'wedge' => '∧', + 'wedgeq' => '≙', + 'weierp' => '℘', + 'Wfr' => '𝔚', + 'wfr' => '𝔴', + 'Wopf' => '𝕎', + 'wopf' => '𝕨', + 'wp' => '℘', + 'wr' => '≀', + 'wreath' => '≀', + 'Wscr' => '𝒲', + 'wscr' => '𝓌', + 'xcap' => '⋂', + 'xcirc' => '◯', + 'xcup' => '⋃', + 'xdtri' => '▽', + 'Xfr' => '𝔛', + 'xfr' => '𝔵', + 'xhArr' => '⟺', + 'xharr' => '⟷', + 'Xi' => 'Ξ', + 'xi' => 'ξ', + 'xlArr' => '⟸', + 'xlarr' => '⟵', + 'xmap' => '⟼', + 'xnis' => '⋻', + 'xodot' => '⨀', + 'Xopf' => '𝕏', + 'xopf' => '𝕩', + 'xoplus' => '⨁', + 'xotime' => '⨂', + 'xrArr' => '⟹', + 'xrarr' => '⟶', + 'Xscr' => '𝒳', + 'xscr' => '𝓍', + 'xsqcup' => '⨆', + 'xuplus' => '⨄', + 'xutri' => '△', + 'xvee' => '⋁', + 'xwedge' => '⋀', + 'Yacute' => 'Ý', + 'Yacut' => 'Ý', + 'yacute' => 'ý', + 'yacut' => 'ý', + 'YAcy' => 'Я', + 'yacy' => 'я', + 'Ycirc' => 'Ŷ', + 'ycirc' => 'ŷ', + 'Ycy' => 'Ы', + 'ycy' => 'ы', + 'yen' => '¥', + 'ye' => '¥', + 'Yfr' => '𝔜', + 'yfr' => '𝔶', + 'YIcy' => 'Ї', + 'yicy' => 'ї', + 'Yopf' => '𝕐', + 'yopf' => '𝕪', + 'Yscr' => '𝒴', + 'yscr' => '𝓎', + 'YUcy' => 'Ю', + 'yucy' => 'ю', + 'Yuml' => 'Ÿ', + 'yuml' => 'ÿ', + 'yum' => 'ÿ', + 'Zacute' => 'Ź', + 'zacute' => 'ź', + 'Zcaron' => 'Ž', + 'zcaron' => 'ž', + 'Zcy' => 'З', + 'zcy' => 'з', + 'Zdot' => 'Ż', + 'zdot' => 'ż', + 'zeetrf' => 'ℨ', + 'ZeroWidthSpace' => '', + 'Zeta' => 'Ζ', + 'zeta' => 'ζ', + 'Zfr' => 'ℨ', + 'zfr' => '𝔷', + 'ZHcy' => 'Ж', + 'zhcy' => 'ж', + 'zigrarr' => '⇝', + 'Zopf' => 'ℤ', + 'zopf' => '𝕫', + 'Zscr' => '𝒵', + 'zscr' => '𝓏', + 'zwj' => '', + 'zwnj' => '', + ); +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Exception.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Exception.php new file mode 100644 index 000000000..64e97e6ff --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Exception.php @@ -0,0 +1,10 @@ +<?php + +namespace Masterminds\HTML5; + +/** + * The base exception for the HTML5 project. + */ +class Exception extends \Exception +{ +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/InstructionProcessor.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/InstructionProcessor.php new file mode 100644 index 000000000..33a73fcfb --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/InstructionProcessor.php @@ -0,0 +1,41 @@ +<?php +/** + * A handler for processor instructions. + */ + +namespace Masterminds\HTML5; + +/** + * Provide an processor to handle embedded instructions. + * + * XML defines a mechanism for inserting instructions (like PHP) into a + * document. These are called "Processor Instructions." The HTML5 parser + * provides an opportunity to handle these processor instructions during + * the tree-building phase (before the DOM is constructed), which makes + * it possible to alter the document as it is being created. + * + * One could, for example, use this mechanism to execute well-formed PHP + * code embedded inside of an HTML5 document. + */ +interface InstructionProcessor +{ + /** + * Process an individual processing instruction. + * + * The process() function is responsible for doing the following: + * - Determining whether $name is an instruction type it can handle. + * - Determining what to do with the data passed in. + * - Making any subsequent modifications to the DOM by modifying the + * DOMElement or its attached DOM tree. + * + * @param \DOMElement $element The parent element for the current processing instruction. + * @param string $name The instruction's name. E.g. `<?php` has the name `php`. + * @param string $data All of the data between the opening and closing PI marks. + * + * @return \DOMElement The element that should be considered "Current". This may just be + * the element passed in, but if the processor added more elements, + * it may choose to reset the current element to one of the elements + * it created. (When in doubt, return the element passed in.) + */ + public function process(\DOMElement $element, $name, $data); +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php new file mode 100644 index 000000000..490b5487b --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php @@ -0,0 +1,61 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +use Masterminds\HTML5\Entities; + +/** + * Manage entity references. + * + * This is a simple resolver for HTML5 character reference entitites. See Entities for the list of supported entities. + */ +class CharacterReference +{ + protected static $numeric_mask = array( + 0x0, + 0x2FFFF, + 0, + 0xFFFF, + ); + + /** + * Given a name (e.g. 'amp'), lookup the UTF-8 character ('&'). + * + * @param string $name The name to look up. + * + * @return string The character sequence. In UTF-8 this may be more than one byte. + */ + public static function lookupName($name) + { + // Do we really want to return NULL here? or FFFD + return isset(Entities::$byName[$name]) ? Entities::$byName[$name] : null; + } + + /** + * Given a decimal number, return the UTF-8 character. + * + * @param $int + * + * @return false|string|string[]|null + */ + public static function lookupDecimal($int) + { + $entity = '&#' . $int . ';'; + + // UNTESTED: This may fail on some planes. Couldn't find full documentation + // on the value of the mask array. + return mb_decode_numericentity($entity, static::$numeric_mask, 'utf-8'); + } + + /** + * Given a hexidecimal number, return the UTF-8 character. + * + * @param $hexdec + * + * @return false|string|string[]|null + */ + public static function lookupHex($hexdec) + { + return static::lookupDecimal(hexdec($hexdec)); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php new file mode 100644 index 000000000..293d83e2a --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php @@ -0,0 +1,705 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +use Masterminds\HTML5\Elements; +use Masterminds\HTML5\InstructionProcessor; + +/** + * Create an HTML5 DOM tree from events. + * + * This attempts to create a DOM from events emitted by a parser. This + * attempts (but does not guarantee) to up-convert older HTML documents + * to HTML5. It does this by applying HTML5's rules, but it will not + * change the architecture of the document itself. + * + * Many of the error correction and quirks features suggested in the specification + * are implemented herein; however, not all of them are. Since we do not + * assume a graphical user agent, no presentation-specific logic is conducted + * during tree building. + * + * FIXME: The present tree builder does not exactly follow the state machine rules + * for insert modes as outlined in the HTML5 spec. The processor needs to be + * re-written to accomodate this. See, for example, the Go language HTML5 + * parser. + */ +class DOMTreeBuilder implements EventHandler +{ + /** + * Defined in http://www.w3.org/TR/html51/infrastructure.html#html-namespace-0. + */ + const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml'; + + const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML'; + + const NAMESPACE_SVG = 'http://www.w3.org/2000/svg'; + + const NAMESPACE_XLINK = 'http://www.w3.org/1999/xlink'; + + const NAMESPACE_XML = 'http://www.w3.org/XML/1998/namespace'; + + const NAMESPACE_XMLNS = 'http://www.w3.org/2000/xmlns/'; + + const OPT_DISABLE_HTML_NS = 'disable_html_ns'; + + const OPT_TARGET_DOC = 'target_document'; + + const OPT_IMPLICIT_NS = 'implicit_namespaces'; + + /** + * Holds the HTML5 element names that causes a namespace switch. + * + * @var array + */ + protected $nsRoots = array( + 'html' => self::NAMESPACE_HTML, + 'svg' => self::NAMESPACE_SVG, + 'math' => self::NAMESPACE_MATHML, + ); + + /** + * Holds the always available namespaces (which does not require the XMLNS declaration). + * + * @var array + */ + protected $implicitNamespaces = array( + 'xml' => self::NAMESPACE_XML, + 'xmlns' => self::NAMESPACE_XMLNS, + 'xlink' => self::NAMESPACE_XLINK, + ); + + /** + * Holds a stack of currently active namespaces. + * + * @var array + */ + protected $nsStack = array(); + + /** + * Holds the number of namespaces declared by a node. + * + * @var array + */ + protected $pushes = array(); + + /** + * Defined in 8.2.5. + */ + const IM_INITIAL = 0; + + const IM_BEFORE_HTML = 1; + + const IM_BEFORE_HEAD = 2; + + const IM_IN_HEAD = 3; + + const IM_IN_HEAD_NOSCRIPT = 4; + + const IM_AFTER_HEAD = 5; + + const IM_IN_BODY = 6; + + const IM_TEXT = 7; + + const IM_IN_TABLE = 8; + + const IM_IN_TABLE_TEXT = 9; + + const IM_IN_CAPTION = 10; + + const IM_IN_COLUMN_GROUP = 11; + + const IM_IN_TABLE_BODY = 12; + + const IM_IN_ROW = 13; + + const IM_IN_CELL = 14; + + const IM_IN_SELECT = 15; + + const IM_IN_SELECT_IN_TABLE = 16; + + const IM_AFTER_BODY = 17; + + const IM_IN_FRAMESET = 18; + + const IM_AFTER_FRAMESET = 19; + + const IM_AFTER_AFTER_BODY = 20; + + const IM_AFTER_AFTER_FRAMESET = 21; + + const IM_IN_SVG = 22; + + const IM_IN_MATHML = 23; + + protected $options = array(); + + protected $stack = array(); + + protected $current; // Pointer in the tag hierarchy. + protected $rules; + protected $doc; + + protected $frag; + + protected $processor; + + protected $insertMode = 0; + + /** + * Track if we are in an element that allows only inline child nodes. + * + * @var string|null + */ + protected $onlyInline; + + /** + * Quirks mode is enabled by default. + * Any document that is missing the DT will be considered to be in quirks mode. + */ + protected $quirks = true; + + protected $errors = array(); + + public function __construct($isFragment = false, array $options = array()) + { + $this->options = $options; + + if (isset($options[self::OPT_TARGET_DOC])) { + $this->doc = $options[self::OPT_TARGET_DOC]; + } else { + $impl = new \DOMImplementation(); + // XXX: + // Create the doctype. For now, we are always creating HTML5 + // documents, and attempting to up-convert any older DTDs to HTML5. + $dt = $impl->createDocumentType('html'); + // $this->doc = \DOMImplementation::createDocument(NULL, 'html', $dt); + $this->doc = $impl->createDocument(null, '', $dt); + $this->doc->encoding = !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'; + } + + $this->errors = array(); + + $this->current = $this->doc; // ->documentElement; + + // Create a rules engine for tags. + $this->rules = new TreeBuildingRules(); + + $implicitNS = array(); + if (isset($this->options[self::OPT_IMPLICIT_NS])) { + $implicitNS = $this->options[self::OPT_IMPLICIT_NS]; + } elseif (isset($this->options['implicitNamespaces'])) { + $implicitNS = $this->options['implicitNamespaces']; + } + + // Fill $nsStack with the defalut HTML5 namespaces, plus the "implicitNamespaces" array taken form $options + array_unshift($this->nsStack, $implicitNS + array('' => self::NAMESPACE_HTML) + $this->implicitNamespaces); + + if ($isFragment) { + $this->insertMode = static::IM_IN_BODY; + $this->frag = $this->doc->createDocumentFragment(); + $this->current = $this->frag; + } + } + + /** + * Get the document. + */ + public function document() + { + return $this->doc; + } + + /** + * Get the DOM fragment for the body. + * + * This returns a DOMNodeList because a fragment may have zero or more + * DOMNodes at its root. + * + * @see http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#concept-frag-parse-context + * + * @return \DOMDocumentFragment + */ + public function fragment() + { + return $this->frag; + } + + /** + * Provide an instruction processor. + * + * This is used for handling Processor Instructions as they are + * inserted. If omitted, PI's are inserted directly into the DOM tree. + * + * @param InstructionProcessor $proc + */ + public function setInstructionProcessor(InstructionProcessor $proc) + { + $this->processor = $proc; + } + + public function doctype($name, $idType = 0, $id = null, $quirks = false) + { + // This is used solely for setting quirks mode. Currently we don't + // try to preserve the inbound DT. We convert it to HTML5. + $this->quirks = $quirks; + + if ($this->insertMode > static::IM_INITIAL) { + $this->parseError('Illegal placement of DOCTYPE tag. Ignoring: ' . $name); + + return; + } + + $this->insertMode = static::IM_BEFORE_HTML; + } + + /** + * Process the start tag. + * + * @todo - XMLNS namespace handling (we need to parse, even if it's not valid) + * - XLink, MathML and SVG namespace handling + * - Omission rules: 8.1.2.4 Optional tags + * + * @param string $name + * @param array $attributes + * @param bool $selfClosing + * + * @return int + */ + public function startTag($name, $attributes = array(), $selfClosing = false) + { + $lname = $this->normalizeTagName($name); + + // Make sure we have an html element. + if (!$this->doc->documentElement && 'html' !== $name && !$this->frag) { + $this->startTag('html'); + } + + // Set quirks mode if we're at IM_INITIAL with no doctype. + if ($this->insertMode === static::IM_INITIAL) { + $this->quirks = true; + $this->parseError('No DOCTYPE specified.'); + } + + // SPECIAL TAG HANDLING: + // Spec says do this, and "don't ask." + // find the spec where this is defined... looks problematic + if ('image' === $name && !($this->insertMode === static::IM_IN_SVG || $this->insertMode === static::IM_IN_MATHML)) { + $name = 'img'; + } + + // Autoclose p tags where appropriate. + if ($this->insertMode >= static::IM_IN_BODY && Elements::isA($name, Elements::AUTOCLOSE_P)) { + $this->autoclose('p'); + } + + // Set insert mode: + switch ($name) { + case 'html': + $this->insertMode = static::IM_BEFORE_HEAD; + break; + case 'head': + if ($this->insertMode > static::IM_BEFORE_HEAD) { + $this->parseError('Unexpected head tag outside of head context.'); + } else { + $this->insertMode = static::IM_IN_HEAD; + } + break; + case 'body': + $this->insertMode = static::IM_IN_BODY; + break; + case 'svg': + $this->insertMode = static::IM_IN_SVG; + break; + case 'math': + $this->insertMode = static::IM_IN_MATHML; + break; + case 'noscript': + if ($this->insertMode === static::IM_IN_HEAD) { + $this->insertMode = static::IM_IN_HEAD_NOSCRIPT; + } + break; + } + + // Special case handling for SVG. + if ($this->insertMode === static::IM_IN_SVG) { + $lname = Elements::normalizeSvgElement($lname); + } + + $pushes = 0; + // when we found a tag thats appears inside $nsRoots, we have to switch the defalut namespace + if (isset($this->nsRoots[$lname]) && $this->nsStack[0][''] !== $this->nsRoots[$lname]) { + array_unshift($this->nsStack, array( + '' => $this->nsRoots[$lname], + ) + $this->nsStack[0]); + ++$pushes; + } + $needsWorkaround = false; + if (isset($this->options['xmlNamespaces']) && $this->options['xmlNamespaces']) { + // when xmlNamespaces is true a and we found a 'xmlns' or 'xmlns:*' attribute, we should add a new item to the $nsStack + foreach ($attributes as $aName => $aVal) { + if ('xmlns' === $aName) { + $needsWorkaround = $aVal; + array_unshift($this->nsStack, array( + '' => $aVal, + ) + $this->nsStack[0]); + ++$pushes; + } elseif ('xmlns' === (($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : '')) { + array_unshift($this->nsStack, array( + substr($aName, $pos + 1) => $aVal, + ) + $this->nsStack[0]); + ++$pushes; + } + } + } + + if ($this->onlyInline && Elements::isA($lname, Elements::BLOCK_TAG)) { + $this->autoclose($this->onlyInline); + $this->onlyInline = null; + } + + try { + $prefix = ($pos = strpos($lname, ':')) ? substr($lname, 0, $pos) : ''; + + if (false !== $needsWorkaround) { + $xml = "<$lname xmlns=\"$needsWorkaround\" " . (strlen($prefix) && isset($this->nsStack[0][$prefix]) ? ("xmlns:$prefix=\"" . $this->nsStack[0][$prefix] . '"') : '') . '/>'; + + $frag = new \DOMDocument('1.0', 'UTF-8'); + $frag->loadXML($xml); + + $ele = $this->doc->importNode($frag->documentElement, true); + } else { + if (!isset($this->nsStack[0][$prefix]) || ('' === $prefix && isset($this->options[self::OPT_DISABLE_HTML_NS]) && $this->options[self::OPT_DISABLE_HTML_NS])) { + $ele = $this->doc->createElement($lname); + } else { + $ele = $this->doc->createElementNS($this->nsStack[0][$prefix], $lname); + } + } + } catch (\DOMException $e) { + $this->parseError("Illegal tag name: <$lname>. Replaced with <invalid>."); + $ele = $this->doc->createElement('invalid'); + } + + if (Elements::isA($lname, Elements::BLOCK_ONLY_INLINE)) { + $this->onlyInline = $lname; + } + + // When we add some namespacess, we have to track them. Later, when "endElement" is invoked, we have to remove them. + // When we are on a void tag, we do not need to care about namesapce nesting. + if ($pushes > 0 && !Elements::isA($name, Elements::VOID_TAG)) { + // PHP tends to free the memory used by DOM, + // to avoid spl_object_hash collisions whe have to avoid garbage collection of $ele storing it into $pushes + // see https://bugs.php.net/bug.php?id=67459 + $this->pushes[spl_object_hash($ele)] = array($pushes, $ele); + } + + foreach ($attributes as $aName => $aVal) { + // xmlns attributes can't be set + if ('xmlns' === $aName) { + continue; + } + + if ($this->insertMode === static::IM_IN_SVG) { + $aName = Elements::normalizeSvgAttribute($aName); + } elseif ($this->insertMode === static::IM_IN_MATHML) { + $aName = Elements::normalizeMathMlAttribute($aName); + } + + $aVal = (string) $aVal; + + try { + $prefix = ($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : false; + + if ('xmlns' === $prefix) { + $ele->setAttributeNS(self::NAMESPACE_XMLNS, $aName, $aVal); + } elseif (false !== $prefix && isset($this->nsStack[0][$prefix])) { + $ele->setAttributeNS($this->nsStack[0][$prefix], $aName, $aVal); + } else { + $ele->setAttribute($aName, $aVal); + } + } catch (\DOMException $e) { + $this->parseError("Illegal attribute name for tag $name. Ignoring: $aName"); + continue; + } + + // This is necessary on a non-DTD schema, like HTML5. + if ('id' === $aName) { + $ele->setIdAttribute('id', true); + } + } + + if ($this->frag !== $this->current && $this->rules->hasRules($name)) { + // Some elements have special processing rules. Handle those separately. + $this->current = $this->rules->evaluate($ele, $this->current); + } else { + // Otherwise, it's a standard element. + $this->current->appendChild($ele); + + if (!Elements::isA($name, Elements::VOID_TAG)) { + $this->current = $ele; + } + + // Self-closing tags should only be respected on foreign elements + // (and are implied on void elements) + // See: https://www.w3.org/TR/html5/syntax.html#start-tags + if (Elements::isHtml5Element($name)) { + $selfClosing = false; + } + } + + // This is sort of a last-ditch attempt to correct for cases where no head/body + // elements are provided. + if ($this->insertMode <= static::IM_BEFORE_HEAD && 'head' !== $name && 'html' !== $name) { + $this->insertMode = static::IM_IN_BODY; + } + + // When we are on a void tag, we do not need to care about namesapce nesting, + // but we have to remove the namespaces pushed to $nsStack. + if ($pushes > 0 && Elements::isA($name, Elements::VOID_TAG)) { + // remove the namespaced definded by current node + for ($i = 0; $i < $pushes; ++$i) { + array_shift($this->nsStack); + } + } + + if ($selfClosing) { + $this->endTag($name); + } + + // Return the element mask, which the tokenizer can then use to set + // various processing rules. + return Elements::element($name); + } + + public function endTag($name) + { + $lname = $this->normalizeTagName($name); + + // Special case within 12.2.6.4.7: An end tag whose tag name is "br" should be treated as an opening tag + if ('br' === $name) { + $this->parseError('Closing tag encountered for void element br.'); + + $this->startTag('br'); + } + // Ignore closing tags for other unary elements. + elseif (Elements::isA($name, Elements::VOID_TAG)) { + return; + } + + if ($this->insertMode <= static::IM_BEFORE_HTML) { + // 8.2.5.4.2 + if (in_array($name, array( + 'html', + 'br', + 'head', + 'title', + ))) { + $this->startTag('html'); + $this->endTag($name); + $this->insertMode = static::IM_BEFORE_HEAD; + + return; + } + + // Ignore the tag. + $this->parseError('Illegal closing tag at global scope.'); + + return; + } + + // Special case handling for SVG. + if ($this->insertMode === static::IM_IN_SVG) { + $lname = Elements::normalizeSvgElement($lname); + } + + $cid = spl_object_hash($this->current); + + // XXX: HTML has no parent. What do we do, though, + // if this element appears in the wrong place? + if ('html' === $lname) { + return; + } + + // remove the namespaced definded by current node + if (isset($this->pushes[$cid])) { + for ($i = 0; $i < $this->pushes[$cid][0]; ++$i) { + array_shift($this->nsStack); + } + unset($this->pushes[$cid]); + } + + if (!$this->autoclose($lname)) { + $this->parseError('Could not find closing tag for ' . $lname); + } + + switch ($lname) { + case 'head': + $this->insertMode = static::IM_AFTER_HEAD; + break; + case 'body': + $this->insertMode = static::IM_AFTER_BODY; + break; + case 'svg': + case 'mathml': + $this->insertMode = static::IM_IN_BODY; + break; + } + } + + public function comment($cdata) + { + // TODO: Need to handle case where comment appears outside of the HTML tag. + $node = $this->doc->createComment($cdata); + $this->current->appendChild($node); + } + + public function text($data) + { + // XXX: Hmmm.... should we really be this strict? + if ($this->insertMode < static::IM_IN_HEAD) { + // Per '8.2.5.4.3 The "before head" insertion mode' the characters + // " \t\n\r\f" should be ignored but no mention of a parse error. This is + // practical as most documents contain these characters. Other text is not + // expected here so recording a parse error is necessary. + $dataTmp = trim($data, " \t\n\r\f"); + if (!empty($dataTmp)) { + // fprintf(STDOUT, "Unexpected insert mode: %d", $this->insertMode); + $this->parseError('Unexpected text. Ignoring: ' . $dataTmp); + } + + return; + } + // fprintf(STDOUT, "Appending text %s.", $data); + $node = $this->doc->createTextNode($data); + $this->current->appendChild($node); + } + + public function eof() + { + // If the $current isn't the $root, do we need to do anything? + } + + public function parseError($msg, $line = 0, $col = 0) + { + $this->errors[] = sprintf('Line %d, Col %d: %s', $line, $col, $msg); + } + + public function getErrors() + { + return $this->errors; + } + + public function cdata($data) + { + $node = $this->doc->createCDATASection($data); + $this->current->appendChild($node); + } + + public function processingInstruction($name, $data = null) + { + // XXX: Ignore initial XML declaration, per the spec. + if ($this->insertMode === static::IM_INITIAL && 'xml' === strtolower($name)) { + return; + } + + // Important: The processor may modify the current DOM tree however it sees fit. + if ($this->processor instanceof InstructionProcessor) { + $res = $this->processor->process($this->current, $name, $data); + if (!empty($res)) { + $this->current = $res; + } + + return; + } + + // Otherwise, this is just a dumb PI element. + $node = $this->doc->createProcessingInstruction($name, $data); + + $this->current->appendChild($node); + } + + // ========================================================================== + // UTILITIES + // ========================================================================== + + /** + * Apply normalization rules to a tag name. + * See sections 2.9 and 8.1.2. + * + * @param string $tagName + * + * @return string The normalized tag name. + */ + protected function normalizeTagName($tagName) + { + /* + * Section 2.9 suggests that we should not do this. if (strpos($name, ':') !== false) { // We know from the grammar that there must be at least one other // char besides :, since : is not a legal tag start. $parts = explode(':', $name); return array_pop($parts); } + */ + return $tagName; + } + + protected function quirksTreeResolver($name) + { + throw new \Exception('Not implemented.'); + } + + /** + * Automatically climb the tree and close the closest node with the matching $tag. + * + * @param string $tagName + * + * @return bool + */ + protected function autoclose($tagName) + { + $working = $this->current; + do { + if (XML_ELEMENT_NODE !== $working->nodeType) { + return false; + } + if ($working->tagName === $tagName) { + $this->current = $working->parentNode; + + return true; + } + } while ($working = $working->parentNode); + + return false; + } + + /** + * Checks if the given tagname is an ancestor of the present candidate. + * + * If $this->current or anything above $this->current matches the given tag + * name, this returns true. + * + * @param string $tagName + * + * @return bool + */ + protected function isAncestor($tagName) + { + $candidate = $this->current; + while (XML_ELEMENT_NODE === $candidate->nodeType) { + if ($candidate->tagName === $tagName) { + return true; + } + $candidate = $candidate->parentNode; + } + + return false; + } + + /** + * Returns true if the immediate parent element is of the given tagname. + * + * @param string $tagName + * + * @return bool + */ + protected function isParent($tagName) + { + return $this->current->tagName === $tagName; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php new file mode 100644 index 000000000..9893a718b --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php @@ -0,0 +1,114 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +/** + * Standard events for HTML5. + * + * This is roughly analogous to a SAX2 or expat-style interface. + * However, it is tuned specifically for HTML5, according to section 8 + * of the HTML5 specification. + * + * An event handler receives parser events. For a concrete + * implementation, see DOMTreeBuilder. + * + * Quirks support in the parser is limited to close-in syntax (malformed + * tags or attributes). Higher order syntax and semantic issues with a + * document (e.g. mismatched tags, illegal nesting, etc.) are the + * responsibility of the event handler implementation. + * + * See HTML5 spec section 8.2.4 + */ +interface EventHandler +{ + const DOCTYPE_NONE = 0; + + const DOCTYPE_PUBLIC = 1; + + const DOCTYPE_SYSTEM = 2; + + /** + * A doctype declaration. + * + * @param string $name The name of the root element. + * @param int $idType One of DOCTYPE_NONE, DOCTYPE_PUBLIC, or DOCTYPE_SYSTEM + * @param string $id The identifier. For DOCTYPE_PUBLIC, this is the public ID. If DOCTYPE_SYSTEM, + * then this is a system ID. + * @param bool $quirks Indicates whether the builder should enter quirks mode. + */ + public function doctype($name, $idType = 0, $id = null, $quirks = false); + + /** + * A start tag. + * + * IMPORTANT: The parser watches the return value of this event. If this returns + * an integer, the parser will switch TEXTMODE patters according to the int. + * + * This is how the Tree Builder can tell the Tokenizer when a certain tag should + * cause the parser to go into RAW text mode. + * + * The HTML5 standard requires that the builder is the one that initiates this + * step, and this is the only way short of a circular reference that we can + * do that. + * + * Example: if a startTag even for a `script` name is fired, and the startTag() + * implementation returns Tokenizer::TEXTMODE_RAW, then the tokenizer will + * switch into RAW text mode and consume data until it reaches a closing + * `script` tag. + * + * The textmode is automatically reset to Tokenizer::TEXTMODE_NORMAL when the + * closing tag is encounter. **This behavior may change.** + * + * @param string $name The tag name. + * @param array $attributes An array with all of the tag's attributes. + * @param bool $selfClosing An indicator of whether or not this tag is self-closing (<foo/>). + * + * @return int one of the Tokenizer::TEXTMODE_* constants + */ + public function startTag($name, $attributes = array(), $selfClosing = false); + + /** + * An end-tag. + */ + public function endTag($name); + + /** + * A comment section (unparsed character data). + */ + public function comment($cdata); + + /** + * A unit of parsed character data. + * + * Entities in this text are *already decoded*. + */ + public function text($cdata); + + /** + * Indicates that the document has been entirely processed. + */ + public function eof(); + + /** + * Emitted when the parser encounters an error condition. + */ + public function parseError($msg, $line, $col); + + /** + * A CDATA section. + * + * @param string $data + * The unparsed character data + */ + public function cdata($data); + + /** + * This is a holdover from the XML spec. + * + * While user agents don't get PIs, server-side does. + * + * @param string $name The name of the processor (e.g. 'php'). + * @param string $data The unparsed data. + */ + public function processingInstruction($name, $data = null); +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php new file mode 100644 index 000000000..b081ed96b --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php @@ -0,0 +1,33 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +/** + * The FileInputStream loads a file to be parsed. + * + * So right now we read files into strings and then process the + * string. We chose to do this largely for the sake of expediency of + * development, and also because we could optimize toward processing + * arbitrarily large chunks of the input. But in the future, we'd + * really like to rewrite this class to efficiently handle lower level + * stream reads (and thus efficiently handle large documents). + * + * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead. + */ +class FileInputStream extends StringInputStream implements InputStream +{ + /** + * Load a file input stream. + * + * @param string $data The file or url path to load. + * @param string $encoding The encoding to use for the data. + * @param string $debug A fprintf format to use to echo the data on stdout. + */ + public function __construct($data, $encoding = 'UTF-8', $debug = '') + { + // Get the contents of the file. + $content = file_get_contents($data); + + parent::__construct($content, $encoding, $debug); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/InputStream.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/InputStream.php new file mode 100644 index 000000000..ff4ef2266 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/InputStream.php @@ -0,0 +1,87 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +/** + * Interface for stream readers. + * + * The parser only reads from streams. Various input sources can write + * an adapater to this InputStream. + * + * Currently provided InputStream implementations include + * FileInputStream and StringInputStream. + * + * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead. + */ +interface InputStream extends \Iterator +{ + /** + * Returns the current line that is being consumed. + * + * TODO: Move this to the scanner. + */ + public function currentLine(); + + /** + * Returns the current column of the current line that the tokenizer is at. + * + * Newlines are column 0. The first char after a newline is column 1. + * + * @TODO Move this to the scanner. + * + * @return int The column number. + */ + public function columnOffset(); + + /** + * Get all characters until EOF. + * + * This consumes characters until the EOF. + */ + public function remainingChars(); + + /** + * Read to a particular match (or until $max bytes are consumed). + * + * This operates on byte sequences, not characters. + * + * Matches as far as possible until we reach a certain set of bytes + * and returns the matched substring. + * + * @see strcspn + * + * @param string $bytes Bytes to match. + * @param int $max Maximum number of bytes to scan. + * + * @return mixed Index or false if no match is found. You should use strong + * equality when checking the result, since index could be 0. + */ + public function charsUntil($bytes, $max = null); + + /** + * Returns the string so long as $bytes matches. + * + * Matches as far as possible with a certain set of bytes + * and returns the matched substring. + * + * @see strspn + * + * @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the + * current char, the pointer advances and the char is part of the + * substring. + * @param int $max The max number of chars to read. + */ + public function charsWhile($bytes, $max = null); + + /** + * Unconsume one character. + * + * @param int $howMany The number of characters to move the pointer back. + */ + public function unconsume($howMany = 1); + + /** + * Retrieve the next character without advancing the pointer. + */ + public function peek(); +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/ParseError.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/ParseError.php new file mode 100644 index 000000000..640e516c8 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/ParseError.php @@ -0,0 +1,10 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +/** + * Emit when the parser has an error. + */ +class ParseError extends \Exception +{ +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/README.md b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/README.md new file mode 100644 index 000000000..9f929570c --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/README.md @@ -0,0 +1,53 @@ +# The Parser Model + +The parser model here follows the model in section +[8.2.1](http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#parsing) +of the HTML5 specification, though we do not assume a networking layer. + + [ InputStream ] // Generic support for reading input. + || + [ Scanner ] // Breaks down the stream into characters. + || + [ Tokenizer ] // Groups characters into syntactic + || + [ Tree Builder ] // Organizes units into a tree of objects + || + [ DOM Document ] // The final state of the parsed document. + + +## InputStream + +This is an interface with at least two concrete implementations: + +- StringInputStream: Reads an HTML5 string. +- FileInputStream: Reads an HTML5 file. + +## Scanner + +This is a mechanical piece of the parser. + +## Tokenizer + +This follows section 8.4 of the HTML5 spec. It is (roughly) a recursive +descent parser. (Though there are plenty of optimizations that are less +than purely functional. + +## EventHandler and DOMTree + +EventHandler is the interface for tree builders. Since not all +implementations will necessarily build trees, we've chosen a more +generic name. + +The event handler emits tokens during tokenization. + +The DOMTree is an event handler that builds a DOM tree. The output of +the DOMTree builder is a DOMDocument. + +## DOMDocument + +PHP has a DOMDocument class built-in (technically, it's part of libxml.) +We use that, thus rendering the output of this process compatible with +SimpleXML, QueryPath, and many other XML/HTML processing tools. + +For cases where the HTML5 is a fragment of a HTML5 document a +DOMDocumentFragment is returned instead. This is another built-in class. diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/Scanner.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/Scanner.php new file mode 100644 index 000000000..1b52983e7 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/Scanner.php @@ -0,0 +1,416 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +use Masterminds\HTML5\Exception; + +/** + * The scanner scans over a given data input to react appropriately to characters. + */ +class Scanner +{ + const CHARS_HEX = 'abcdefABCDEF01234567890'; + const CHARS_ALNUM = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'; + const CHARS_ALPHA = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + /** + * The string data we're parsing. + */ + private $data; + + /** + * The current integer byte position we are in $data. + */ + private $char; + + /** + * Length of $data; when $char === $data, we are at the end-of-file. + */ + private $EOF; + + /** + * Parse errors. + */ + public $errors = array(); + + /** + * Create a new Scanner. + * + * @param string $data Data to parse. + * @param string $encoding The encoding to use for the data. + * + * @throws Exception If the given data cannot be encoded to UTF-8. + */ + public function __construct($data, $encoding = 'UTF-8') + { + if ($data instanceof InputStream) { + @trigger_error('InputStream objects are deprecated since version 2.4 and will be removed in 3.0. Use strings instead.', E_USER_DEPRECATED); + $data = (string) $data; + } + + $data = UTF8Utils::convertToUTF8($data, $encoding); + + // There is good reason to question whether it makes sense to + // do this here, since most of these checks are done during + // parsing, and since this check doesn't actually *do* anything. + $this->errors = UTF8Utils::checkForIllegalCodepoints($data); + + $data = $this->replaceLinefeeds($data); + + $this->data = $data; + $this->char = 0; + $this->EOF = strlen($data); + } + + /** + * Check if upcomming chars match the given sequence. + * + * This will read the stream for the $sequence. If it's + * found, this will return true. If not, return false. + * Since this unconsumes any chars it reads, the caller + * will still need to read the next sequence, even if + * this returns true. + * + * Example: $this->scanner->sequenceMatches('</script>') will + * see if the input stream is at the start of a + * '</script>' string. + * + * @param string $sequence + * @param bool $caseSensitive + * + * @return bool + */ + public function sequenceMatches($sequence, $caseSensitive = true) + { + $portion = substr($this->data, $this->char, strlen($sequence)); + + return $caseSensitive ? $portion === $sequence : 0 === strcasecmp($portion, $sequence); + } + + /** + * Get the current position. + * + * @return int The current intiger byte position. + */ + public function position() + { + return $this->char; + } + + /** + * Take a peek at the next character in the data. + * + * @return string The next character. + */ + public function peek() + { + if (($this->char + 1) <= $this->EOF) { + return $this->data[$this->char + 1]; + } + + return false; + } + + /** + * Get the next character. + * Note: This advances the pointer. + * + * @return string The next character. + */ + public function next() + { + ++$this->char; + + if ($this->char < $this->EOF) { + return $this->data[$this->char]; + } + + return false; + } + + /** + * Get the current character. + * Note, this does not advance the pointer. + * + * @return string The current character. + */ + public function current() + { + if ($this->char < $this->EOF) { + return $this->data[$this->char]; + } + + return false; + } + + /** + * Silently consume N chars. + * + * @param int $count + */ + public function consume($count = 1) + { + $this->char += $count; + } + + /** + * Unconsume some of the data. + * This moves the data pointer backwards. + * + * @param int $howMany The number of characters to move the pointer back. + */ + public function unconsume($howMany = 1) + { + if (($this->char - $howMany) >= 0) { + $this->char -= $howMany; + } + } + + /** + * Get the next group of that contains hex characters. + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string The next group that is hex characters. + */ + public function getHex() + { + return $this->doCharsWhile(static::CHARS_HEX); + } + + /** + * Get the next group of characters that are ASCII Alpha characters. + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string The next group of ASCII alpha characters. + */ + public function getAsciiAlpha() + { + return $this->doCharsWhile(static::CHARS_ALPHA); + } + + /** + * Get the next group of characters that are ASCII Alpha characters and numbers. + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string The next group of ASCII alpha characters and numbers. + */ + public function getAsciiAlphaNum() + { + return $this->doCharsWhile(static::CHARS_ALNUM); + } + + /** + * Get the next group of numbers. + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string The next group of numbers. + */ + public function getNumeric() + { + return $this->doCharsWhile('0123456789'); + } + + /** + * Consume whitespace. + * Whitespace in HTML5 is: formfeed, tab, newline, space. + * + * @return int The length of the matched whitespaces. + */ + public function whitespace() + { + if ($this->char >= $this->EOF) { + return false; + } + + $len = strspn($this->data, "\n\t\f ", $this->char); + + $this->char += $len; + + return $len; + } + + /** + * Returns the current line that is being consumed. + * + * @return int The current line number. + */ + public function currentLine() + { + if (empty($this->EOF) || 0 === $this->char) { + return 1; + } + + // Add one to $this->char because we want the number for the next + // byte to be processed. + return substr_count($this->data, "\n", 0, min($this->char, $this->EOF)) + 1; + } + + /** + * Read chars until something in the mask is encountered. + * + * @param string $mask + * + * @return mixed + */ + public function charsUntil($mask) + { + return $this->doCharsUntil($mask); + } + + /** + * Read chars as long as the mask matches. + * + * @param string $mask + * + * @return int + */ + public function charsWhile($mask) + { + return $this->doCharsWhile($mask); + } + + /** + * Returns the current column of the current line that the tokenizer is at. + * + * Newlines are column 0. The first char after a newline is column 1. + * + * @return int The column number. + */ + public function columnOffset() + { + // Short circuit for the first char. + if (0 === $this->char) { + return 0; + } + + // strrpos is weird, and the offset needs to be negative for what we + // want (i.e., the last \n before $this->char). This needs to not have + // one (to make it point to the next character, the one we want the + // position of) added to it because strrpos's behaviour includes the + // final offset byte. + $backwardFrom = $this->char - 1 - strlen($this->data); + $lastLine = strrpos($this->data, "\n", $backwardFrom); + + // However, for here we want the length up until the next byte to be + // processed, so add one to the current byte ($this->char). + if (false !== $lastLine) { + $findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine); + } else { + // After a newline. + $findLengthOf = substr($this->data, 0, $this->char); + } + + return UTF8Utils::countChars($findLengthOf); + } + + /** + * Get all characters until EOF. + * + * This consumes characters until the EOF. + * + * @return int The number of characters remaining. + */ + public function remainingChars() + { + if ($this->char < $this->EOF) { + $data = substr($this->data, $this->char); + $this->char = $this->EOF; + + return $data; + } + + return ''; // false; + } + + /** + * Replace linefeed characters according to the spec. + * + * @param $data + * + * @return string + */ + private function replaceLinefeeds($data) + { + /* + * U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. + * Any CR characters that are followed by LF characters must be removed, and any CR characters not + * followed by LF characters must be converted to LF characters. Thus, newlines in HTML DOMs are + * represented by LF characters, and there are never any CR characters in the input to the tokenization + * stage. + */ + $crlfTable = array( + "\0" => "\xEF\xBF\xBD", + "\r\n" => "\n", + "\r" => "\n", + ); + + return strtr($data, $crlfTable); + } + + /** + * Read to a particular match (or until $max bytes are consumed). + * + * This operates on byte sequences, not characters. + * + * Matches as far as possible until we reach a certain set of bytes + * and returns the matched substring. + * + * @param string $bytes Bytes to match. + * @param int $max Maximum number of bytes to scan. + * + * @return mixed Index or false if no match is found. You should use strong + * equality when checking the result, since index could be 0. + */ + private function doCharsUntil($bytes, $max = null) + { + if ($this->char >= $this->EOF) { + return false; + } + + if (0 === $max || $max) { + $len = strcspn($this->data, $bytes, $this->char, $max); + } else { + $len = strcspn($this->data, $bytes, $this->char); + } + + $string = (string) substr($this->data, $this->char, $len); + $this->char += $len; + + return $string; + } + + /** + * Returns the string so long as $bytes matches. + * + * Matches as far as possible with a certain set of bytes + * and returns the matched substring. + * + * @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the + * current char, the pointer advances and the char is part of the + * substring. + * @param int $max The max number of chars to read. + * + * @return string + */ + private function doCharsWhile($bytes, $max = null) + { + if ($this->char >= $this->EOF) { + return false; + } + + if (0 === $max || $max) { + $len = strspn($this->data, $bytes, $this->char, $max); + } else { + $len = strspn($this->data, $bytes, $this->char); + } + + $string = (string) substr($this->data, $this->char, $len); + $this->char += $len; + + return $string; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php new file mode 100644 index 000000000..bed9d6eab --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php @@ -0,0 +1,334 @@ +<?php +/** + * Loads a string to be parsed. + */ + +namespace Masterminds\HTML5\Parser; + +/* + * +* Based on code from html5lib: + +Copyright 2009 Geoffrey Sneddon <http://gsnedders.com/> + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +// Some conventions: +// - /* */ indicates verbatim text from the HTML 5 specification +// MPB: Not sure which version of the spec. Moving from HTML5lib to +// HTML5-PHP, I have been using this version: +// http://www.w3.org/TR/2012/CR-html5-20121217/Overview.html#contents +// +// - // indicates regular comments + +/** + * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead. + */ +class StringInputStream implements InputStream +{ + /** + * The string data we're parsing. + */ + private $data; + + /** + * The current integer byte position we are in $data. + */ + private $char; + + /** + * Length of $data; when $char === $data, we are at the end-of-file. + */ + private $EOF; + + /** + * Parse errors. + */ + public $errors = array(); + + /** + * Create a new InputStream wrapper. + * + * @param string $data Data to parse. + * @param string $encoding The encoding to use for the data. + * @param string $debug A fprintf format to use to echo the data on stdout. + */ + public function __construct($data, $encoding = 'UTF-8', $debug = '') + { + $data = UTF8Utils::convertToUTF8($data, $encoding); + if ($debug) { + fprintf(STDOUT, $debug, $data, strlen($data)); + } + + // There is good reason to question whether it makes sense to + // do this here, since most of these checks are done during + // parsing, and since this check doesn't actually *do* anything. + $this->errors = UTF8Utils::checkForIllegalCodepoints($data); + + $data = $this->replaceLinefeeds($data); + + $this->data = $data; + $this->char = 0; + $this->EOF = strlen($data); + } + + public function __toString() + { + return $this->data; + } + + /** + * Replace linefeed characters according to the spec. + */ + protected function replaceLinefeeds($data) + { + /* + * U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. + * Any CR characters that are followed by LF characters must be removed, and any CR characters not + * followed by LF characters must be converted to LF characters. Thus, newlines in HTML DOMs are + * represented by LF characters, and there are never any CR characters in the input to the tokenization + * stage. + */ + $crlfTable = array( + "\0" => "\xEF\xBF\xBD", + "\r\n" => "\n", + "\r" => "\n", + ); + + return strtr($data, $crlfTable); + } + + /** + * Returns the current line that the tokenizer is at. + */ + public function currentLine() + { + if (empty($this->EOF) || 0 === $this->char) { + return 1; + } + // Add one to $this->char because we want the number for the next + // byte to be processed. + return substr_count($this->data, "\n", 0, min($this->char, $this->EOF)) + 1; + } + + /** + * @deprecated + */ + public function getCurrentLine() + { + return $this->currentLine(); + } + + /** + * Returns the current column of the current line that the tokenizer is at. + * Newlines are column 0. The first char after a newline is column 1. + * + * @return int The column number. + */ + public function columnOffset() + { + // Short circuit for the first char. + if (0 === $this->char) { + return 0; + } + // strrpos is weird, and the offset needs to be negative for what we + // want (i.e., the last \n before $this->char). This needs to not have + // one (to make it point to the next character, the one we want the + // position of) added to it because strrpos's behaviour includes the + // final offset byte. + $backwardFrom = $this->char - 1 - strlen($this->data); + $lastLine = strrpos($this->data, "\n", $backwardFrom); + + // However, for here we want the length up until the next byte to be + // processed, so add one to the current byte ($this->char). + if (false !== $lastLine) { + $findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine); + } else { + // After a newline. + $findLengthOf = substr($this->data, 0, $this->char); + } + + return UTF8Utils::countChars($findLengthOf); + } + + /** + * @deprecated + */ + public function getColumnOffset() + { + return $this->columnOffset(); + } + + /** + * Get the current character. + * + * @return string The current character. + */ + public function current() + { + return $this->data[$this->char]; + } + + /** + * Advance the pointer. + * This is part of the Iterator interface. + */ + #[\ReturnTypeWillChange] + public function next() + { + ++$this->char; + } + + /** + * Rewind to the start of the string. + */ + #[\ReturnTypeWillChange] + public function rewind() + { + $this->char = 0; + } + + /** + * Is the current pointer location valid. + * + * @return bool Whether the current pointer location is valid. + */ + #[\ReturnTypeWillChange] + public function valid() + { + return $this->char < $this->EOF; + } + + /** + * Get all characters until EOF. + * + * This reads to the end of the file, and sets the read marker at the + * end of the file. + * + * Note this performs bounds checking. + * + * @return string Returns the remaining text. If called when the InputStream is + * already exhausted, it returns an empty string. + */ + public function remainingChars() + { + if ($this->char < $this->EOF) { + $data = substr($this->data, $this->char); + $this->char = $this->EOF; + + return $data; + } + + return ''; // false; + } + + /** + * Read to a particular match (or until $max bytes are consumed). + * + * This operates on byte sequences, not characters. + * + * Matches as far as possible until we reach a certain set of bytes + * and returns the matched substring. + * + * @param string $bytes Bytes to match. + * @param int $max Maximum number of bytes to scan. + * + * @return mixed Index or false if no match is found. You should use strong + * equality when checking the result, since index could be 0. + */ + public function charsUntil($bytes, $max = null) + { + if ($this->char >= $this->EOF) { + return false; + } + + if (0 === $max || $max) { + $len = strcspn($this->data, $bytes, $this->char, $max); + } else { + $len = strcspn($this->data, $bytes, $this->char); + } + + $string = (string) substr($this->data, $this->char, $len); + $this->char += $len; + + return $string; + } + + /** + * Returns the string so long as $bytes matches. + * + * Matches as far as possible with a certain set of bytes + * and returns the matched substring. + * + * @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the + * current char, the pointer advances and the char is part of the + * substring. + * @param int $max The max number of chars to read. + * + * @return string + */ + public function charsWhile($bytes, $max = null) + { + if ($this->char >= $this->EOF) { + return false; + } + + if (0 === $max || $max) { + $len = strspn($this->data, $bytes, $this->char, $max); + } else { + $len = strspn($this->data, $bytes, $this->char); + } + $string = (string) substr($this->data, $this->char, $len); + $this->char += $len; + + return $string; + } + + /** + * Unconsume characters. + * + * @param int $howMany The number of characters to unconsume. + */ + public function unconsume($howMany = 1) + { + if (($this->char - $howMany) >= 0) { + $this->char -= $howMany; + } + } + + /** + * Look ahead without moving cursor. + */ + public function peek() + { + if (($this->char + 1) <= $this->EOF) { + return $this->data[$this->char + 1]; + } + + return false; + } + + public function key() + { + return $this->char; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php new file mode 100644 index 000000000..300a44626 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php @@ -0,0 +1,1191 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +use Masterminds\HTML5\Elements; + +/** + * The HTML5 tokenizer. + * + * The tokenizer's role is reading data from the scanner and gathering it into + * semantic units. From the tokenizer, data is emitted to an event handler, + * which may (for example) create a DOM tree. + * + * The HTML5 specification has a detailed explanation of tokenizing HTML5. We + * follow that specification to the maximum extent that we can. If you find + * a discrepancy that is not documented, please file a bug and/or submit a + * patch. + * + * This tokenizer is implemented as a recursive descent parser. + * + * Within the API documentation, you may see references to the specific section + * of the HTML5 spec that the code attempts to reproduce. Example: 8.2.4.1. + * This refers to section 8.2.4.1 of the HTML5 CR specification. + * + * @see http://www.w3.org/TR/2012/CR-html5-20121217/ + */ +class Tokenizer +{ + protected $scanner; + + protected $events; + + protected $tok; + + /** + * Buffer for text. + */ + protected $text = ''; + + // When this goes to false, the parser stops. + protected $carryOn = true; + + protected $textMode = 0; // TEXTMODE_NORMAL; + protected $untilTag = null; + + const CONFORMANT_XML = 'xml'; + const CONFORMANT_HTML = 'html'; + protected $mode = self::CONFORMANT_HTML; + + /** + * Create a new tokenizer. + * + * Typically, parsing a document involves creating a new tokenizer, giving + * it a scanner (input) and an event handler (output), and then calling + * the Tokenizer::parse() method.` + * + * @param Scanner $scanner A scanner initialized with an input stream. + * @param EventHandler $eventHandler An event handler, initialized and ready to receive events. + * @param string $mode + */ + public function __construct($scanner, $eventHandler, $mode = self::CONFORMANT_HTML) + { + $this->scanner = $scanner; + $this->events = $eventHandler; + $this->mode = $mode; + } + + /** + * Begin parsing. + * + * This will begin scanning the document, tokenizing as it goes. + * Tokens are emitted into the event handler. + * + * Tokenizing will continue until the document is completely + * read. Errors are emitted into the event handler, but + * the parser will attempt to continue parsing until the + * entire input stream is read. + */ + public function parse() + { + do { + $this->consumeData(); + // FIXME: Add infinite loop protection. + } while ($this->carryOn); + } + + /** + * Set the text mode for the character data reader. + * + * HTML5 defines three different modes for reading text: + * - Normal: Read until a tag is encountered. + * - RCDATA: Read until a tag is encountered, but skip a few otherwise- + * special characters. + * - Raw: Read until a special closing tag is encountered (viz. pre, script) + * + * This allows those modes to be set. + * + * Normally, setting is done by the event handler via a special return code on + * startTag(), but it can also be set manually using this function. + * + * @param int $textmode One of Elements::TEXT_*. + * @param string $untilTag The tag that should stop RAW or RCDATA mode. Normal mode does not + * use this indicator. + */ + public function setTextMode($textmode, $untilTag = null) + { + $this->textMode = $textmode & (Elements::TEXT_RAW | Elements::TEXT_RCDATA); + $this->untilTag = $untilTag; + } + + /** + * Consume a character and make a move. + * HTML5 8.2.4.1. + */ + protected function consumeData() + { + $tok = $this->scanner->current(); + + if ('&' === $tok) { + // Character reference + $ref = $this->decodeCharacterReference(); + $this->buffer($ref); + + $tok = $this->scanner->current(); + } + + // Parse tag + if ('<' === $tok) { + // Any buffered text data can go out now. + $this->flushBuffer(); + + $tok = $this->scanner->next(); + + if ('!' === $tok) { + $this->markupDeclaration(); + } elseif ('/' === $tok) { + $this->endTag(); + } elseif ('?' === $tok) { + $this->processingInstruction(); + } elseif (ctype_alpha($tok)) { + $this->tagName(); + } else { + $this->parseError('Illegal tag opening'); + // TODO is this necessary ? + $this->characterData(); + } + + $tok = $this->scanner->current(); + } + + if (false === $tok) { + // Handle end of document + $this->eof(); + } else { + // Parse character + switch ($this->textMode) { + case Elements::TEXT_RAW: + $this->rawText($tok); + break; + + case Elements::TEXT_RCDATA: + $this->rcdata($tok); + break; + + default: + if ('<' === $tok || '&' === $tok) { + break; + } + + // NULL character + if ("\00" === $tok) { + $this->parseError('Received null character.'); + + $this->text .= $tok; + $this->scanner->consume(); + + break; + } + + $this->text .= $this->scanner->charsUntil("<&\0"); + } + } + + return $this->carryOn; + } + + /** + * Parse anything that looks like character data. + * + * Different rules apply based on the current text mode. + * + * @see Elements::TEXT_RAW Elements::TEXT_RCDATA. + */ + protected function characterData() + { + $tok = $this->scanner->current(); + if (false === $tok) { + return false; + } + switch ($this->textMode) { + case Elements::TEXT_RAW: + return $this->rawText($tok); + case Elements::TEXT_RCDATA: + return $this->rcdata($tok); + default: + if ('<' === $tok || '&' === $tok) { + return false; + } + + return $this->text($tok); + } + } + + /** + * This buffers the current token as character data. + * + * @param string $tok The current token. + * + * @return bool + */ + protected function text($tok) + { + // This should never happen... + if (false === $tok) { + return false; + } + + // NULL character + if ("\00" === $tok) { + $this->parseError('Received null character.'); + } + + $this->buffer($tok); + $this->scanner->consume(); + + return true; + } + + /** + * Read text in RAW mode. + * + * @param string $tok The current token. + * + * @return bool + */ + protected function rawText($tok) + { + if (is_null($this->untilTag)) { + return $this->text($tok); + } + + $sequence = '</' . $this->untilTag . '>'; + $txt = $this->readUntilSequence($sequence); + $this->events->text($txt); + $this->setTextMode(0); + + return $this->endTag(); + } + + /** + * Read text in RCDATA mode. + * + * @param string $tok The current token. + * + * @return bool + */ + protected function rcdata($tok) + { + if (is_null($this->untilTag)) { + return $this->text($tok); + } + + $sequence = '</' . $this->untilTag; + $txt = ''; + + $caseSensitive = !Elements::isHtml5Element($this->untilTag); + while (false !== $tok && !('<' == $tok && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) { + if ('&' == $tok) { + $txt .= $this->decodeCharacterReference(); + $tok = $this->scanner->current(); + } else { + $txt .= $tok; + $tok = $this->scanner->next(); + } + } + $len = strlen($sequence); + $this->scanner->consume($len); + $len += $this->scanner->whitespace(); + if ('>' !== $this->scanner->current()) { + $this->parseError('Unclosed RCDATA end tag'); + } + + $this->scanner->unconsume($len); + $this->events->text($txt); + $this->setTextMode(0); + + return $this->endTag(); + } + + /** + * If the document is read, emit an EOF event. + */ + protected function eof() + { + // fprintf(STDOUT, "EOF"); + $this->flushBuffer(); + $this->events->eof(); + $this->carryOn = false; + } + + /** + * Look for markup. + */ + protected function markupDeclaration() + { + $tok = $this->scanner->next(); + + // Comment: + if ('-' == $tok && '-' == $this->scanner->peek()) { + $this->scanner->consume(2); + + return $this->comment(); + } elseif ('D' == $tok || 'd' == $tok) { // Doctype + return $this->doctype(); + } elseif ('[' == $tok) { // CDATA section + return $this->cdataSection(); + } + + // FINISH + $this->parseError('Expected <!--, <![CDATA[, or <!DOCTYPE. Got <!%s', $tok); + $this->bogusComment('<!'); + + return true; + } + + /** + * Consume an end tag. See section 8.2.4.9. + */ + protected function endTag() + { + if ('/' != $this->scanner->current()) { + return false; + } + $tok = $this->scanner->next(); + + // a-zA-Z -> tagname + // > -> parse error + // EOF -> parse error + // -> parse error + if (!ctype_alpha($tok)) { + $this->parseError("Expected tag name, got '%s'", $tok); + if ("\0" == $tok || false === $tok) { + return false; + } + + return $this->bogusComment('</'); + } + + $name = $this->scanner->charsUntil("\n\f \t>"); + $name = self::CONFORMANT_XML === $this->mode ? $name : strtolower($name); + // Trash whitespace. + $this->scanner->whitespace(); + + $tok = $this->scanner->current(); + if ('>' != $tok) { + $this->parseError("Expected >, got '%s'", $tok); + // We just trash stuff until we get to the next tag close. + $this->scanner->charsUntil('>'); + } + + $this->events->endTag($name); + $this->scanner->consume(); + + return true; + } + + /** + * Consume a tag name and body. See section 8.2.4.10. + */ + protected function tagName() + { + // We know this is at least one char. + $name = $this->scanner->charsWhile(':_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'); + $name = self::CONFORMANT_XML === $this->mode ? $name : strtolower($name); + $attributes = array(); + $selfClose = false; + + // Handle attribute parse exceptions here so that we can + // react by trying to build a sensible parse tree. + try { + do { + $this->scanner->whitespace(); + $this->attribute($attributes); + } while (!$this->isTagEnd($selfClose)); + } catch (ParseError $e) { + $selfClose = false; + } + + $mode = $this->events->startTag($name, $attributes, $selfClose); + + if (is_int($mode)) { + $this->setTextMode($mode, $name); + } + + $this->scanner->consume(); + + return true; + } + + /** + * Check if the scanner has reached the end of a tag. + */ + protected function isTagEnd(&$selfClose) + { + $tok = $this->scanner->current(); + if ('/' == $tok) { + $this->scanner->consume(); + $this->scanner->whitespace(); + $tok = $this->scanner->current(); + + if ('>' == $tok) { + $selfClose = true; + + return true; + } + if (false === $tok) { + $this->parseError('Unexpected EOF inside of tag.'); + + return true; + } + // Basically, we skip the / token and go on. + // See 8.2.4.43. + $this->parseError("Unexpected '%s' inside of a tag.", $tok); + + return false; + } + + if ('>' == $tok) { + return true; + } + if (false === $tok) { + $this->parseError('Unexpected EOF inside of tag.'); + + return true; + } + + return false; + } + + /** + * Parse attributes from inside of a tag. + * + * @param string[] $attributes + * + * @return bool + * + * @throws ParseError + */ + protected function attribute(&$attributes) + { + $tok = $this->scanner->current(); + if ('/' == $tok || '>' == $tok || false === $tok) { + return false; + } + + if ('<' == $tok) { + $this->parseError("Unexpected '<' inside of attributes list."); + // Push the < back onto the stack. + $this->scanner->unconsume(); + // Let the caller figure out how to handle this. + throw new ParseError('Start tag inside of attribute.'); + } + + $name = strtolower($this->scanner->charsUntil("/>=\n\f\t ")); + + if (0 == strlen($name)) { + $tok = $this->scanner->current(); + $this->parseError('Expected an attribute name, got %s.', $tok); + // Really, only '=' can be the char here. Everything else gets absorbed + // under one rule or another. + $name = $tok; + $this->scanner->consume(); + } + + $isValidAttribute = true; + // Attribute names can contain most Unicode characters for HTML5. + // But method "DOMElement::setAttribute" is throwing exception + // because of it's own internal restriction so these have to be filtered. + // see issue #23: https://github.com/Masterminds/html5-php/issues/23 + // and http://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#syntax-attribute-name + if (preg_match("/[\x1-\x2C\\/\x3B-\x40\x5B-\x5E\x60\x7B-\x7F]/u", $name)) { + $this->parseError('Unexpected characters in attribute name: %s', $name); + $isValidAttribute = false; + } // There is no limitation for 1st character in HTML5. + // But method "DOMElement::setAttribute" is throwing exception for the + // characters below so they have to be filtered. + // see issue #23: https://github.com/Masterminds/html5-php/issues/23 + // and http://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#syntax-attribute-name + elseif (preg_match('/^[0-9.-]/u', $name)) { + $this->parseError('Unexpected character at the begining of attribute name: %s', $name); + $isValidAttribute = false; + } + // 8.1.2.3 + $this->scanner->whitespace(); + + $val = $this->attributeValue(); + if ($isValidAttribute) { + $attributes[$name] = $val; + } + + return true; + } + + /** + * Consume an attribute value. See section 8.2.4.37 and after. + * + * @return string|null + */ + protected function attributeValue() + { + if ('=' != $this->scanner->current()) { + return null; + } + $this->scanner->consume(); + // 8.1.2.3 + $this->scanner->whitespace(); + + $tok = $this->scanner->current(); + switch ($tok) { + case "\n": + case "\f": + case ' ': + case "\t": + // Whitespace here indicates an empty value. + return null; + case '"': + case "'": + $this->scanner->consume(); + + return $this->quotedAttributeValue($tok); + case '>': + // case '/': // 8.2.4.37 seems to allow foo=/ as a valid attr. + $this->parseError('Expected attribute value, got tag end.'); + + return null; + case '=': + case '`': + $this->parseError('Expecting quotes, got %s.', $tok); + + return $this->unquotedAttributeValue(); + default: + return $this->unquotedAttributeValue(); + } + } + + /** + * Get an attribute value string. + * + * @param string $quote IMPORTANT: This is a series of chars! Any one of which will be considered + * termination of an attribute's value. E.g. "\"'" will stop at either + * ' or ". + * + * @return string The attribute value. + */ + protected function quotedAttributeValue($quote) + { + $stoplist = "\f" . $quote; + $val = ''; + + while (true) { + $tokens = $this->scanner->charsUntil($stoplist . '&'); + if (false !== $tokens) { + $val .= $tokens; + } else { + break; + } + + $tok = $this->scanner->current(); + if ('&' == $tok) { + $val .= $this->decodeCharacterReference(true); + continue; + } + break; + } + $this->scanner->consume(); + + return $val; + } + + protected function unquotedAttributeValue() + { + $val = ''; + $tok = $this->scanner->current(); + while (false !== $tok) { + switch ($tok) { + case "\n": + case "\f": + case ' ': + case "\t": + case '>': + break 2; + + case '&': + $val .= $this->decodeCharacterReference(true); + $tok = $this->scanner->current(); + + break; + + case "'": + case '"': + case '<': + case '=': + case '`': + $this->parseError('Unexpected chars in unquoted attribute value %s', $tok); + $val .= $tok; + $tok = $this->scanner->next(); + break; + + default: + $val .= $this->scanner->charsUntil("\t\n\f >&\"'<=`"); + + $tok = $this->scanner->current(); + } + } + + return $val; + } + + /** + * Consume malformed markup as if it were a comment. + * 8.2.4.44. + * + * The spec requires that the ENTIRE tag-like thing be enclosed inside of + * the comment. So this will generate comments like: + * + * <!--</+foo>--> + * + * @param string $leading Prepend any leading characters. This essentially + * negates the need to backtrack, but it's sort of a hack. + * + * @return bool + */ + protected function bogusComment($leading = '') + { + $comment = $leading; + $tokens = $this->scanner->charsUntil('>'); + if (false !== $tokens) { + $comment .= $tokens; + } + $tok = $this->scanner->current(); + if (false !== $tok) { + $comment .= $tok; + } + + $this->flushBuffer(); + $this->events->comment($comment); + $this->scanner->consume(); + + return true; + } + + /** + * Read a comment. + * Expects the first tok to be inside of the comment. + * + * @return bool + */ + protected function comment() + { + $tok = $this->scanner->current(); + $comment = ''; + + // <!-->. Emit an empty comment because 8.2.4.46 says to. + if ('>' == $tok) { + // Parse error. Emit the comment token. + $this->parseError("Expected comment data, got '>'"); + $this->events->comment(''); + $this->scanner->consume(); + + return true; + } + + // Replace NULL with the replacement char. + if ("\0" == $tok) { + $tok = UTF8Utils::FFFD; + } + while (!$this->isCommentEnd()) { + $comment .= $tok; + $tok = $this->scanner->next(); + } + + $this->events->comment($comment); + $this->scanner->consume(); + + return true; + } + + /** + * Check if the scanner has reached the end of a comment. + * + * @return bool + */ + protected function isCommentEnd() + { + $tok = $this->scanner->current(); + + // EOF + if (false === $tok) { + // Hit the end. + $this->parseError('Unexpected EOF in a comment.'); + + return true; + } + + // If it doesn't start with -, not the end. + if ('-' != $tok) { + return false; + } + + // Advance one, and test for '->' + if ('-' == $this->scanner->next() && '>' == $this->scanner->peek()) { + $this->scanner->consume(); // Consume the last '>' + return true; + } + // Unread '-'; + $this->scanner->unconsume(1); + + return false; + } + + /** + * Parse a DOCTYPE. + * + * Parse a DOCTYPE declaration. This method has strong bearing on whether or + * not Quirksmode is enabled on the event handler. + * + * @todo This method is a little long. Should probably refactor. + * + * @return bool + */ + protected function doctype() + { + // Check that string is DOCTYPE. + if ($this->scanner->sequenceMatches('DOCTYPE', false)) { + $this->scanner->consume(7); + } else { + $chars = $this->scanner->charsWhile('DOCTYPEdoctype'); + $this->parseError('Expected DOCTYPE, got %s', $chars); + + return $this->bogusComment('<!' . $chars); + } + + $this->scanner->whitespace(); + $tok = $this->scanner->current(); + + // EOF: die. + if (false === $tok) { + $this->events->doctype('html5', EventHandler::DOCTYPE_NONE, '', true); + $this->eof(); + + return true; + } + + // NULL char: convert. + if ("\0" === $tok) { + $this->parseError('Unexpected null character in DOCTYPE.'); + } + + $stop = " \n\f>"; + $doctypeName = $this->scanner->charsUntil($stop); + // Lowercase ASCII, replace \0 with FFFD + $doctypeName = strtolower(strtr($doctypeName, "\0", UTF8Utils::FFFD)); + + $tok = $this->scanner->current(); + + // If false, emit a parse error, DOCTYPE, and return. + if (false === $tok) { + $this->parseError('Unexpected EOF in DOCTYPE declaration.'); + $this->events->doctype($doctypeName, EventHandler::DOCTYPE_NONE, null, true); + + return true; + } + + // Short DOCTYPE, like <!DOCTYPE html> + if ('>' == $tok) { + // DOCTYPE without a name. + if (0 == strlen($doctypeName)) { + $this->parseError('Expected a DOCTYPE name. Got nothing.'); + $this->events->doctype($doctypeName, 0, null, true); + $this->scanner->consume(); + + return true; + } + $this->events->doctype($doctypeName); + $this->scanner->consume(); + + return true; + } + $this->scanner->whitespace(); + + $pub = strtoupper($this->scanner->getAsciiAlpha()); + $white = $this->scanner->whitespace(); + + // Get ID, and flag it as pub or system. + if (('PUBLIC' == $pub || 'SYSTEM' == $pub) && $white > 0) { + // Get the sys ID. + $type = 'PUBLIC' == $pub ? EventHandler::DOCTYPE_PUBLIC : EventHandler::DOCTYPE_SYSTEM; + $id = $this->quotedString("\0>"); + if (false === $id) { + $this->events->doctype($doctypeName, $type, $pub, false); + + return true; + } + + // Premature EOF. + if (false === $this->scanner->current()) { + $this->parseError('Unexpected EOF in DOCTYPE'); + $this->events->doctype($doctypeName, $type, $id, true); + + return true; + } + + // Well-formed complete DOCTYPE. + $this->scanner->whitespace(); + if ('>' == $this->scanner->current()) { + $this->events->doctype($doctypeName, $type, $id, false); + $this->scanner->consume(); + + return true; + } + + // If we get here, we have <!DOCTYPE foo PUBLIC "bar" SOME_JUNK + // Throw away the junk, parse error, quirks mode, return true. + $this->scanner->charsUntil('>'); + $this->parseError('Malformed DOCTYPE.'); + $this->events->doctype($doctypeName, $type, $id, true); + $this->scanner->consume(); + + return true; + } + + // Else it's a bogus DOCTYPE. + // Consume to > and trash. + $this->scanner->charsUntil('>'); + + $this->parseError('Expected PUBLIC or SYSTEM. Got %s.', $pub); + $this->events->doctype($doctypeName, 0, null, true); + $this->scanner->consume(); + + return true; + } + + /** + * Utility for reading a quoted string. + * + * @param string $stopchars Characters (in addition to a close-quote) that should stop the string. + * E.g. sometimes '>' is higher precedence than '"' or "'". + * + * @return mixed String if one is found (quotations omitted). + */ + protected function quotedString($stopchars) + { + $tok = $this->scanner->current(); + if ('"' == $tok || "'" == $tok) { + $this->scanner->consume(); + $ret = $this->scanner->charsUntil($tok . $stopchars); + if ($this->scanner->current() == $tok) { + $this->scanner->consume(); + } else { + // Parse error because no close quote. + $this->parseError('Expected %s, got %s', $tok, $this->scanner->current()); + } + + return $ret; + } + + return false; + } + + /** + * Handle a CDATA section. + * + * @return bool + */ + protected function cdataSection() + { + $cdata = ''; + $this->scanner->consume(); + + $chars = $this->scanner->charsWhile('CDAT'); + if ('CDATA' != $chars || '[' != $this->scanner->current()) { + $this->parseError('Expected [CDATA[, got %s', $chars); + + return $this->bogusComment('<![' . $chars); + } + + $tok = $this->scanner->next(); + do { + if (false === $tok) { + $this->parseError('Unexpected EOF inside CDATA.'); + $this->bogusComment('<![CDATA[' . $cdata); + + return true; + } + $cdata .= $tok; + $tok = $this->scanner->next(); + } while (!$this->scanner->sequenceMatches(']]>')); + + // Consume ]]> + $this->scanner->consume(3); + + $this->events->cdata($cdata); + + return true; + } + + // ================================================================ + // Non-HTML5 + // ================================================================ + + /** + * Handle a processing instruction. + * + * XML processing instructions are supposed to be ignored in HTML5, + * treated as "bogus comments". However, since we're not a user + * agent, we allow them. We consume until ?> and then issue a + * EventListener::processingInstruction() event. + * + * @return bool + */ + protected function processingInstruction() + { + if ('?' != $this->scanner->current()) { + return false; + } + + $tok = $this->scanner->next(); + $procName = $this->scanner->getAsciiAlpha(); + $white = $this->scanner->whitespace(); + + // If not a PI, send to bogusComment. + if (0 == strlen($procName) || 0 == $white || false == $this->scanner->current()) { + $this->parseError("Expected processing instruction name, got $tok"); + $this->bogusComment('<?' . $tok . $procName); + + return true; + } + + $data = ''; + // As long as it's not the case that the next two chars are ? and >. + while (!('?' == $this->scanner->current() && '>' == $this->scanner->peek())) { + $data .= $this->scanner->current(); + + $tok = $this->scanner->next(); + if (false === $tok) { + $this->parseError('Unexpected EOF in processing instruction.'); + $this->events->processingInstruction($procName, $data); + + return true; + } + } + + $this->scanner->consume(2); // Consume the closing tag + $this->events->processingInstruction($procName, $data); + + return true; + } + + // ================================================================ + // UTILITY FUNCTIONS + // ================================================================ + + /** + * Read from the input stream until we get to the desired sequene + * or hit the end of the input stream. + * + * @param string $sequence + * + * @return string + */ + protected function readUntilSequence($sequence) + { + $buffer = ''; + + // Optimization for reading larger blocks faster. + $first = substr($sequence, 0, 1); + while (false !== $this->scanner->current()) { + $buffer .= $this->scanner->charsUntil($first); + + // Stop as soon as we hit the stopping condition. + if ($this->scanner->sequenceMatches($sequence, false)) { + return $buffer; + } + $buffer .= $this->scanner->current(); + $this->scanner->consume(); + } + + // If we get here, we hit the EOF. + $this->parseError('Unexpected EOF during text read.'); + + return $buffer; + } + + /** + * Check if upcomming chars match the given sequence. + * + * This will read the stream for the $sequence. If it's + * found, this will return true. If not, return false. + * Since this unconsumes any chars it reads, the caller + * will still need to read the next sequence, even if + * this returns true. + * + * Example: $this->scanner->sequenceMatches('</script>') will + * see if the input stream is at the start of a + * '</script>' string. + * + * @param string $sequence + * @param bool $caseSensitive + * + * @return bool + */ + protected function sequenceMatches($sequence, $caseSensitive = true) + { + @trigger_error(__METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED); + + return $this->scanner->sequenceMatches($sequence, $caseSensitive); + } + + /** + * Send a TEXT event with the contents of the text buffer. + * + * This emits an EventHandler::text() event with the current contents of the + * temporary text buffer. (The buffer is used to group as much PCDATA + * as we can instead of emitting lots and lots of TEXT events.) + */ + protected function flushBuffer() + { + if ('' === $this->text) { + return; + } + $this->events->text($this->text); + $this->text = ''; + } + + /** + * Add text to the temporary buffer. + * + * @see flushBuffer() + * + * @param string $str + */ + protected function buffer($str) + { + $this->text .= $str; + } + + /** + * Emit a parse error. + * + * A parse error always returns false because it never consumes any + * characters. + * + * @param string $msg + * + * @return string + */ + protected function parseError($msg) + { + $args = func_get_args(); + + if (count($args) > 1) { + array_shift($args); + $msg = vsprintf($msg, $args); + } + + $line = $this->scanner->currentLine(); + $col = $this->scanner->columnOffset(); + $this->events->parseError($msg, $line, $col); + + return false; + } + + /** + * Decode a character reference and return the string. + * + * If $inAttribute is set to true, a bare & will be returned as-is. + * + * @param bool $inAttribute Set to true if the text is inside of an attribute value. + * false otherwise. + * + * @return string + */ + protected function decodeCharacterReference($inAttribute = false) + { + // Next char after &. + $tok = $this->scanner->next(); + $start = $this->scanner->position(); + + if (false === $tok) { + return '&'; + } + + // These indicate not an entity. We return just + // the &. + if ("\t" === $tok || "\n" === $tok || "\f" === $tok || ' ' === $tok || '&' === $tok || '<' === $tok) { + // $this->scanner->next(); + return '&'; + } + + // Numeric entity + if ('#' === $tok) { + $tok = $this->scanner->next(); + + if (false === $tok) { + $this->parseError('Expected &#DEC; &#HEX;, got EOF'); + $this->scanner->unconsume(1); + + return '&'; + } + + // Hexidecimal encoding. + // X[0-9a-fA-F]+; + // x[0-9a-fA-F]+; + if ('x' === $tok || 'X' === $tok) { + $tok = $this->scanner->next(); // Consume x + + // Convert from hex code to char. + $hex = $this->scanner->getHex(); + if (empty($hex)) { + $this->parseError('Expected &#xHEX;, got &#x%s', $tok); + // We unconsume because we don't know what parser rules might + // be in effect for the remaining chars. For example. '&#>' + // might result in a specific parsing rule inside of tag + // contexts, while not inside of pcdata context. + $this->scanner->unconsume(2); + + return '&'; + } + $entity = CharacterReference::lookupHex($hex); + } // Decimal encoding. + // [0-9]+; + else { + // Convert from decimal to char. + $numeric = $this->scanner->getNumeric(); + if (false === $numeric) { + $this->parseError('Expected &#DIGITS;, got &#%s', $tok); + $this->scanner->unconsume(2); + + return '&'; + } + $entity = CharacterReference::lookupDecimal($numeric); + } + } elseif ('=' === $tok && $inAttribute) { + return '&'; + } else { // String entity. + // Attempt to consume a string up to a ';'. + // [a-zA-Z0-9]+; + $cname = $this->scanner->getAsciiAlphaNum(); + $entity = CharacterReference::lookupName($cname); + + // When no entity is found provide the name of the unmatched string + // and continue on as the & is not part of an entity. The & will + // be converted to & elsewhere. + if (null === $entity) { + if (!$inAttribute || '' === $cname) { + $this->parseError("No match in entity table for '%s'", $cname); + } + $this->scanner->unconsume($this->scanner->position() - $start); + + return '&'; + } + } + + // The scanner has advanced the cursor for us. + $tok = $this->scanner->current(); + + // We have an entity. We're done here. + if (';' === $tok) { + $this->scanner->consume(); + + return $entity; + } + + // Failing to match ; means unconsume the entire string. + $this->scanner->unconsume($this->scanner->position() - $start); + + $this->parseError('Expected &ENTITY;, got &ENTITY%s (no trailing ;) ', $tok); + + return '&'; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php new file mode 100644 index 000000000..00d3951fd --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php @@ -0,0 +1,127 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +/** + * Handles special-case rules for the DOM tree builder. + * + * Many tags have special rules that need to be accomodated on an + * individual basis. This class handles those rules. + * + * See section 8.1.2.4 of the spec. + * + * @todo - colgroup and col special behaviors + * - body and head special behaviors + */ +class TreeBuildingRules +{ + protected static $tags = array( + 'li' => 1, + 'dd' => 1, + 'dt' => 1, + 'rt' => 1, + 'rp' => 1, + 'tr' => 1, + 'th' => 1, + 'td' => 1, + 'thead' => 1, + 'tfoot' => 1, + 'tbody' => 1, + 'table' => 1, + 'optgroup' => 1, + 'option' => 1, + ); + + /** + * Returns true if the given tagname has special processing rules. + */ + public function hasRules($tagname) + { + return isset(static::$tags[$tagname]); + } + + /** + * Evaluate the rule for the current tag name. + * + * This may modify the existing DOM. + * + * @return \DOMElement The new Current DOM element. + */ + public function evaluate($new, $current) + { + switch ($new->tagName) { + case 'li': + return $this->handleLI($new, $current); + case 'dt': + case 'dd': + return $this->handleDT($new, $current); + case 'rt': + case 'rp': + return $this->handleRT($new, $current); + case 'optgroup': + return $this->closeIfCurrentMatches($new, $current, array( + 'optgroup', + )); + case 'option': + return $this->closeIfCurrentMatches($new, $current, array( + 'option', + )); + case 'tr': + return $this->closeIfCurrentMatches($new, $current, array( + 'tr', + )); + case 'td': + case 'th': + return $this->closeIfCurrentMatches($new, $current, array( + 'th', + 'td', + )); + case 'tbody': + case 'thead': + case 'tfoot': + case 'table': // Spec isn't explicit about this, but it's necessary. + + return $this->closeIfCurrentMatches($new, $current, array( + 'thead', + 'tfoot', + 'tbody', + )); + } + + return $current; + } + + protected function handleLI($ele, $current) + { + return $this->closeIfCurrentMatches($ele, $current, array( + 'li', + )); + } + + protected function handleDT($ele, $current) + { + return $this->closeIfCurrentMatches($ele, $current, array( + 'dt', + 'dd', + )); + } + + protected function handleRT($ele, $current) + { + return $this->closeIfCurrentMatches($ele, $current, array( + 'rt', + 'rp', + )); + } + + protected function closeIfCurrentMatches($ele, $current, $match) + { + if (in_array($current->tagName, $match, true)) { + $current->parentNode->appendChild($ele); + } else { + $current->appendChild($ele); + } + + return $ele; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php new file mode 100644 index 000000000..f6a70bfac --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php @@ -0,0 +1,183 @@ +<?php + +namespace Masterminds\HTML5\Parser; + +/* +Portions based on code from html5lib files with the following copyright: + +Copyright 2009 Geoffrey Sneddon <http://gsnedders.com/> + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +use Masterminds\HTML5\Exception; + +class UTF8Utils +{ + /** + * The Unicode replacement character. + */ + const FFFD = "\xEF\xBF\xBD"; + + /** + * Count the number of characters in a string. + * UTF-8 aware. This will try (in order) iconv, MB, libxml, and finally a custom counter. + * + * @param string $string + * + * @return int + */ + public static function countChars($string) + { + // Get the length for the string we need. + if (function_exists('mb_strlen')) { + return mb_strlen($string, 'utf-8'); + } + + if (function_exists('iconv_strlen')) { + return iconv_strlen($string, 'utf-8'); + } + + if (function_exists('utf8_decode')) { + // MPB: Will this work? Won't certain decodes lead to two chars + // extrapolated out of 2-byte chars? + return strlen(utf8_decode($string)); + } + + $count = count_chars($string); + + // 0x80 = 0x7F - 0 + 1 (one added to get inclusive range) + // 0x33 = 0xF4 - 0x2C + 1 (one added to get inclusive range) + return array_sum(array_slice($count, 0, 0x80)) + array_sum(array_slice($count, 0xC2, 0x33)); + } + + /** + * Convert data from the given encoding to UTF-8. + * + * This has not yet been tested with charactersets other than UTF-8. + * It should work with ISO-8859-1/-13 and standard Latin Win charsets. + * + * @param string $data The data to convert + * @param string $encoding A valid encoding. Examples: http://www.php.net/manual/en/mbstring.supported-encodings.php + * + * @return string + */ + public static function convertToUTF8($data, $encoding = 'UTF-8') + { + /* + * From the HTML5 spec: Given an encoding, the bytes in the input stream must be converted + * to Unicode characters for the tokeniser, as described by the rules for that encoding, + * except that the leading U+FEFF BYTE ORDER MARK character, if any, must not be stripped + * by the encoding layer (it is stripped by the rule below). Bytes or sequences of bytes + * in the original byte stream that could not be converted to Unicode characters must be + * converted to U+FFFD REPLACEMENT CHARACTER code points. + */ + + // mb_convert_encoding is chosen over iconv because of a bug. The best + // details for the bug are on http://us1.php.net/manual/en/function.iconv.php#108643 + // which contains links to the actual but reports as well as work around + // details. + if (function_exists('mb_convert_encoding')) { + // mb library has the following behaviors: + // - UTF-16 surrogates result in false. + // - Overlongs and outside Plane 16 result in empty strings. + + // Before we run mb_convert_encoding we need to tell it what to do with + // characters it does not know. This could be different than the parent + // application executing this library so we store the value, change it + // to our needs, and then change it back when we are done. This feels + // a little excessive and it would be great if there was a better way. + $save = mb_substitute_character(); + mb_substitute_character('none'); + $data = mb_convert_encoding($data, 'UTF-8', $encoding); + mb_substitute_character($save); + } + // @todo Get iconv running in at least some environments if that is possible. + elseif (function_exists('iconv') && 'auto' !== $encoding) { + // fprintf(STDOUT, "iconv found\n"); + // iconv has the following behaviors: + // - Overlong representations are ignored. + // - Beyond Plane 16 is replaced with a lower char. + // - Incomplete sequences generate a warning. + $data = @iconv($encoding, 'UTF-8//IGNORE', $data); + } else { + throw new Exception('Not implemented, please install mbstring or iconv'); + } + + /* + * One leading U+FEFF BYTE ORDER MARK character must be ignored if any are present. + */ + if ("\xEF\xBB\xBF" === substr($data, 0, 3)) { + $data = substr($data, 3); + } + + return $data; + } + + /** + * Checks for Unicode code points that are not valid in a document. + * + * @param string $data A string to analyze + * + * @return array An array of (string) error messages produced by the scanning + */ + public static function checkForIllegalCodepoints($data) + { + // Vestigal error handling. + $errors = array(); + + /* + * All U+0000 null characters in the input must be replaced by U+FFFD REPLACEMENT CHARACTERs. + * Any occurrences of such characters is a parse error. + */ + for ($i = 0, $count = substr_count($data, "\0"); $i < $count; ++$i) { + $errors[] = 'null-character'; + } + + /* + * Any occurrences of any characters in the ranges U+0001 to U+0008, U+000B, U+000E to U+001F, U+007F + * to U+009F, U+D800 to U+DFFF , U+FDD0 to U+FDEF, and characters U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, + * U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, + * U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, + * U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, U+FFFFF, U+10FFFE, and U+10FFFF are parse errors. + * (These are all control characters or permanently undefined Unicode characters.) + */ + // Check PCRE is loaded. + $count = preg_match_all( + '/(?: + [\x01-\x08\x0B\x0E-\x1F\x7F] # U+0001 to U+0008, U+000B, U+000E to U+001F and U+007F + | + \xC2[\x80-\x9F] # U+0080 to U+009F + | + \xED(?:\xA0[\x80-\xFF]|[\xA1-\xBE][\x00-\xFF]|\xBF[\x00-\xBF]) # U+D800 to U+DFFFF + | + \xEF\xB7[\x90-\xAF] # U+FDD0 to U+FDEF + | + \xEF\xBF[\xBE\xBF] # U+FFFE and U+FFFF + | + [\xF0-\xF4][\x8F-\xBF]\xBF[\xBE\xBF] # U+nFFFE and U+nFFFF (1 <= n <= 10_{16}) + )/x', $data, $matches); + for ($i = 0; $i < $count; ++$i) { + $errors[] = 'invalid-codepoint'; + } + + return $errors; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php new file mode 100644 index 000000000..e9421a12d --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php @@ -0,0 +1,1533 @@ +<?php +/** + * @file + * This contains HTML5 entities to use with serializing. + * + * The list here is mildly different from the list at Entities because + * that list was generated from the w3c. It contains some entities that are + * not entirely proper such as &am; which maps to &. This list is meant to be + * a fallback for PHP versions prior to PHP 5.4 when dealing with encoding. + */ + +namespace Masterminds\HTML5\Serializer; + +/** + * A mapping of entities to their html5 representation. + * Used for older PHP + * versions that don't have the mapping. + */ +class HTML5Entities +{ + public static $map = array( + ' ' => '	', + "\n" => '
', + '!' => '!', + '"' => '"', + '#' => '#', + '$' => '$', + '%' => '%', + '&' => '&', + '\'' => ''', + '(' => '(', + ')' => ')', + '*' => '*', + '+' => '+', + ',' => ',', + '.' => '.', + '/' => '/', + ':' => ':', + ';' => ';', + '<' => '<', + '<⃒' => '&nvlt', + '=' => '=', + '=⃥' => '&bne', + '>' => '>', + '>⃒' => '&nvgt', + '?' => '?', + '@' => '@', + '[' => '[', + '\\' => '\', + ']' => ']', + '^' => '^', + '_' => '_', + '`' => '`', + 'fj' => '&fjlig', + '{' => '{', + '|' => '|', + '}' => '}', + ' ' => ' ', + '¡' => '¡', + '¢' => '¢', + '£' => '£', + '¤' => '¤', + '¥' => '¥', + '¦' => '¦', + '§' => '§', + '¨' => '¨', + '©' => '©', + 'ª' => 'ª', + '«' => '«', + '¬' => '¬', + '' => '­', + '®' => '®', + '¯' => '¯', + '°' => '°', + '±' => '±', + '²' => '²', + '³' => '³', + '´' => '´', + 'µ' => 'µ', + '¶' => '¶', + '·' => '·', + '¸' => '¸', + '¹' => '¹', + 'º' => 'º', + '»' => '»', + '¼' => '¼', + '½' => '½', + '¾' => '¾', + '¿' => '¿', + 'À' => 'À', + 'Á' => 'Á', + 'Â' => 'Â', + 'Ã' => 'Ã', + 'Ä' => 'Ä', + 'Å' => 'Å', + 'Æ' => 'Æ', + 'Ç' => 'Ç', + 'È' => 'È', + 'É' => 'É', + 'Ê' => 'Ê', + 'Ë' => 'Ë', + 'Ì' => 'Ì', + 'Í' => 'Í', + 'Î' => 'Î', + 'Ï' => 'Ï', + 'Ð' => 'Ð', + 'Ñ' => 'Ñ', + 'Ò' => 'Ò', + 'Ó' => 'Ó', + 'Ô' => 'Ô', + 'Õ' => 'Õ', + 'Ö' => 'Ö', + '×' => '×', + 'Ø' => 'Ø', + 'Ù' => 'Ù', + 'Ú' => 'Ú', + 'Û' => 'Û', + 'Ü' => 'Ü', + 'Ý' => 'Ý', + 'Þ' => 'Þ', + 'ß' => 'ß', + 'à' => 'à', + 'á' => 'á', + 'â' => 'â', + 'ã' => 'ã', + 'ä' => 'ä', + 'å' => 'å', + 'æ' => 'æ', + 'ç' => 'ç', + 'è' => 'è', + 'é' => 'é', + 'ê' => 'ê', + 'ë' => 'ë', + 'ì' => 'ì', + 'í' => 'í', + 'î' => 'î', + 'ï' => 'ï', + 'ð' => 'ð', + 'ñ' => 'ñ', + 'ò' => 'ò', + 'ó' => 'ó', + 'ô' => 'ô', + 'õ' => 'õ', + 'ö' => 'ö', + '÷' => '÷', + 'ø' => 'ø', + 'ù' => 'ù', + 'ú' => 'ú', + 'û' => 'û', + 'ü' => 'ü', + 'ý' => 'ý', + 'þ' => 'þ', + 'ÿ' => 'ÿ', + 'Ā' => 'Ā', + 'ā' => 'ā', + 'Ă' => 'Ă', + 'ă' => 'ă', + 'Ą' => 'Ą', + 'ą' => 'ą', + 'Ć' => 'Ć', + 'ć' => 'ć', + 'Ĉ' => 'Ĉ', + 'ĉ' => 'ĉ', + 'Ċ' => 'Ċ', + 'ċ' => 'ċ', + 'Č' => 'Č', + 'č' => 'č', + 'Ď' => 'Ď', + 'ď' => 'ď', + 'Đ' => 'Đ', + 'đ' => 'đ', + 'Ē' => 'Ē', + 'ē' => 'ē', + 'Ė' => 'Ė', + 'ė' => 'ė', + 'Ę' => 'Ę', + 'ę' => 'ę', + 'Ě' => 'Ě', + 'ě' => 'ě', + 'Ĝ' => 'Ĝ', + 'ĝ' => 'ĝ', + 'Ğ' => 'Ğ', + 'ğ' => 'ğ', + 'Ġ' => 'Ġ', + 'ġ' => 'ġ', + 'Ģ' => 'Ģ', + 'Ĥ' => 'Ĥ', + 'ĥ' => 'ĥ', + 'Ħ' => 'Ħ', + 'ħ' => 'ħ', + 'Ĩ' => 'Ĩ', + 'ĩ' => 'ĩ', + 'Ī' => 'Ī', + 'ī' => 'ī', + 'Į' => 'Į', + 'į' => 'į', + 'İ' => 'İ', + 'ı' => 'ı', + 'IJ' => 'IJ', + 'ij' => 'ij', + 'Ĵ' => 'Ĵ', + 'ĵ' => 'ĵ', + 'Ķ' => 'Ķ', + 'ķ' => 'ķ', + 'ĸ' => 'ĸ', + 'Ĺ' => 'Ĺ', + 'ĺ' => 'ĺ', + 'Ļ' => 'Ļ', + 'ļ' => 'ļ', + 'Ľ' => 'Ľ', + 'ľ' => 'ľ', + 'Ŀ' => 'Ŀ', + 'ŀ' => 'ŀ', + 'Ł' => 'Ł', + 'ł' => 'ł', + 'Ń' => 'Ń', + 'ń' => 'ń', + 'Ņ' => 'Ņ', + 'ņ' => 'ņ', + 'Ň' => 'Ň', + 'ň' => 'ň', + 'ʼn' => 'ʼn', + 'Ŋ' => 'Ŋ', + 'ŋ' => 'ŋ', + 'Ō' => 'Ō', + 'ō' => 'ō', + 'Ő' => 'Ő', + 'ő' => 'ő', + 'Œ' => 'Œ', + 'œ' => 'œ', + 'Ŕ' => 'Ŕ', + 'ŕ' => 'ŕ', + 'Ŗ' => 'Ŗ', + 'ŗ' => 'ŗ', + 'Ř' => 'Ř', + 'ř' => 'ř', + 'Ś' => 'Ś', + 'ś' => 'ś', + 'Ŝ' => 'Ŝ', + 'ŝ' => 'ŝ', + 'Ş' => 'Ş', + 'ş' => 'ş', + 'Š' => 'Š', + 'š' => 'š', + 'Ţ' => 'Ţ', + 'ţ' => 'ţ', + 'Ť' => 'Ť', + 'ť' => 'ť', + 'Ŧ' => 'Ŧ', + 'ŧ' => 'ŧ', + 'Ũ' => 'Ũ', + 'ũ' => 'ũ', + 'Ū' => 'Ū', + 'ū' => 'ū', + 'Ŭ' => 'Ŭ', + 'ŭ' => 'ŭ', + 'Ů' => 'Ů', + 'ů' => 'ů', + 'Ű' => 'Ű', + 'ű' => 'ű', + 'Ų' => 'Ų', + 'ų' => 'ų', + 'Ŵ' => 'Ŵ', + 'ŵ' => 'ŵ', + 'Ŷ' => 'Ŷ', + 'ŷ' => 'ŷ', + 'Ÿ' => 'Ÿ', + 'Ź' => 'Ź', + 'ź' => 'ź', + 'Ż' => 'Ż', + 'ż' => 'ż', + 'Ž' => 'Ž', + 'ž' => 'ž', + 'ƒ' => 'ƒ', + 'Ƶ' => 'Ƶ', + 'ǵ' => 'ǵ', + 'ȷ' => 'ȷ', + 'ˆ' => 'ˆ', + 'ˇ' => 'ˇ', + '˘' => '˘', + '˙' => '˙', + '˚' => '˚', + '˛' => '˛', + '˜' => '˜', + '˝' => '˝', + '̑' => '̑', + 'Α' => 'Α', + 'Β' => 'Β', + 'Γ' => 'Γ', + 'Δ' => 'Δ', + 'Ε' => 'Ε', + 'Ζ' => 'Ζ', + 'Η' => 'Η', + 'Θ' => 'Θ', + 'Ι' => 'Ι', + 'Κ' => 'Κ', + 'Λ' => 'Λ', + 'Μ' => 'Μ', + 'Ν' => 'Ν', + 'Ξ' => 'Ξ', + 'Ο' => 'Ο', + 'Π' => 'Π', + 'Ρ' => 'Ρ', + 'Σ' => 'Σ', + 'Τ' => 'Τ', + 'Υ' => 'Υ', + 'Φ' => 'Φ', + 'Χ' => 'Χ', + 'Ψ' => 'Ψ', + 'Ω' => 'Ω', + 'α' => 'α', + 'β' => 'β', + 'γ' => 'γ', + 'δ' => 'δ', + 'ε' => 'ε', + 'ζ' => 'ζ', + 'η' => 'η', + 'θ' => 'θ', + 'ι' => 'ι', + 'κ' => 'κ', + 'λ' => 'λ', + 'μ' => 'μ', + 'ν' => 'ν', + 'ξ' => 'ξ', + 'ο' => 'ο', + 'π' => 'π', + 'ρ' => 'ρ', + 'ς' => 'ς', + 'σ' => 'σ', + 'τ' => 'τ', + 'υ' => 'υ', + 'φ' => 'φ', + 'χ' => 'χ', + 'ψ' => 'ψ', + 'ω' => 'ω', + 'ϑ' => 'ϑ', + 'ϒ' => 'ϒ', + 'ϕ' => 'ϕ', + 'ϖ' => 'ϖ', + 'Ϝ' => 'Ϝ', + 'ϝ' => 'ϝ', + 'ϰ' => 'ϰ', + 'ϱ' => 'ϱ', + 'ϵ' => 'ϵ', + '϶' => '϶', + 'Ё' => 'Ё', + 'Ђ' => 'Ђ', + 'Ѓ' => 'Ѓ', + 'Є' => 'Є', + 'Ѕ' => 'Ѕ', + 'І' => 'І', + 'Ї' => 'Ї', + 'Ј' => 'Ј', + 'Љ' => 'Љ', + 'Њ' => 'Њ', + 'Ћ' => 'Ћ', + 'Ќ' => 'Ќ', + 'Ў' => 'Ў', + 'Џ' => 'Џ', + 'А' => 'А', + 'Б' => 'Б', + 'В' => 'В', + 'Г' => 'Г', + 'Д' => 'Д', + 'Е' => 'Е', + 'Ж' => 'Ж', + 'З' => 'З', + 'И' => 'И', + 'Й' => 'Й', + 'К' => 'К', + 'Л' => 'Л', + 'М' => 'М', + 'Н' => 'Н', + 'О' => 'О', + 'П' => 'П', + 'Р' => 'Р', + 'С' => 'С', + 'Т' => 'Т', + 'У' => 'У', + 'Ф' => 'Ф', + 'Х' => 'Х', + 'Ц' => 'Ц', + 'Ч' => 'Ч', + 'Ш' => 'Ш', + 'Щ' => 'Щ', + 'Ъ' => 'Ъ', + 'Ы' => 'Ы', + 'Ь' => 'Ь', + 'Э' => 'Э', + 'Ю' => 'Ю', + 'Я' => 'Я', + 'а' => 'а', + 'б' => 'б', + 'в' => 'в', + 'г' => 'г', + 'д' => 'д', + 'е' => 'е', + 'ж' => 'ж', + 'з' => 'з', + 'и' => 'и', + 'й' => 'й', + 'к' => 'к', + 'л' => 'л', + 'м' => 'м', + 'н' => 'н', + 'о' => 'о', + 'п' => 'п', + 'р' => 'р', + 'с' => 'с', + 'т' => 'т', + 'у' => 'у', + 'ф' => 'ф', + 'х' => 'х', + 'ц' => 'ц', + 'ч' => 'ч', + 'ш' => 'ш', + 'щ' => 'щ', + 'ъ' => 'ъ', + 'ы' => 'ы', + 'ь' => 'ь', + 'э' => 'э', + 'ю' => 'ю', + 'я' => 'я', + 'ё' => 'ё', + 'ђ' => 'ђ', + 'ѓ' => 'ѓ', + 'є' => 'є', + 'ѕ' => 'ѕ', + 'і' => 'і', + 'ї' => 'ї', + 'ј' => 'ј', + 'љ' => 'љ', + 'њ' => 'њ', + 'ћ' => 'ћ', + 'ќ' => 'ќ', + 'ў' => 'ў', + 'џ' => 'џ', + ' ' => ' ', + ' ' => ' ', + ' ' => ' ', + ' ' => ' ', + ' ' => ' ', + ' ' => ' ', + ' ' => ' ', + ' ' => ' ', + '' => '​', + '' => '‌', + '' => '‍', + '' => '‎', + '' => '‏', + '‐' => '‐', + '–' => '–', + '—' => '—', + '―' => '―', + '‖' => '‖', + '‘' => '‘', + '’' => '’', + '‚' => '‚', + '“' => '“', + '”' => '”', + '„' => '„', + '†' => '†', + '‡' => '‡', + '•' => '•', + '‥' => '‥', + '…' => '…', + '‰' => '‰', + '‱' => '‱', + '′' => '′', + '″' => '″', + '‴' => '‴', + '‵' => '‵', + '‹' => '‹', + '›' => '›', + '‾' => '‾', + '⁁' => '⁁', + '⁃' => '⁃', + '⁄' => '⁄', + '⁏' => '⁏', + '⁗' => '⁗', + ' ' => ' ', + ' ' => '&ThickSpace', + '' => '⁠', + '' => '⁡', + '' => '⁢', + '' => '⁣', + '€' => '€', + '⃛' => '⃛', + '⃜' => '⃜', + 'ℂ' => 'ℂ', + '℅' => '℅', + 'ℊ' => 'ℊ', + 'ℋ' => 'ℋ', + 'ℌ' => 'ℌ', + 'ℍ' => 'ℍ', + 'ℎ' => 'ℎ', + 'ℏ' => 'ℏ', + 'ℐ' => 'ℐ', + 'ℑ' => 'ℑ', + 'ℒ' => 'ℒ', + 'ℓ' => 'ℓ', + 'ℕ' => 'ℕ', + '№' => '№', + '℗' => '℗', + '℘' => '℘', + 'ℙ' => 'ℙ', + 'ℚ' => 'ℚ', + 'ℛ' => 'ℛ', + 'ℜ' => 'ℜ', + 'ℝ' => 'ℝ', + '℞' => '℞', + '™' => '™', + 'ℤ' => 'ℤ', + '℧' => '℧', + 'ℨ' => 'ℨ', + '℩' => '℩', + 'ℬ' => 'ℬ', + 'ℭ' => 'ℭ', + 'ℯ' => 'ℯ', + 'ℰ' => 'ℰ', + 'ℱ' => 'ℱ', + 'ℳ' => 'ℳ', + 'ℴ' => 'ℴ', + 'ℵ' => 'ℵ', + 'ℶ' => 'ℶ', + 'ℷ' => 'ℷ', + 'ℸ' => 'ℸ', + 'ⅅ' => 'ⅅ', + 'ⅆ' => 'ⅆ', + 'ⅇ' => 'ⅇ', + 'ⅈ' => 'ⅈ', + '⅓' => '⅓', + '⅔' => '⅔', + '⅕' => '⅕', + '⅖' => '⅖', + '⅗' => '⅗', + '⅘' => '⅘', + '⅙' => '⅙', + '⅚' => '⅚', + '⅛' => '⅛', + '⅜' => '⅜', + '⅝' => '⅝', + '⅞' => '⅞', + '←' => '←', + '↑' => '↑', + '→' => '→', + '↓' => '↓', + '↔' => '↔', + '↕' => '↕', + '↖' => '↖', + '↗' => '↗', + '↘' => '↘', + '↙' => '↙', + '↚' => '↚', + '↛' => '↛', + '↝' => '↝', + '↝̸' => '&nrarrw', + '↞' => '↞', + '↟' => '↟', + '↠' => '↠', + '↡' => '↡', + '↢' => '↢', + '↣' => '↣', + '↤' => '↤', + '↥' => '↥', + '↦' => '↦', + '↧' => '↧', + '↩' => '↩', + '↪' => '↪', + '↫' => '↫', + '↬' => '↬', + '↭' => '↭', + '↮' => '↮', + '↰' => '↰', + '↱' => '↱', + '↲' => '↲', + '↳' => '↳', + '↵' => '↵', + '↶' => '↶', + '↷' => '↷', + '↺' => '↺', + '↻' => '↻', + '↼' => '↼', + '↽' => '↽', + '↾' => '↾', + '↿' => '↿', + '⇀' => '⇀', + '⇁' => '⇁', + '⇂' => '⇂', + '⇃' => '⇃', + '⇄' => '⇄', + '⇅' => '⇅', + '⇆' => '⇆', + '⇇' => '⇇', + '⇈' => '⇈', + '⇉' => '⇉', + '⇊' => '⇊', + '⇋' => '⇋', + '⇌' => '⇌', + '⇍' => '⇍', + '⇎' => '⇎', + '⇏' => '⇏', + '⇐' => '⇐', + '⇑' => '⇑', + '⇒' => '⇒', + '⇓' => '⇓', + '⇔' => '⇔', + '⇕' => '⇕', + '⇖' => '⇖', + '⇗' => '⇗', + '⇘' => '⇘', + '⇙' => '⇙', + '⇚' => '⇚', + '⇛' => '⇛', + '⇝' => '⇝', + '⇤' => '⇤', + '⇥' => '⇥', + '⇵' => '⇵', + '⇽' => '⇽', + '⇾' => '⇾', + '⇿' => '⇿', + '∀' => '∀', + '∁' => '∁', + '∂' => '∂', + '∂̸' => '&npart', + '∃' => '∃', + '∄' => '∄', + '∅' => '∅', + '∇' => '∇', + '∈' => '∈', + '∉' => '∉', + '∋' => '∋', + '∌' => '∌', + '∏' => '∏', + '∐' => '∐', + '∑' => '∑', + '−' => '−', + '∓' => '∓', + '∔' => '∔', + '∖' => '∖', + '∗' => '∗', + '∘' => '∘', + '√' => '√', + '∝' => '∝', + '∞' => '∞', + '∟' => '∟', + '∠' => '∠', + '∠⃒' => '&nang', + '∡' => '∡', + '∢' => '∢', + '∣' => '∣', + '∤' => '∤', + '∥' => '∥', + '∦' => '∦', + '∧' => '∧', + '∨' => '∨', + '∩' => '∩', + '∩︀' => '&caps', + '∪' => '∪', + '∪︀' => '&cups', + '∫' => '∫', + '∬' => '∬', + '∭' => '∭', + '∮' => '∮', + '∯' => '∯', + '∰' => '∰', + '∱' => '∱', + '∲' => '∲', + '∳' => '∳', + '∴' => '∴', + '∵' => '∵', + '∶' => '∶', + '∷' => '∷', + '∸' => '∸', + '∺' => '∺', + '∻' => '∻', + '∼' => '∼', + '∼⃒' => '&nvsim', + '∽' => '∽', + '∽̱' => '&race', + '∾' => '∾', + '∾̳' => '&acE', + '∿' => '∿', + '≀' => '≀', + '≁' => '≁', + '≂' => '≂', + '≂̸' => '&nesim', + '≃' => '≃', + '≄' => '≄', + '≅' => '≅', + '≆' => '≆', + '≇' => '≇', + '≈' => '≈', + '≉' => '≉', + '≊' => '≊', + '≋' => '≋', + '≋̸' => '&napid', + '≌' => '≌', + '≍' => '≍', + '≍⃒' => '&nvap', + '≎' => '≎', + '≎̸' => '&nbump', + '≏' => '≏', + '≏̸' => '&nbumpe', + '≐' => '≐', + '≐̸' => '&nedot', + '≑' => '≑', + '≒' => '≒', + '≓' => '≓', + '≔' => '≔', + '≕' => '≕', + '≖' => '≖', + '≗' => '≗', + '≙' => '≙', + '≚' => '≚', + '≜' => '≜', + '≟' => '≟', + '≠' => '≠', + '≡' => '≡', + '≡⃥' => '&bnequiv', + '≢' => '≢', + '≤' => '≤', + '≤⃒' => '&nvle', + '≥' => '≥', + '≥⃒' => '&nvge', + '≦' => '≦', + '≦̸' => '&nlE', + '≧' => '≧', + '≧̸' => '&NotGreaterFullEqual', + '≨' => '≨', + '≨︀' => '&lvertneqq', + '≩' => '≩', + '≩︀' => '&gvertneqq', + '≪' => '≪', + '≪̸' => '&nLtv', + '≪⃒' => '&nLt', + '≫' => '≫', + '≫̸' => '&NotGreaterGreater', + '≫⃒' => '&nGt', + '≬' => '≬', + '≭' => '≭', + '≮' => '≮', + '≯' => '≯', + '≰' => '≰', + '≱' => '≱', + '≲' => '≲', + '≳' => '≳', + '≴' => '≴', + '≵' => '≵', + '≶' => '≶', + '≷' => '≷', + '≸' => '≸', + '≹' => '≹', + '≺' => '≺', + '≻' => '≻', + '≼' => '≼', + '≽' => '≽', + '≾' => '≾', + '≿' => '≿', + '≿̸' => '&NotSucceedsTilde', + '⊀' => '⊀', + '⊁' => '⊁', + '⊂' => '⊂', + '⊂⃒' => '&vnsub', + '⊃' => '⊃', + '⊃⃒' => '&nsupset', + '⊄' => '⊄', + '⊅' => '⊅', + '⊆' => '⊆', + '⊇' => '⊇', + '⊈' => '⊈', + '⊉' => '⊉', + '⊊' => '⊊', + '⊊︀' => '&vsubne', + '⊋' => '⊋', + '⊋︀' => '&vsupne', + '⊍' => '⊍', + '⊎' => '⊎', + '⊏' => '⊏', + '⊏̸' => '&NotSquareSubset', + '⊐' => '⊐', + '⊐̸' => '&NotSquareSuperset', + '⊑' => '⊑', + '⊒' => '⊒', + '⊓' => '⊓', + '⊓︀' => '&sqcaps', + '⊔' => '⊔', + '⊔︀' => '&sqcups', + '⊕' => '⊕', + '⊖' => '⊖', + '⊗' => '⊗', + '⊘' => '⊘', + '⊙' => '⊙', + '⊚' => '⊚', + '⊛' => '⊛', + '⊝' => '⊝', + '⊞' => '⊞', + '⊟' => '⊟', + '⊠' => '⊠', + '⊡' => '⊡', + '⊢' => '⊢', + '⊣' => '⊣', + '⊤' => '⊤', + '⊥' => '⊥', + '⊧' => '⊧', + '⊨' => '⊨', + '⊩' => '⊩', + '⊪' => '⊪', + '⊫' => '⊫', + '⊬' => '⊬', + '⊭' => '⊭', + '⊮' => '⊮', + '⊯' => '⊯', + '⊰' => '⊰', + '⊲' => '⊲', + '⊳' => '⊳', + '⊴' => '⊴', + '⊴⃒' => '&nvltrie', + '⊵' => '⊵', + '⊵⃒' => '&nvrtrie', + '⊶' => '⊶', + '⊷' => '⊷', + '⊸' => '⊸', + '⊹' => '⊹', + '⊺' => '⊺', + '⊻' => '⊻', + '⊽' => '⊽', + '⊾' => '⊾', + '⊿' => '⊿', + '⋀' => '⋀', + '⋁' => '⋁', + '⋂' => '⋂', + '⋃' => '⋃', + '⋄' => '⋄', + '⋅' => '⋅', + '⋆' => '⋆', + '⋇' => '⋇', + '⋈' => '⋈', + '⋉' => '⋉', + '⋊' => '⋊', + '⋋' => '⋋', + '⋌' => '⋌', + '⋍' => '⋍', + '⋎' => '⋎', + '⋏' => '⋏', + '⋐' => '⋐', + '⋑' => '⋑', + '⋒' => '⋒', + '⋓' => '⋓', + '⋔' => '⋔', + '⋕' => '⋕', + '⋖' => '⋖', + '⋗' => '⋗', + '⋘' => '⋘', + '⋘̸' => '&nLl', + '⋙' => '⋙', + '⋙̸' => '&nGg', + '⋚' => '⋚', + '⋚︀' => '&lesg', + '⋛' => '⋛', + '⋛︀' => '&gesl', + '⋞' => '⋞', + '⋟' => '⋟', + '⋠' => '⋠', + '⋡' => '⋡', + '⋢' => '⋢', + '⋣' => '⋣', + '⋦' => '⋦', + '⋧' => '⋧', + '⋨' => '⋨', + '⋩' => '⋩', + '⋪' => '⋪', + '⋫' => '⋫', + '⋬' => '⋬', + '⋭' => '⋭', + '⋮' => '⋮', + '⋯' => '⋯', + '⋰' => '⋰', + '⋱' => '⋱', + '⋲' => '⋲', + '⋳' => '⋳', + '⋴' => '⋴', + '⋵' => '⋵', + '⋵̸' => '¬indot', + '⋶' => '⋶', + '⋷' => '⋷', + '⋹' => '⋹', + '⋹̸' => '¬inE', + '⋺' => '⋺', + '⋻' => '⋻', + '⋼' => '⋼', + '⋽' => '⋽', + '⋾' => '⋾', + '⌅' => '⌅', + '⌆' => '⌆', + '⌈' => '⌈', + '⌉' => '⌉', + '⌊' => '⌊', + '⌋' => '⌋', + '⌌' => '⌌', + '⌍' => '⌍', + '⌎' => '⌎', + '⌏' => '⌏', + '⌐' => '⌐', + '⌒' => '⌒', + '⌓' => '⌓', + '⌕' => '⌕', + '⌖' => '⌖', + '⌜' => '⌜', + '⌝' => '⌝', + '⌞' => '⌞', + '⌟' => '⌟', + '⌢' => '⌢', + '⌣' => '⌣', + '⌭' => '⌭', + '⌮' => '⌮', + '⌶' => '⌶', + '⌽' => '⌽', + '⌿' => '⌿', + '⍼' => '⍼', + '⎰' => '⎰', + '⎱' => '⎱', + '⎴' => '⎴', + '⎵' => '⎵', + '⎶' => '⎶', + '⏜' => '⏜', + '⏝' => '⏝', + '⏞' => '⏞', + '⏟' => '⏟', + '⏢' => '⏢', + '⏧' => '⏧', + '␣' => '␣', + 'Ⓢ' => 'Ⓢ', + '─' => '─', + '│' => '│', + '┌' => '┌', + '┐' => '┐', + '└' => '└', + '┘' => '┘', + '├' => '├', + '┤' => '┤', + '┬' => '┬', + '┴' => '┴', + '┼' => '┼', + '═' => '═', + '║' => '║', + '╒' => '╒', + '╓' => '╓', + '╔' => '╔', + '╕' => '╕', + '╖' => '╖', + '╗' => '╗', + '╘' => '╘', + '╙' => '╙', + '╚' => '╚', + '╛' => '╛', + '╜' => '╜', + '╝' => '╝', + '╞' => '╞', + '╟' => '╟', + '╠' => '╠', + '╡' => '╡', + '╢' => '╢', + '╣' => '╣', + '╤' => '╤', + '╥' => '╥', + '╦' => '╦', + '╧' => '╧', + '╨' => '╨', + '╩' => '╩', + '╪' => '╪', + '╫' => '╫', + '╬' => '╬', + '▀' => '▀', + '▄' => '▄', + '█' => '█', + '░' => '░', + '▒' => '▒', + '▓' => '▓', + '□' => '□', + '▪' => '▪', + '▫' => '▫', + '▭' => '▭', + '▮' => '▮', + '▱' => '▱', + '△' => '△', + '▴' => '▴', + '▵' => '▵', + '▸' => '▸', + '▹' => '▹', + '▽' => '▽', + '▾' => '▾', + '▿' => '▿', + '◂' => '◂', + '◃' => '◃', + '◊' => '◊', + '○' => '○', + '◬' => '◬', + '◯' => '◯', + '◸' => '◸', + '◹' => '◹', + '◺' => '◺', + '◻' => '◻', + '◼' => '◼', + '★' => '★', + '☆' => '☆', + '☎' => '☎', + '♀' => '♀', + '♂' => '♂', + '♠' => '♠', + '♣' => '♣', + '♥' => '♥', + '♦' => '♦', + '♪' => '♪', + '♭' => '♭', + '♮' => '♮', + '♯' => '♯', + '✓' => '✓', + '✗' => '✗', + '✠' => '✠', + '✶' => '✶', + '❘' => '❘', + '❲' => '❲', + '❳' => '❳', + '⟈' => '⟈', + '⟉' => '⟉', + '⟦' => '⟦', + '⟧' => '⟧', + '⟨' => '⟨', + '⟩' => '⟩', + '⟪' => '⟪', + '⟫' => '⟫', + '⟬' => '⟬', + '⟭' => '⟭', + '⟵' => '⟵', + '⟶' => '⟶', + '⟷' => '⟷', + '⟸' => '⟸', + '⟹' => '⟹', + '⟺' => '⟺', + '⟼' => '⟼', + '⟿' => '⟿', + '⤂' => '⤂', + '⤃' => '⤃', + '⤄' => '⤄', + '⤅' => '⤅', + '⤌' => '⤌', + '⤍' => '⤍', + '⤎' => '⤎', + '⤏' => '⤏', + '⤐' => '⤐', + '⤑' => '⤑', + '⤒' => '⤒', + '⤓' => '⤓', + '⤖' => '⤖', + '⤙' => '⤙', + '⤚' => '⤚', + '⤛' => '⤛', + '⤜' => '⤜', + '⤝' => '⤝', + '⤞' => '⤞', + '⤟' => '⤟', + '⤠' => '⤠', + '⤣' => '⤣', + '⤤' => '⤤', + '⤥' => '⤥', + '⤦' => '⤦', + '⤧' => '⤧', + '⤨' => '⤨', + '⤩' => '⤩', + '⤪' => '⤪', + '⤳' => '⤳', + '⤳̸' => '&nrarrc', + '⤵' => '⤵', + '⤶' => '⤶', + '⤷' => '⤷', + '⤸' => '⤸', + '⤹' => '⤹', + '⤼' => '⤼', + '⤽' => '⤽', + '⥅' => '⥅', + '⥈' => '⥈', + '⥉' => '⥉', + '⥊' => '⥊', + '⥋' => '⥋', + '⥎' => '⥎', + '⥏' => '⥏', + '⥐' => '⥐', + '⥑' => '⥑', + '⥒' => '⥒', + '⥓' => '⥓', + '⥔' => '⥔', + '⥕' => '⥕', + '⥖' => '⥖', + '⥗' => '⥗', + '⥘' => '⥘', + '⥙' => '⥙', + '⥚' => '⥚', + '⥛' => '⥛', + '⥜' => '⥜', + '⥝' => '⥝', + '⥞' => '⥞', + '⥟' => '⥟', + '⥠' => '⥠', + '⥡' => '⥡', + '⥢' => '⥢', + '⥣' => '⥣', + '⥤' => '⥤', + '⥥' => '⥥', + '⥦' => '⥦', + '⥧' => '⥧', + '⥨' => '⥨', + '⥩' => '⥩', + '⥪' => '⥪', + '⥫' => '⥫', + '⥬' => '⥬', + '⥭' => '⥭', + '⥮' => '⥮', + '⥯' => '⥯', + '⥰' => '⥰', + '⥱' => '⥱', + '⥲' => '⥲', + '⥳' => '⥳', + '⥴' => '⥴', + '⥵' => '⥵', + '⥶' => '⥶', + '⥸' => '⥸', + '⥹' => '⥹', + '⥻' => '⥻', + '⥼' => '⥼', + '⥽' => '⥽', + '⥾' => '⥾', + '⥿' => '⥿', + '⦅' => '⦅', + '⦆' => '⦆', + '⦋' => '⦋', + '⦌' => '⦌', + '⦍' => '⦍', + '⦎' => '⦎', + '⦏' => '⦏', + '⦐' => '⦐', + '⦑' => '⦑', + '⦒' => '⦒', + '⦓' => '⦓', + '⦔' => '⦔', + '⦕' => '⦕', + '⦖' => '⦖', + '⦚' => '⦚', + '⦜' => '⦜', + '⦝' => '⦝', + '⦤' => '⦤', + '⦥' => '⦥', + '⦦' => '⦦', + '⦧' => '⦧', + '⦨' => '⦨', + '⦩' => '⦩', + '⦪' => '⦪', + '⦫' => '⦫', + '⦬' => '⦬', + '⦭' => '⦭', + '⦮' => '⦮', + '⦯' => '⦯', + '⦰' => '⦰', + '⦱' => '⦱', + '⦲' => '⦲', + '⦳' => '⦳', + '⦴' => '⦴', + '⦵' => '⦵', + '⦶' => '⦶', + '⦷' => '⦷', + '⦹' => '⦹', + '⦻' => '⦻', + '⦼' => '⦼', + '⦾' => '⦾', + '⦿' => '⦿', + '⧀' => '⧀', + '⧁' => '⧁', + '⧂' => '⧂', + '⧃' => '⧃', + '⧄' => '⧄', + '⧅' => '⧅', + '⧉' => '⧉', + '⧍' => '⧍', + '⧎' => '⧎', + '⧏' => '⧏', + '⧏̸' => '&NotLeftTriangleBar', + '⧐' => '⧐', + '⧐̸' => '&NotRightTriangleBar', + '⧜' => '⧜', + '⧝' => '⧝', + '⧞' => '⧞', + '⧣' => '⧣', + '⧤' => '⧤', + '⧥' => '⧥', + '⧫' => '⧫', + '⧴' => '⧴', + '⧶' => '⧶', + '⨀' => '⨀', + '⨁' => '⨁', + '⨂' => '⨂', + '⨄' => '⨄', + '⨆' => '⨆', + '⨌' => '⨌', + '⨍' => '⨍', + '⨐' => '⨐', + '⨑' => '⨑', + '⨒' => '⨒', + '⨓' => '⨓', + '⨔' => '⨔', + '⨕' => '⨕', + '⨖' => '⨖', + '⨗' => '⨗', + '⨢' => '⨢', + '⨣' => '⨣', + '⨤' => '⨤', + '⨥' => '⨥', + '⨦' => '⨦', + '⨧' => '⨧', + '⨩' => '⨩', + '⨪' => '⨪', + '⨭' => '⨭', + '⨮' => '⨮', + '⨯' => '⨯', + '⨰' => '⨰', + '⨱' => '⨱', + '⨳' => '⨳', + '⨴' => '⨴', + '⨵' => '⨵', + '⨶' => '⨶', + '⨷' => '⨷', + '⨸' => '⨸', + '⨹' => '⨹', + '⨺' => '⨺', + '⨻' => '⨻', + '⨼' => '⨼', + '⨿' => '⨿', + '⩀' => '⩀', + '⩂' => '⩂', + '⩃' => '⩃', + '⩄' => '⩄', + '⩅' => '⩅', + '⩆' => '⩆', + '⩇' => '⩇', + '⩈' => '⩈', + '⩉' => '⩉', + '⩊' => '⩊', + '⩋' => '⩋', + '⩌' => '⩌', + '⩍' => '⩍', + '⩐' => '⩐', + '⩓' => '⩓', + '⩔' => '⩔', + '⩕' => '⩕', + '⩖' => '⩖', + '⩗' => '⩗', + '⩘' => '⩘', + '⩚' => '⩚', + '⩛' => '⩛', + '⩜' => '⩜', + '⩝' => '⩝', + '⩟' => '⩟', + '⩦' => '⩦', + '⩪' => '⩪', + '⩭' => '⩭', + '⩭̸' => '&ncongdot', + '⩮' => '⩮', + '⩯' => '⩯', + '⩰' => '⩰', + '⩰̸' => '&napE', + '⩱' => '⩱', + '⩲' => '⩲', + '⩳' => '⩳', + '⩴' => '⩴', + '⩵' => '⩵', + '⩷' => '⩷', + '⩸' => '⩸', + '⩹' => '⩹', + '⩺' => '⩺', + '⩻' => '⩻', + '⩼' => '⩼', + '⩽' => '⩽', + '⩽̸' => '&nles', + '⩾' => '⩾', + '⩾̸' => '&nges', + '⩿' => '⩿', + '⪀' => '⪀', + '⪁' => '⪁', + '⪂' => '⪂', + '⪃' => '⪃', + '⪄' => '⪄', + '⪅' => '⪅', + '⪆' => '⪆', + '⪇' => '⪇', + '⪈' => '⪈', + '⪉' => '⪉', + '⪊' => '⪊', + '⪋' => '⪋', + '⪌' => '⪌', + '⪍' => '⪍', + '⪎' => '⪎', + '⪏' => '⪏', + '⪐' => '⪐', + '⪑' => '⪑', + '⪒' => '⪒', + '⪓' => '⪓', + '⪔' => '⪔', + '⪕' => '⪕', + '⪖' => '⪖', + '⪗' => '⪗', + '⪘' => '⪘', + '⪙' => '⪙', + '⪚' => '⪚', + '⪝' => '⪝', + '⪞' => '⪞', + '⪟' => '⪟', + '⪠' => '⪠', + '⪡' => '⪡', + '⪡̸' => '&NotNestedLessLess', + '⪢' => '⪢', + '⪢̸' => '&NotNestedGreaterGreater', + '⪤' => '⪤', + '⪥' => '⪥', + '⪦' => '⪦', + '⪧' => '⪧', + '⪨' => '⪨', + '⪩' => '⪩', + '⪪' => '⪪', + '⪫' => '⪫', + '⪬' => '⪬', + '⪬︀' => '&smtes', + '⪭' => '⪭', + '⪭︀' => '&lates', + '⪮' => '⪮', + '⪯' => '⪯', + '⪯̸' => '&NotPrecedesEqual', + '⪰' => '⪰', + '⪰̸' => '&NotSucceedsEqual', + '⪳' => '⪳', + '⪴' => '⪴', + '⪵' => '⪵', + '⪶' => '⪶', + '⪷' => '⪷', + '⪸' => '⪸', + '⪹' => '⪹', + '⪺' => '⪺', + '⪻' => '⪻', + '⪼' => '⪼', + '⪽' => '⪽', + '⪾' => '⪾', + '⪿' => '⪿', + '⫀' => '⫀', + '⫁' => '⫁', + '⫂' => '⫂', + '⫃' => '⫃', + '⫄' => '⫄', + '⫅' => '⫅', + '⫅̸' => '&nsubE', + '⫆' => '⫆', + '⫆̸' => '&nsupseteqq', + '⫇' => '⫇', + '⫈' => '⫈', + '⫋' => '⫋', + '⫋︀' => '&vsubnE', + '⫌' => '⫌', + '⫌︀' => '&varsupsetneqq', + '⫏' => '⫏', + '⫐' => '⫐', + '⫑' => '⫑', + '⫒' => '⫒', + '⫓' => '⫓', + '⫔' => '⫔', + '⫕' => '⫕', + '⫖' => '⫖', + '⫗' => '⫗', + '⫘' => '⫘', + '⫙' => '⫙', + '⫚' => '⫚', + '⫛' => '⫛', + '⫤' => '⫤', + '⫦' => '⫦', + '⫧' => '⫧', + '⫨' => '⫨', + '⫩' => '⫩', + '⫫' => '⫫', + '⫬' => '⫬', + '⫭' => '⫭', + '⫮' => '⫮', + '⫯' => '⫯', + '⫰' => '⫰', + '⫱' => '⫱', + '⫲' => '⫲', + '⫳' => '⫳', + '⫽︀' => '&varsupsetneqq', + 'ff' => 'ff', + 'fi' => 'fi', + 'fl' => 'fl', + 'ffi' => 'ffi', + 'ffl' => 'ffl', + '𝒜' => '𝒜', + '𝒞' => '𝒞', + '𝒟' => '𝒟', + '𝒢' => '𝒢', + '𝒥' => '𝒥', + '𝒦' => '𝒦', + '𝒩' => '𝒩', + '𝒪' => '𝒪', + '𝒫' => '𝒫', + '𝒬' => '𝒬', + '𝒮' => '𝒮', + '𝒯' => '𝒯', + '𝒰' => '𝒰', + '𝒱' => '𝒱', + '𝒲' => '𝒲', + '𝒳' => '𝒳', + '𝒴' => '𝒴', + '𝒵' => '𝒵', + '𝒶' => '𝒶', + '𝒷' => '𝒷', + '𝒸' => '𝒸', + '𝒹' => '𝒹', + '𝒻' => '𝒻', + '𝒽' => '𝒽', + '𝒾' => '𝒾', + '𝒿' => '𝒿', + '𝓀' => '𝓀', + '𝓁' => '𝓁', + '𝓂' => '𝓂', + '𝓃' => '𝓃', + '𝓅' => '𝓅', + '𝓆' => '𝓆', + '𝓇' => '𝓇', + '𝓈' => '𝓈', + '𝓉' => '𝓉', + '𝓊' => '𝓊', + '𝓋' => '𝓋', + '𝓌' => '𝓌', + '𝓍' => '𝓍', + '𝓎' => '𝓎', + '𝓏' => '𝓏', + '𝔄' => '𝔄', + '𝔅' => '𝔅', + '𝔇' => '𝔇', + '𝔈' => '𝔈', + '𝔉' => '𝔉', + '𝔊' => '𝔊', + '𝔍' => '𝔍', + '𝔎' => '𝔎', + '𝔏' => '𝔏', + '𝔐' => '𝔐', + '𝔑' => '𝔑', + '𝔒' => '𝔒', + '𝔓' => '𝔓', + '𝔔' => '𝔔', + '𝔖' => '𝔖', + '𝔗' => '𝔗', + '𝔘' => '𝔘', + '𝔙' => '𝔙', + '𝔚' => '𝔚', + '𝔛' => '𝔛', + '𝔜' => '𝔜', + '𝔞' => '𝔞', + '𝔟' => '𝔟', + '𝔠' => '𝔠', + '𝔡' => '𝔡', + '𝔢' => '𝔢', + '𝔣' => '𝔣', + '𝔤' => '𝔤', + '𝔥' => '𝔥', + '𝔦' => '𝔦', + '𝔧' => '𝔧', + '𝔨' => '𝔨', + '𝔩' => '𝔩', + '𝔪' => '𝔪', + '𝔫' => '𝔫', + '𝔬' => '𝔬', + '𝔭' => '𝔭', + '𝔮' => '𝔮', + '𝔯' => '𝔯', + '𝔰' => '𝔰', + '𝔱' => '𝔱', + '𝔲' => '𝔲', + '𝔳' => '𝔳', + '𝔴' => '𝔴', + '𝔵' => '𝔵', + '𝔶' => '𝔶', + '𝔷' => '𝔷', + '𝔸' => '𝔸', + '𝔹' => '𝔹', + '𝔻' => '𝔻', + '𝔼' => '𝔼', + '𝔽' => '𝔽', + '𝔾' => '𝔾', + '𝕀' => '𝕀', + '𝕁' => '𝕁', + '𝕂' => '𝕂', + '𝕃' => '𝕃', + '𝕄' => '𝕄', + '𝕆' => '𝕆', + '𝕊' => '𝕊', + '𝕋' => '𝕋', + '𝕌' => '𝕌', + '𝕍' => '𝕍', + '𝕎' => '𝕎', + '𝕏' => '𝕏', + '𝕐' => '𝕐', + '𝕒' => '𝕒', + '𝕓' => '𝕓', + '𝕔' => '𝕔', + '𝕕' => '𝕕', + '𝕖' => '𝕖', + '𝕗' => '𝕗', + '𝕘' => '𝕘', + '𝕙' => '𝕙', + '𝕚' => '𝕚', + '𝕛' => '𝕛', + '𝕜' => '𝕜', + '𝕝' => '𝕝', + '𝕞' => '𝕞', + '𝕟' => '𝕟', + '𝕠' => '𝕠', + '𝕡' => '𝕡', + '𝕢' => '𝕢', + '𝕣' => '𝕣', + '𝕤' => '𝕤', + '𝕥' => '𝕥', + '𝕦' => '𝕦', + '𝕧' => '𝕧', + '𝕨' => '𝕨', + '𝕩' => '𝕩', + '𝕪' => '𝕪', + '𝕫' => '𝕫', + ); +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php new file mode 100644 index 000000000..ec467f22c --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php @@ -0,0 +1,553 @@ +<?php +/** + * @file + * The rules for generating output in the serializer. + * + * These output rules are likely to generate output similar to the document that + * was parsed. It is not intended to output exactly the document that was parsed. + */ + +namespace Masterminds\HTML5\Serializer; + +use Masterminds\HTML5\Elements; + +/** + * Generate the output html5 based on element rules. + */ +class OutputRules implements RulesInterface +{ + /** + * Defined in http://www.w3.org/TR/html51/infrastructure.html#html-namespace-0. + */ + const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml'; + + const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML'; + + const NAMESPACE_SVG = 'http://www.w3.org/2000/svg'; + + const NAMESPACE_XLINK = 'http://www.w3.org/1999/xlink'; + + const NAMESPACE_XML = 'http://www.w3.org/XML/1998/namespace'; + + const NAMESPACE_XMLNS = 'http://www.w3.org/2000/xmlns/'; + + /** + * Holds the HTML5 element names that causes a namespace switch. + * + * @var array + */ + protected $implicitNamespaces = array( + self::NAMESPACE_HTML, + self::NAMESPACE_SVG, + self::NAMESPACE_MATHML, + self::NAMESPACE_XML, + self::NAMESPACE_XMLNS, + ); + + const IM_IN_HTML = 1; + + const IM_IN_SVG = 2; + + const IM_IN_MATHML = 3; + + /** + * Used as cache to detect if is available ENT_HTML5. + * + * @var bool + */ + private $hasHTML5 = false; + + protected $traverser; + + protected $encode = false; + + protected $out; + + protected $outputMode; + + private $xpath; + + protected $nonBooleanAttributes = array( + /* + array( + 'nodeNamespace'=>'http://www.w3.org/1999/xhtml', + 'attrNamespace'=>'http://www.w3.org/1999/xhtml', + + 'nodeName'=>'img', 'nodeName'=>array('img', 'a'), + 'attrName'=>'alt', 'attrName'=>array('title', 'alt'), + ), + */ + array( + 'nodeNamespace' => 'http://www.w3.org/1999/xhtml', + 'attrName' => array('href', + 'hreflang', + 'http-equiv', + 'icon', + 'id', + 'keytype', + 'kind', + 'label', + 'lang', + 'language', + 'list', + 'maxlength', + 'media', + 'method', + 'name', + 'placeholder', + 'rel', + 'rows', + 'rowspan', + 'sandbox', + 'spellcheck', + 'scope', + 'seamless', + 'shape', + 'size', + 'sizes', + 'span', + 'src', + 'srcdoc', + 'srclang', + 'srcset', + 'start', + 'step', + 'style', + 'summary', + 'tabindex', + 'target', + 'title', + 'type', + 'value', + 'width', + 'border', + 'charset', + 'cite', + 'class', + 'code', + 'codebase', + 'color', + 'cols', + 'colspan', + 'content', + 'coords', + 'data', + 'datetime', + 'default', + 'dir', + 'dirname', + 'enctype', + 'for', + 'form', + 'formaction', + 'headers', + 'height', + 'accept', + 'accept-charset', + 'accesskey', + 'action', + 'align', + 'alt', + 'bgcolor', + ), + ), + array( + 'nodeNamespace' => 'http://www.w3.org/1999/xhtml', + 'xpath' => 'starts-with(local-name(), \'data-\')', + ), + ); + + const DOCTYPE = '<!DOCTYPE html>'; + + public function __construct($output, $options = array()) + { + if (isset($options['encode_entities'])) { + $this->encode = $options['encode_entities']; + } + + $this->outputMode = static::IM_IN_HTML; + $this->out = $output; + $this->hasHTML5 = defined('ENT_HTML5'); + } + + public function addRule(array $rule) + { + $this->nonBooleanAttributes[] = $rule; + } + + public function setTraverser(Traverser $traverser) + { + $this->traverser = $traverser; + + return $this; + } + + public function unsetTraverser() + { + $this->traverser = null; + + return $this; + } + + public function document($dom) + { + $this->doctype(); + if ($dom->documentElement) { + foreach ($dom->childNodes as $node) { + $this->traverser->node($node); + } + $this->nl(); + } + } + + protected function doctype() + { + $this->wr(static::DOCTYPE); + $this->nl(); + } + + public function element($ele) + { + $name = $ele->tagName; + + // Per spec: + // If the element has a declared namespace in the HTML, MathML or + // SVG namespaces, we use the lname instead of the tagName. + if ($this->traverser->isLocalElement($ele)) { + $name = $ele->localName; + } + + // If we are in SVG or MathML there is special handling. + // Using if/elseif instead of switch because it's faster in PHP. + if ('svg' == $name) { + $this->outputMode = static::IM_IN_SVG; + $name = Elements::normalizeSvgElement($name); + } elseif ('math' == $name) { + $this->outputMode = static::IM_IN_MATHML; + } + + $this->openTag($ele); + if (Elements::isA($name, Elements::TEXT_RAW)) { + foreach ($ele->childNodes as $child) { + if ($child instanceof \DOMCharacterData) { + $this->wr($child->data); + } elseif ($child instanceof \DOMElement) { + $this->element($child); + } + } + } else { + // Handle children. + if ($ele->hasChildNodes()) { + $this->traverser->children($ele->childNodes); + } + + // Close out the SVG or MathML special handling. + if ('svg' == $name || 'math' == $name) { + $this->outputMode = static::IM_IN_HTML; + } + } + + // If not unary, add a closing tag. + if (!Elements::isA($name, Elements::VOID_TAG)) { + $this->closeTag($ele); + } + } + + /** + * Write a text node. + * + * @param \DOMText $ele The text node to write. + */ + public function text($ele) + { + if (isset($ele->parentNode) && isset($ele->parentNode->tagName) && Elements::isA($ele->parentNode->localName, Elements::TEXT_RAW)) { + $this->wr($ele->data); + + return; + } + + // FIXME: This probably needs some flags set. + $this->wr($this->enc($ele->data)); + } + + public function cdata($ele) + { + // This encodes CDATA. + $this->wr($ele->ownerDocument->saveXML($ele)); + } + + public function comment($ele) + { + // These produce identical output. + // $this->wr('<!--')->wr($ele->data)->wr('-->'); + $this->wr($ele->ownerDocument->saveXML($ele)); + } + + public function processorInstruction($ele) + { + $this->wr('<?') + ->wr($ele->target) + ->wr(' ') + ->wr($ele->data) + ->wr('?>'); + } + + /** + * Write the namespace attributes. + * + * @param \DOMNode $ele The element being written. + */ + protected function namespaceAttrs($ele) + { + if (!$this->xpath || $this->xpath->document !== $ele->ownerDocument) { + $this->xpath = new \DOMXPath($ele->ownerDocument); + } + + foreach ($this->xpath->query('namespace::*[not(.=../../namespace::*)]', $ele) as $nsNode) { + if (!in_array($nsNode->nodeValue, $this->implicitNamespaces)) { + $this->wr(' ')->wr($nsNode->nodeName)->wr('="')->wr($nsNode->nodeValue)->wr('"'); + } + } + } + + /** + * Write the opening tag. + * + * Tags for HTML, MathML, and SVG are in the local name. Otherwise, use the + * qualified name (8.3). + * + * @param \DOMNode $ele The element being written. + */ + protected function openTag($ele) + { + $this->wr('<')->wr($this->traverser->isLocalElement($ele) ? $ele->localName : $ele->tagName); + + $this->attrs($ele); + $this->namespaceAttrs($ele); + + if ($this->outputMode == static::IM_IN_HTML) { + $this->wr('>'); + } // If we are not in html mode we are in SVG, MathML, or XML embedded content. + else { + if ($ele->hasChildNodes()) { + $this->wr('>'); + } // If there are no children this is self closing. + else { + $this->wr(' />'); + } + } + } + + protected function attrs($ele) + { + // FIXME: Needs support for xml, xmlns, xlink, and namespaced elements. + if (!$ele->hasAttributes()) { + return $this; + } + + // TODO: Currently, this always writes name="value", and does not do + // value-less attributes. + $map = $ele->attributes; + $len = $map->length; + for ($i = 0; $i < $len; ++$i) { + $node = $map->item($i); + $val = $this->enc($node->value, true); + + // XXX: The spec says that we need to ensure that anything in + // the XML, XMLNS, or XLink NS's should use the canonical + // prefix. It seems that DOM does this for us already, but there + // may be exceptions. + $name = $node->nodeName; + + // Special handling for attributes in SVG and MathML. + // Using if/elseif instead of switch because it's faster in PHP. + if ($this->outputMode == static::IM_IN_SVG) { + $name = Elements::normalizeSvgAttribute($name); + } elseif ($this->outputMode == static::IM_IN_MATHML) { + $name = Elements::normalizeMathMlAttribute($name); + } + + $this->wr(' ')->wr($name); + + if ((isset($val) && '' !== $val) || $this->nonBooleanAttribute($node)) { + $this->wr('="')->wr($val)->wr('"'); + } + } + } + + protected function nonBooleanAttribute(\DOMAttr $attr) + { + $ele = $attr->ownerElement; + foreach ($this->nonBooleanAttributes as $rule) { + if (isset($rule['nodeNamespace']) && $rule['nodeNamespace'] !== $ele->namespaceURI) { + continue; + } + if (isset($rule['attNamespace']) && $rule['attNamespace'] !== $attr->namespaceURI) { + continue; + } + if (isset($rule['nodeName']) && !is_array($rule['nodeName']) && $rule['nodeName'] !== $ele->localName) { + continue; + } + if (isset($rule['nodeName']) && is_array($rule['nodeName']) && !in_array($ele->localName, $rule['nodeName'], true)) { + continue; + } + if (isset($rule['attrName']) && !is_array($rule['attrName']) && $rule['attrName'] !== $attr->localName) { + continue; + } + if (isset($rule['attrName']) && is_array($rule['attrName']) && !in_array($attr->localName, $rule['attrName'], true)) { + continue; + } + if (isset($rule['xpath'])) { + $xp = $this->getXPath($attr); + if (isset($rule['prefixes'])) { + foreach ($rule['prefixes'] as $nsPrefix => $ns) { + $xp->registerNamespace($nsPrefix, $ns); + } + } + if (!$xp->evaluate($rule['xpath'], $attr)) { + continue; + } + } + + return true; + } + + return false; + } + + private function getXPath(\DOMNode $node) + { + if (!$this->xpath) { + $this->xpath = new \DOMXPath($node->ownerDocument); + } + + return $this->xpath; + } + + /** + * Write the closing tag. + * + * Tags for HTML, MathML, and SVG are in the local name. Otherwise, use the + * qualified name (8.3). + * + * @param \DOMNode $ele The element being written. + */ + protected function closeTag($ele) + { + if ($this->outputMode == static::IM_IN_HTML || $ele->hasChildNodes()) { + $this->wr('</')->wr($this->traverser->isLocalElement($ele) ? $ele->localName : $ele->tagName)->wr('>'); + } + } + + /** + * Write to the output. + * + * @param string $text The string to put into the output + * + * @return $this + */ + protected function wr($text) + { + fwrite($this->out, $text); + + return $this; + } + + /** + * Write a new line character. + * + * @return $this + */ + protected function nl() + { + fwrite($this->out, PHP_EOL); + + return $this; + } + + /** + * Encode text. + * + * When encode is set to false, the default value, the text passed in is + * escaped per section 8.3 of the html5 spec. For details on how text is + * escaped see the escape() method. + * + * When encoding is set to true the text is converted to named character + * references where appropriate. Section 8.1.4 Character references of the + * html5 spec refers to using named character references. This is useful for + * characters that can't otherwise legally be used in the text. + * + * The named character references are listed in section 8.5. + * + * @see http://www.w3.org/TR/2013/CR-html5-20130806/syntax.html#named-character-references True encoding will turn all named character references into their entities. + * This includes such characters as +.# and many other common ones. By default + * encoding here will just escape &'<>". + * + * Note, PHP 5.4+ has better html5 encoding. + * + * @todo Use the Entities class in php 5.3 to have html5 entities. + * + * @param string $text Text to encode. + * @param bool $attribute True if we are encoding an attrubute, false otherwise. + * + * @return string The encoded text. + */ + protected function enc($text, $attribute = false) + { + // Escape the text rather than convert to named character references. + if (!$this->encode) { + return $this->escape($text, $attribute); + } + + // If we are in PHP 5.4+ we can use the native html5 entity functionality to + // convert the named character references. + + if ($this->hasHTML5) { + return htmlentities($text, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES, 'UTF-8', false); + } // If a version earlier than 5.4 html5 entities are not entirely handled. + // This manually handles them. + else { + return strtr($text, HTML5Entities::$map); + } + } + + /** + * Escape test. + * + * According to the html5 spec section 8.3 Serializing HTML fragments, text + * within tags that are not style, script, xmp, iframe, noembed, and noframes + * need to be properly escaped. + * + * The & should be converted to &, no breaking space unicode characters + * converted to , when in attribute mode the " should be converted to + * ", and when not in attribute mode the < and > should be converted to + * < and >. + * + * @see http://www.w3.org/TR/2013/CR-html5-20130806/syntax.html#escapingString + * + * @param string $text Text to escape. + * @param bool $attribute True if we are escaping an attrubute, false otherwise. + */ + protected function escape($text, $attribute = false) + { + // Not using htmlspecialchars because, while it does escaping, it doesn't + // match the requirements of section 8.5. For example, it doesn't handle + // non-breaking spaces. + if ($attribute) { + $replace = array( + '"' => '"', + '&' => '&', + "\xc2\xa0" => ' ', + ); + } else { + $replace = array( + '<' => '<', + '>' => '>', + '&' => '&', + "\xc2\xa0" => ' ', + ); + } + + return strtr($text, $replace); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/README.md b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/README.md new file mode 100644 index 000000000..849a47f3a --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/README.md @@ -0,0 +1,33 @@ +# The Serializer (Writer) Model + +The serializer roughly follows sections _8.1 Writing HTML documents_ and section +_8.3 Serializing HTML fragments_ by converting DOMDocument, DOMDocumentFragment, +and DOMNodeList into HTML5. + + [ HTML5 ] // Interface for saving. + || + [ Traverser ] // Walk the DOM + || + [ Rules ] // Convert DOM elements into strings. + || + [ HTML5 ] // HTML5 document or fragment in text. + + +## HTML5 Class + +Provides the top level interface for saving. + +## The Traverser + +Walks the DOM finding each element and passing it off to the output rules to +convert to HTML5. + +## Output Rules + +The output rules are defined in the RulesInterface which can have multiple +implementations. Currently, the OutputRules is the default implementation that +converts a DOM as is into HTML5. + +## HTML5 String + +The output of the process it HTML5 as a string or saved to a file.
\ No newline at end of file diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php new file mode 100644 index 000000000..69a6ecdad --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php @@ -0,0 +1,99 @@ +<?php +/** + * @file + * The interface definition for Rules to generate output. + */ + +namespace Masterminds\HTML5\Serializer; + +/** + * To create a new rule set for writing output the RulesInterface needs to be implemented. + * The resulting class can be specified in the options with the key of rules. + * + * For an example implementation see Serializer\OutputRules. + */ +interface RulesInterface +{ + /** + * The class constructor. + * + * Note, before the rules can be used a traverser must be registered. + * + * @param mixed $output The output stream to write output to. + * @param array $options An array of options. + */ + public function __construct($output, $options = array()); + + /** + * Register the traverser used in but the rules. + * + * Note, only one traverser can be used by the rules. + * + * @param Traverser $traverser The traverser used in the rules. + * + * @return RulesInterface $this for the current object. + */ + public function setTraverser(Traverser $traverser); + + /** + * Write a document element (\DOMDocument). + * + * Instead of returning the result write it to the output stream ($output) + * that was passed into the constructor. + * + * @param \DOMDocument $dom + */ + public function document($dom); + + /** + * Write an element. + * + * Instead of returning the result write it to the output stream ($output) + * that was passed into the constructor. + * + * @param mixed $ele + */ + public function element($ele); + + /** + * Write a text node. + * + * Instead of returning the result write it to the output stream ($output) + * that was passed into the constructor. + * + * @param mixed $ele + */ + public function text($ele); + + /** + * Write a CDATA node. + * + * Instead of returning the result write it to the output stream ($output) + * that was passed into the constructor. + * + * @param mixed $ele + */ + public function cdata($ele); + + /** + * Write a comment node. + * + * Instead of returning the result write it to the output stream ($output) + * that was passed into the constructor. + * + * @param mixed $ele + */ + public function comment($ele); + + /** + * Write a processor instruction. + * + * To learn about processor instructions see InstructionProcessor + * + * Instead of returning the result write it to the output stream ($output) + * that was passed into the constructor. + * + * @param mixed $ele + */ + public function processorInstruction($ele); +} diff --git a/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php new file mode 100644 index 000000000..1e8d7924e --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php @@ -0,0 +1,142 @@ +<?php + +namespace Masterminds\HTML5\Serializer; + +/** + * Traverser for walking a DOM tree. + * + * This is a concrete traverser designed to convert a DOM tree into an + * HTML5 document. It is not intended to be a generic DOMTreeWalker + * implementation. + * + * @see http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#serializing-html-fragments + */ +class Traverser +{ + /** + * Namespaces that should be treated as "local" to HTML5. + */ + protected static $local_ns = array( + 'http://www.w3.org/1999/xhtml' => 'html', + 'http://www.w3.org/1998/Math/MathML' => 'math', + 'http://www.w3.org/2000/svg' => 'svg', + ); + + protected $dom; + + protected $options; + + protected $encode = false; + + protected $rules; + + protected $out; + + /** + * Create a traverser. + * + * @param \DOMNode|\DOMNodeList $dom The document or node to traverse. + * @param resource $out A stream that allows writing. The traverser will output into this + * stream. + * @param array $options An array of options for the traverser as key/value pairs. These include: + * - encode_entities: A bool to specify if full encding should happen for all named + * charachter references. Defaults to false which escapes &'<>". + * - output_rules: The path to the class handling the output rules. + */ + public function __construct($dom, $out, RulesInterface $rules, $options = array()) + { + $this->dom = $dom; + $this->out = $out; + $this->rules = $rules; + $this->options = $options; + + $this->rules->setTraverser($this); + } + + /** + * Tell the traverser to walk the DOM. + * + * @return resource $out Returns the output stream. + */ + public function walk() + { + if ($this->dom instanceof \DOMDocument) { + $this->rules->document($this->dom); + } elseif ($this->dom instanceof \DOMDocumentFragment) { + // Document fragments are a special case. Only the children need to + // be serialized. + if ($this->dom->hasChildNodes()) { + $this->children($this->dom->childNodes); + } + } // If NodeList, loop + elseif ($this->dom instanceof \DOMNodeList) { + // If this is a NodeList of DOMDocuments this will not work. + $this->children($this->dom); + } // Else assume this is a DOMNode-like datastructure. + else { + $this->node($this->dom); + } + + return $this->out; + } + + /** + * Process a node in the DOM. + * + * @param mixed $node A node implementing \DOMNode. + */ + public function node($node) + { + // A listing of types is at http://php.net/manual/en/dom.constants.php + switch ($node->nodeType) { + case XML_ELEMENT_NODE: + $this->rules->element($node); + break; + case XML_TEXT_NODE: + $this->rules->text($node); + break; + case XML_CDATA_SECTION_NODE: + $this->rules->cdata($node); + break; + case XML_PI_NODE: + $this->rules->processorInstruction($node); + break; + case XML_COMMENT_NODE: + $this->rules->comment($node); + break; + // Currently we don't support embedding DTDs. + default: + //print '<!-- Skipped -->'; + break; + } + } + + /** + * Walk through all the nodes on a node list. + * + * @param \DOMNodeList $nl A list of child elements to walk through. + */ + public function children($nl) + { + foreach ($nl as $node) { + $this->node($node); + } + } + + /** + * Is an element local? + * + * @param mixed $ele An element that implement \DOMNode. + * + * @return bool true if local and false otherwise. + */ + public function isLocalElement($ele) + { + $uri = $ele->namespaceURI; + if (empty($uri)) { + return false; + } + + return isset(static::$local_ns[$uri]); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/ElementsTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/ElementsTest.php new file mode 100644 index 000000000..08b5ee425 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/ElementsTest.php @@ -0,0 +1,485 @@ +<?php + +namespace Masterminds\HTML5\Tests; + +use Masterminds\HTML5\Elements; + +class ElementsTest extends TestCase +{ + public $html5Elements = array( + 'a', + 'abbr', + 'address', + 'area', + 'article', + 'aside', + 'audio', + 'b', + 'base', + 'bdi', + 'bdo', + 'blockquote', + 'body', + 'br', + 'button', + 'canvas', + 'caption', + 'cite', + 'code', + 'col', + 'colgroup', + 'command', + // "data", + 'datalist', + 'dd', + 'del', + 'details', + 'dfn', + 'dialog', + 'div', + 'dl', + 'dt', + 'em', + 'embed', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hgroup', + 'hr', + 'html', + 'i', + 'iframe', + 'img', + 'input', + 'ins', + 'kbd', + 'keygen', + 'label', + 'legend', + 'li', + 'link', + 'map', + 'mark', + 'menu', + 'meta', + 'meter', + 'nav', + 'noscript', + 'object', + 'ol', + 'optgroup', + 'option', + 'output', + 'p', + 'param', + 'pre', + 'progress', + 'q', + 'rp', + 'rt', + 'ruby', + 's', + 'samp', + 'script', + 'section', + 'select', + 'small', + 'source', + 'span', + 'strong', + 'style', + 'sub', + 'summary', + 'sup', + 'table', + 'tbody', + 'td', + 'textarea', + 'tfoot', + 'th', + 'thead', + 'time', + 'title', + 'tr', + 'track', + 'u', + 'ul', + 'var', + 'video', + 'wbr', + ); + + public $mathmlElements = array( + 'maction', + 'maligngroup', + 'malignmark', + 'math', + 'menclose', + 'merror', + 'mfenced', + 'mfrac', + 'mglyph', + 'mi', + 'mlabeledtr', + 'mlongdiv', + 'mmultiscripts', + 'mn', + 'mo', + 'mover', + 'mpadded', + 'mphantom', + 'mroot', + 'mrow', + 'ms', + 'mscarries', + 'mscarry', + 'msgroup', + 'msline', + 'mspace', + 'msqrt', + 'msrow', + 'mstack', + 'mstyle', + 'msub', + 'msup', + 'msubsup', + 'mtable', + 'mtd', + 'mtext', + 'mtr', + 'munder', + 'munderover', + ); + + public $svgElements = array( + 'a', + 'altGlyph', + 'altGlyphDef', + 'altGlyphItem', + 'animate', + 'animateColor', + 'animateMotion', + 'animateTransform', + 'circle', + 'clipPath', + 'color-profile', + 'cursor', + 'defs', + 'desc', + 'ellipse', + 'feBlend', + 'feColorMatrix', + 'feComponentTransfer', + 'feComposite', + 'feConvolveMatrix', + 'feDiffuseLighting', + 'feDisplacementMap', + 'feDistantLight', + 'feFlood', + 'feFuncA', + 'feFuncB', + 'feFuncG', + 'feFuncR', + 'feGaussianBlur', + 'feImage', + 'feMerge', + 'feMergeNode', + 'feMorphology', + 'feOffset', + 'fePointLight', + 'feSpecularLighting', + 'feSpotLight', + 'feTile', + 'feTurbulence', + 'filter', + 'font', + 'font-face', + 'font-face-format', + 'font-face-name', + 'font-face-src', + 'font-face-uri', + 'foreignObject', + 'g', + 'glyph', + 'glyphRef', + 'hkern', + 'image', + 'line', + 'linearGradient', + 'marker', + 'mask', + 'metadata', + 'missing-glyph', + 'mpath', + 'path', + 'pattern', + 'polygon', + 'polyline', + 'radialGradient', + 'rect', + 'script', + 'set', + 'stop', + 'style', + 'svg', + 'switch', + 'symbol', + 'text', + 'textPath', + 'title', + 'tref', + 'tspan', + 'use', + 'view', + 'vkern', + ); + + public function testIsHtml5Element() + { + foreach ($this->html5Elements as $element) { + $this->assertTrue(Elements::isHtml5Element($element), 'html5 element test failed on: ' . $element); + + $this->assertTrue(Elements::isHtml5Element(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element)); + } + + $nonhtml5 = array( + 'foo', + 'bar', + 'baz', + ); + foreach ($nonhtml5 as $element) { + $this->assertFalse(Elements::isHtml5Element($element), 'html5 element test failed on: ' . $element); + + $this->assertFalse(Elements::isHtml5Element(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element)); + } + } + + public function testIsMathMLElement() + { + foreach ($this->mathmlElements as $element) { + $this->assertTrue(Elements::isMathMLElement($element), 'MathML element test failed on: ' . $element); + + // MathML is case sensitive so these should all fail. + $this->assertFalse(Elements::isMathMLElement(strtoupper($element)), 'MathML element test failed on: ' . strtoupper($element)); + } + + $nonMathML = array( + 'foo', + 'bar', + 'baz', + ); + foreach ($nonMathML as $element) { + $this->assertFalse(Elements::isMathMLElement($element), 'MathML element test failed on: ' . $element); + } + } + + public function testIsSvgElement() + { + foreach ($this->svgElements as $element) { + $this->assertTrue(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element); + + // SVG is case sensitive so these should all fail. + $this->assertFalse(Elements::isSvgElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element)); + } + + $nonSVG = array( + 'foo', + 'bar', + 'baz', + ); + foreach ($nonSVG as $element) { + $this->assertFalse(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element); + } + } + + public function testIsElement() + { + foreach ($this->html5Elements as $element) { + $this->assertTrue(Elements::isElement($element), 'html5 element test failed on: ' . $element); + + $this->assertTrue(Elements::isElement(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element)); + } + + foreach ($this->mathmlElements as $element) { + $this->assertTrue(Elements::isElement($element), 'MathML element test failed on: ' . $element); + + // MathML is case sensitive so these should all fail. + $this->assertFalse(Elements::isElement(strtoupper($element)), 'MathML element test failed on: ' . strtoupper($element)); + } + + foreach ($this->svgElements as $element) { + $this->assertTrue(Elements::isElement($element), 'SVG element test failed on: ' . $element); + + // SVG is case sensitive so these should all fail. But, there is duplication + // html5 and SVG. Since html5 is case insensitive we need to make sure + // it's not a html5 element first. + if (!in_array($element, $this->html5Elements)) { + $this->assertFalse(Elements::isElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element)); + } + } + + $nonhtml5 = array( + 'foo', + 'bar', + 'baz', + ); + foreach ($nonhtml5 as $element) { + $this->assertFalse(Elements::isElement($element), 'html5 element test failed on: ' . $element); + + $this->assertFalse(Elements::isElement(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element)); + } + } + + public function testElement() + { + foreach ($this->html5Elements as $element) { + $this->assertGreaterThan(0, Elements::element($element)); + } + $nonhtml5 = array( + 'foo', + 'bar', + 'baz', + ); + foreach ($nonhtml5 as $element) { + $this->assertEquals(0, Elements::element($element)); + } + } + + public function testIsA() + { + $this->assertTrue(Elements::isA('script', Elements::KNOWN_ELEMENT)); + $this->assertFalse(Elements::isA('scriptypoo', Elements::KNOWN_ELEMENT)); + $this->assertTrue(Elements::isA('script', Elements::TEXT_RAW)); + $this->assertFalse(Elements::isA('script', Elements::TEXT_RCDATA)); + + $voidElements = array( + 'area', + 'base', + 'basefont', + 'bgsound', + 'br', + 'col', + 'command', + 'embed', + 'frame', + 'hr', + 'img', + ); + + foreach ($voidElements as $element) { + $this->assertTrue(Elements::isA($element, Elements::VOID_TAG), 'Void element test failed on: ' . $element); + } + + $nonVoid = array( + 'span', + 'a', + 'div', + ); + foreach ($nonVoid as $tag) { + $this->assertFalse(Elements::isA($tag, Elements::VOID_TAG), 'Void element test failed on: ' . $tag); + } + + $blockTags = array( + 'address', + 'article', + 'aside', + 'blockquote', + 'canvas', + 'dd', + 'div', + 'dl', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'header', + 'hgroup', + 'hr', + 'noscript', + 'ol', + 'output', + 'p', + 'pre', + 'section', + 'table', + 'tfoot', + 'ul', + 'video', + ); + + foreach ($blockTags as $tag) { + $this->assertTrue(Elements::isA($tag, Elements::BLOCK_TAG), 'Block tag test failed on: ' . $tag); + } + + $nonBlockTags = array( + 'span', + 'img', + 'label', + ); + foreach ($nonBlockTags as $tag) { + $this->assertFalse(Elements::isA($tag, Elements::BLOCK_TAG), 'Block tag test failed on: ' . $tag); + } + } + + public function testNormalizeSvgElement() + { + $tests = array( + 'foo' => 'foo', + 'altglyph' => 'altGlyph', + 'BAR' => 'bar', + 'fespecularlighting' => 'feSpecularLighting', + 'bAz' => 'baz', + 'foreignobject' => 'foreignObject', + ); + + foreach ($tests as $input => $expected) { + $this->assertEquals($expected, Elements::normalizeSvgElement($input)); + } + } + + public function testNormalizeSvgAttribute() + { + $tests = array( + 'foo' => 'foo', + 'attributename' => 'attributeName', + 'BAR' => 'bar', + 'limitingconeangle' => 'limitingConeAngle', + 'bAz' => 'baz', + 'patterncontentunits' => 'patternContentUnits', + ); + + foreach ($tests as $input => $expected) { + $this->assertEquals($expected, Elements::normalizeSvgAttribute($input)); + } + } + + public function testNormalizeMathMlAttribute() + { + $tests = array( + 'foo' => 'foo', + 'definitionurl' => 'definitionURL', + 'BAR' => 'bar', + ); + + foreach ($tests as $input => $expected) { + $this->assertEquals($expected, Elements::normalizeMathMlAttribute($input)); + } + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html new file mode 100644 index 000000000..fa5a029ce --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html @@ -0,0 +1,9 @@ +<!doctype html> +<html> +<head> + <meta http-equiv="content-type" content="text/html;charset=utf-8" /> +</head> +<body> + <p>Žťčýů</p> +</body> +</html> diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html new file mode 100644 index 000000000..f0132da5d --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html @@ -0,0 +1,9 @@ +<!doctype html> +<html> +<head> + <meta http-equiv="content-type" content="text/html;charset=windows-1252"> +</head> +<body> + <p>�����</p> +</body> +</html> diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Html5Test.html b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Html5Test.html new file mode 100644 index 000000000..a976e8be9 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Html5Test.html @@ -0,0 +1,10 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Test</title> + </head> + <body> + <p>This is a test.</p> + </body> +</html>
\ No newline at end of file diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Html5Test.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Html5Test.php new file mode 100644 index 000000000..ed66d8af2 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Html5Test.php @@ -0,0 +1,492 @@ +<?php + +namespace Masterminds\HTML5\Tests; + +use Masterminds\HTML5; + +class Html5Test extends TestCase +{ + /** + * @var HTML5 + */ + private $html5; + + public function setUp() + { + $this->html5 = $this->getInstance(); + } + + /** + * Parse and serialize a string. + */ + protected function cycle($html) + { + $dom = $this->html5->loadHTML('<!DOCTYPE html><html><body>' . $html . '</body></html>'); + $out = $this->html5->saveHTML($dom); + + return $out; + } + + protected function cycleFragment($fragment) + { + $dom = $this->html5->loadHTMLFragment($fragment); + $out = $this->html5->saveHTML($dom); + + return $out; + } + + public function testImageTagsInSvg() + { + $html = '<!DOCTYPE html> + <html> + <head> + <title>foo</title> + </head> + <body> + <svg> + <image height="10" width="10"></image> + </svg> + </body> + </html>'; + $doc = $this->html5->loadHTML($html); + $this->assertInstanceOf('DOMElement', $doc->getElementsByTagName('image')->item(0)); + $this->assertEmpty($this->html5->getErrors()); + } + + public function testLoadOptions() + { + // doc + $dom = $this->html5->loadHTML($this->wrap('<t:tag/>'), array( + 'implicitNamespaces' => array('t' => 'http://example.com'), + 'xmlNamespaces' => true, + )); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $xpath = new \DOMXPath($dom); + $xpath->registerNamespace('t', 'http://example.com'); + $this->assertEquals(1, $xpath->query('//t:tag')->length); + + // doc fragment + $frag = $this->html5->loadHTMLFragment('<t:tag/>', array( + 'implicitNamespaces' => array('t' => 'http://example.com'), + 'xmlNamespaces' => true, + )); + $this->assertInstanceOf('\DOMDocumentFragment', $frag); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $frag->ownerDocument->appendChild($frag); + $xpath = new \DOMXPath($frag->ownerDocument); + $xpath->registerNamespace('t', 'http://example.com'); + $this->assertEquals(1, $xpath->query('//t:tag', $frag)->length); + } + + public function testEncodingUtf8() + { + $dom = $this->html5->load(__DIR__ . '/Fixtures/encoding/utf-8.html'); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $this->assertContains('Žťčýů', $dom->saveHTML()); + } + + public function testEncodingWindows1252() + { + $dom = $this->html5->load(__DIR__ . '/Fixtures/encoding/windows-1252.html', array( + 'encoding' => 'Windows-1252', + )); + + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $dumpedAsUtf8 = mb_convert_encoding($dom->saveHTML(), 'UTF-8', 'Windows-1252'); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'Ž')); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'è')); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'ý')); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'ù')); + } + + public function testErrors() + { + $dom = $this->html5->loadHTML('<xx as>'); + $this->assertInstanceOf('\DOMDocument', $dom); + + $this->assertNotEmpty($this->html5->getErrors()); + $this->assertTrue($this->html5->hasErrors()); + } + + public function testLoad() + { + $dom = $this->html5->load(__DIR__ . '/Html5Test.html'); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $file = fopen(__DIR__ . '/Html5Test.html', 'r'); + $dom = $this->html5->load($file); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + + $dom = $this->html5->loadHTMLFile(__DIR__ . '/Html5Test.html'); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + } + + public function testLoadHTML() + { + $contents = file_get_contents(__DIR__ . '/Html5Test.html'); + $dom = $this->html5->loadHTML($contents); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + } + + public function testLoadHTMLWithComments() + { + $contents = '<!--[if lte IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> +<!--[if gt IE 8]> <!--><html class="no-js" lang="en"><!--<![endif]--> +</html>'; + + $dom = $this->html5->loadHTML($contents); + $this->assertInstanceOf('\DOMDocument', $dom); + + $expected = '<!DOCTYPE html> +<!--[if lte IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--><!--[if gt IE 8]> <!--><html class="no-js" lang="en"><!--<![endif]--></html> +'; + $this->assertEquals($expected, $this->html5->saveHTML($dom)); + } + + public function testLoadHTMLFragment() + { + $fragment = '<section id="Foo"><div class="Bar">Baz</div></section>'; + $dom = $this->html5->loadHTMLFragment($fragment); + $this->assertInstanceOf('\DOMDocumentFragment', $dom); + $this->assertEmpty($this->html5->getErrors()); + } + + public function testSaveHTML() + { + $dom = $this->html5->load(__DIR__ . '/Html5Test.html'); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + + $saved = $this->html5->saveHTML($dom); + $this->assertRegExp('|<p>This is a test.</p>|', $saved); + } + + public function testSaveHTMLFragment() + { + $fragment = '<section id="Foo"><div class="Bar">Baz</div></section>'; + $dom = $this->html5->loadHTMLFragment($fragment); + + $string = $this->html5->saveHTML($dom); + $this->assertEquals($fragment, $string); + } + + public function testSave() + { + $dom = $this->html5->load(__DIR__ . '/Html5Test.html'); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + + // Test resource + $file = fopen('php://temp', 'w'); + $this->html5->save($dom, $file); + $content = stream_get_contents($file, -1, 0); + $this->assertRegExp('|<p>This is a test.</p>|', $content); + + // Test file + $tmpfname = tempnam(sys_get_temp_dir(), 'html5-php'); + $this->html5->save($dom, $tmpfname); + $content = file_get_contents($tmpfname); + $this->assertRegExp('|<p>This is a test.</p>|', $content); + unlink($tmpfname); + } + + // This test reads a document into a dom, turn the dom into a document, + // then tries to read that document again. This makes sure we are reading, + // and generating a document that works at a high level. + public function testItWorks() + { + $dom = $this->html5->load(__DIR__ . '/Html5Test.html'); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + + $saved = $this->html5->saveHTML($dom); + + $dom2 = $this->html5->loadHTML($saved); + $this->assertInstanceOf('\DOMDocument', $dom2); + $this->assertEmpty($this->html5->getErrors()); + } + + public function testConfig() + { + $html5 = $this->getInstance(); + $options = $html5->getOptions(); + $this->assertEquals(false, $options['encode_entities']); + + $html5 = $this->getInstance(array( + 'foo' => 'bar', + 'encode_entities' => true, + )); + $options = $html5->getOptions(); + $this->assertEquals('bar', $options['foo']); + $this->assertEquals(true, $options['encode_entities']); + + // Need to reset to original so future tests pass as expected. + // $this->getInstance()->setOption('encode_entities', false); + } + + public function testSvg() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + <svg width="150" height="100" viewBox="0 0 3 2"> + <rect width="1" height="2" x="0" fill="#008d46" /> + <rect width="1" height="2" x="1" fill="#ffffff" /> + <rect width="1" height="2" x="2" fill="#d2232c" /> + <text font-family="Verdana" font-size="32"> + <textPath xlink:href="#Foo"> + Test Text. + </textPath> + </text> + </svg> + </body> + </html>'); + + $this->assertEmpty($this->html5->getErrors()); + + // Test a mixed case attribute. + $list = $dom->getElementsByTagName('svg'); + $this->assertNotEmpty($list->length); + $svg = $list->item(0); + $this->assertEquals('0 0 3 2', $svg->getAttribute('viewBox')); + $this->assertFalse($svg->hasAttribute('viewbox')); + + // Test a mixed case tag. + // Note: getElementsByTagName is not case sensitive. + $list = $dom->getElementsByTagName('textPath'); + $this->assertNotEmpty($list->length); + $textPath = $list->item(0); + $this->assertEquals('textPath', $textPath->tagName); + $this->assertNotEquals('textpath', $textPath->tagName); + + $html = $this->html5->saveHTML($dom); + $this->assertRegExp('|<svg width="150" height="100" viewBox="0 0 3 2">|', $html); + $this->assertRegExp('|<rect width="1" height="2" x="0" fill="#008d46" />|', $html); + } + + public function testMathMl() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz" definitionURL="http://example.com">foo bar baz</div> + <math> + <mi>x</mi> + <csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus"> + <mo>±</mo> + </csymbol> + <mi>y</mi> + </math> + </body> + </html>'); + + $this->assertEmpty($this->html5->getErrors()); + $list = $dom->getElementsByTagName('math'); + $this->assertNotEmpty($list->length); + + $list = $dom->getElementsByTagName('div'); + $this->assertNotEmpty($list->length); + $div = $list->item(0); + $this->assertEquals('http://example.com', $div->getAttribute('definitionurl')); + $this->assertFalse($div->hasAttribute('definitionURL')); + $list = $dom->getElementsByTagName('csymbol'); + $csymbol = $list->item(0); + $this->assertEquals('http://www.example.com/mathops/multiops.html#plusminus', $csymbol->getAttribute('definitionURL')); + $this->assertFalse($csymbol->hasAttribute('definitionurl')); + + $html = $this->html5->saveHTML($dom); + $this->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|', $html); + $this->assertRegExp('|<mi>y</mi>|', $html); + } + + public function testUnknownElements() + { + // The : should not have special handling accourding to section 2.9 of the + // spec. This is differenant than XML. Since we don't know these elements + // they are handled as normal elements. Note, to do this is really + // an invalid example and you should not embed prefixed xml in html5. + $dom = $this->html5->loadHTMLFragment( + '<f:rug> + <f:name>Big rectangle thing</f:name> + <f:width>40</f:width> + <f:length>80</f:length> + </f:rug> + <sarcasm>um, yeah</sarcasm>'); + + $this->assertEmpty($this->html5->getErrors()); + $markup = $this->html5->saveHTML($dom); + $this->assertRegExp('|<f:name>Big rectangle thing</f:name>|', $markup); + $this->assertRegExp('|<sarcasm>um, yeah</sarcasm>|', $markup); + } + + public function testElements() + { + // Should have content. + $res = $this->cycle('<div>FOO</div>'); + $this->assertRegExp('|<div>FOO</div>|', $res); + + // Should be empty + $res = $this->cycle('<span></span>'); + $this->assertRegExp('|<span></span>|', $res); + + // Should have content. + $res = $this->cycleFragment('<div>FOO</div>'); + $this->assertRegExp('|<div>FOO</div>|', $res); + + // Should be empty + $res = $this->cycleFragment('<span></span>'); + $this->assertRegExp('|<span></span>|', $res); + + // Elements with dashes and underscores + $res = $this->cycleFragment('<sp-an></sp-an>'); + $this->assertRegExp('|<sp-an></sp-an>|', $res); + $res = $this->cycleFragment('<sp_an></sp_an>'); + $this->assertRegExp('|<sp_an></sp_an>|', $res); + + // Should have no closing tag. + $res = $this->cycle('<hr>'); + $this->assertRegExp('|<hr></body>|', $res); + } + + public function testAttributes() + { + $res = $this->cycle('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>'); + $this->assertContains('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res); + + $res = $this->cycle('<div attr="val">FOO</div>'); + $this->assertRegExp('|<div attr="val">FOO</div>|', $res); + + // XXX: Note that spec does NOT require attrs in the same order. + $res = $this->cycle('<div attr="val" class="even">FOO</div>'); + $this->assertRegExp('|<div attr="val" class="even">FOO</div>|', $res); + + $res = $this->cycle('<div xmlns:foo="http://example.com">FOO</div>'); + $this->assertRegExp('|<div xmlns:foo="http://example.com">FOO</div>|', $res); + + $res = $this->cycleFragment('<div attr="val">FOO</div>'); + $this->assertRegExp('|<div attr="val">FOO</div>|', $res); + + // XXX: Note that spec does NOT require attrs in the same order. + $res = $this->cycleFragment('<div attr="val" class="even">FOO</div>'); + $this->assertRegExp('|<div attr="val" class="even">FOO</div>|', $res); + + $res = $this->cycleFragment('<div xmlns:foo="http://example.com">FOO</div>'); + $this->assertRegExp('|<div xmlns:foo="http://example.com">FOO</div>|', $res); + } + + public function testPCData() + { + $res = $this->cycle('<a>This is a test.</a>'); + $this->assertRegExp('|This is a test.|', $res); + + $res = $this->cycleFragment('<a>This is a test.</a>'); + $this->assertRegExp('|This is a test.|', $res); + + $res = $this->cycle('This + is + a + test.'); + + // Check that newlines are there, but don't count spaces. + $this->assertRegExp('|This\n\s*is\n\s*a\n\s*test.|', $res); + + $res = $this->cycleFragment('This + is + a + test.'); + + // Check that newlines are there, but don't count spaces. + $this->assertRegExp('|This\n\s*is\n\s*a\n\s*test.|', $res); + + $res = $this->cycle('<a>This <em>is</em> a test.</a>'); + $this->assertRegExp('|This <em>is</em> a test.|', $res); + + $res = $this->cycleFragment('<a>This <em>is</em> a test.</a>'); + $this->assertRegExp('|This <em>is</em> a test.|', $res); + } + + public function testUnescaped() + { + $res = $this->cycle('<script>2 < 1</script>'); + $this->assertRegExp('|2 < 1|', $res); + + $res = $this->cycle('<style>div>div>div</style>'); + $this->assertRegExp('|div>div>div|', $res); + + $res = $this->cycleFragment('<script>2 < 1</script>'); + $this->assertRegExp('|2 < 1|', $res); + + $res = $this->cycleFragment('<style>div>div>div</style>'); + $this->assertRegExp('|div>div>div|', $res); + } + + public function testEntities() + { + $res = $this->cycle('<a>Apples & bananas.</a>'); + $this->assertRegExp('|Apples & bananas.|', $res); + + $res = $this->cycleFragment('<a>Apples & bananas.</a>'); + $this->assertRegExp('|Apples & bananas.|', $res); + + $res = $this->cycleFragment('<p>R&D</p>'); + $this->assertRegExp('|R&D|', $res); + } + + public function testCaseSensitiveTags() + { + $dom = $this->html5->loadHTML( + '<html><body><Button color="red">Error</Button></body></html>', + array( + 'xmlNamespaces' => true, + ) + ); + $out = $this->html5->saveHTML($dom); + $this->assertRegExp('|<html><body><Button color="red">Error</Button></body></html>|', $out); + } + + public function testComment() + { + $res = $this->cycle('a<!-- This is a test. -->b'); + $this->assertRegExp('|<!-- This is a test. -->|', $res); + + $res = $this->cycleFragment('a<!-- This is a test. -->b'); + $this->assertRegExp('|<!-- This is a test. -->|', $res); + } + + public function testCDATA() + { + $res = $this->cycle('a<![CDATA[ This <is> a test. ]]>b'); + $this->assertRegExp('|<!\[CDATA\[ This <is> a test\. \]\]>|', $res); + + $res = $this->cycleFragment('a<![CDATA[ This <is> a test. ]]>b'); + $this->assertRegExp('|<!\[CDATA\[ This <is> a test\. \]\]>|', $res); + } + + public function testAnchorTargetQueryParam() + { + $res = $this->cycle('<a href="https://domain.com/page.php?foo=bar&target=baz">https://domain.com/page.php?foo=bar&target=baz</a>'); + $this->assertContains( + '<a href="https://domain.com/page.php?foo=bar&target=baz">https://domain.com/page.php?foo=bar&target=baz</a>', + $res + ); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php new file mode 100644 index 000000000..a5eee73c8 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php @@ -0,0 +1,44 @@ +<?php +/** + * @file + * Test the Scanner. This requires the InputStream tests are all good. + */ + +namespace Masterminds\HTML5\Tests\Parser; + +use Masterminds\HTML5\Parser\CharacterReference; + +class CharacterReferenceTest extends \Masterminds\HTML5\Tests\TestCase +{ + public function testLookupName() + { + $this->assertEquals('&', CharacterReference::lookupName('amp')); + $this->assertEquals('<', CharacterReference::lookupName('lt')); + $this->assertEquals('>', CharacterReference::lookupName('gt')); + $this->assertEquals('"', CharacterReference::lookupName('quot')); + $this->assertEquals('∌', CharacterReference::lookupName('NotReverseElement')); + + $this->assertNull(CharacterReference::lookupName('StinkyCheese')); + } + + public function testLookupHex() + { + $this->assertEquals('<', CharacterReference::lookupHex('3c')); + $this->assertEquals('<', CharacterReference::lookupHex('003c')); + $this->assertEquals('&', CharacterReference::lookupHex('26')); + $this->assertEquals('}', CharacterReference::lookupHex('7d')); + $this->assertEquals('Σ', CharacterReference::lookupHex('3A3')); + $this->assertEquals('Σ', CharacterReference::lookupHex('03A3')); + $this->assertEquals('Σ', CharacterReference::lookupHex('3a3')); + $this->assertEquals('Σ', CharacterReference::lookupHex('03a3')); + } + + public function testLookupDecimal() + { + $this->assertEquals('&', CharacterReference::lookupDecimal(38)); + $this->assertEquals('&', CharacterReference::lookupDecimal('38')); + $this->assertEquals('<', CharacterReference::lookupDecimal(60)); + $this->assertEquals('Σ', CharacterReference::lookupDecimal(931)); + $this->assertEquals('Σ', CharacterReference::lookupDecimal('0931')); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php new file mode 100644 index 000000000..659378c68 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php @@ -0,0 +1,743 @@ +<?php +/** + * @file + * Test the Tree Builder. + */ + +namespace Masterminds\HTML5\Tests\Parser; + +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Parser\DOMTreeBuilder; + +/** + * These tests are functional, not necessarily unit tests. + */ +class DOMTreeBuilderTest extends \Masterminds\HTML5\Tests\TestCase +{ + protected $errors = array(); + + /** + * Convenience function for parsing. + */ + protected function parse($string, array $options = array()) + { + $treeBuilder = new DOMTreeBuilder(false, $options); + $scanner = new Scanner($string); + $parser = new Tokenizer($scanner, $treeBuilder); + + $parser->parse(); + $this->errors = $treeBuilder->getErrors(); + + return $treeBuilder->document(); + } + + /** + * Utility function for parsing a fragment of HTML5. + */ + protected function parseFragment($string) + { + $treeBuilder = new DOMTreeBuilder(true); + $scanner = new Scanner($string); + $parser = new Tokenizer($scanner, $treeBuilder); + + $parser->parse(); + $this->errors = $treeBuilder->getErrors(); + + return $treeBuilder->fragment(); + } + + public function testDocument() + { + $html = '<!DOCTYPE html><html></html>'; + $doc = $this->parse($html); + + $this->assertEquals('UTF-8', $doc->encoding); + $this->assertInstanceOf('\DOMDocument', $doc); + $this->assertEquals('html', $doc->documentElement->tagName); + $this->assertEquals('http://www.w3.org/1999/xhtml', $doc->documentElement->namespaceURI); + } + + public function testBareAmpersand() + { + $html = "<!doctype html> + <html> + <body> + <img src='a&b' /> + <img src='a&=' /> + <img src='a&=c' /> + <img src='a&=9' /> + </body> + </html>"; + $doc = $this->parse($html); + + $this->assertEmpty($this->errors); + $this->assertXmlStringEqualsXmlString(' + <!DOCTYPE html> + <html xmlns="http://www.w3.org/1999/xhtml"><body> + <img src="a&b"/> + <img src="a&="/> + <img src="a&=c"/> + <img src="a&=9"/> + </body> + </html>', $doc->saveXML()); + } + + public function testBareAmpersandNotAllowedInAttributes() + { + $html = "<!doctype html> + <html> + <body> + <img src='a&' /> + <img src='a&+' /> + </body> + </html>"; + $doc = $this->parse($html); + + $this->assertCount(2, $this->errors); + $this->assertXmlStringEqualsXmlString(' + <!DOCTYPE html> + <html xmlns="http://www.w3.org/1999/xhtml"><body> + <img src="a&"/> + <img src="a&+"/> + </body> + </html>', $doc->saveXML()); + } + + public function testBareAmpersandNotAllowedInBody() + { + $html = '<!doctype html> + <html> + <body> + a&b + a&= + a&=c + a&=9 + a&+ + a& -- valid + </body> + </html>'; + $doc = $this->parse($html); + + $this->assertCount(5, $this->errors); + $this->assertXmlStringEqualsXmlString(' + <!DOCTYPE html> + <html xmlns="http://www.w3.org/1999/xhtml"><body> + a&b + a&= + a&=c + a&=9 + a&+ + a& -- valid + </body> + </html>', $doc->saveXML()); + } + + public function testEntityAtEndOfFile() + { + $fragment = $this->parseFragment('&#'); + $this->assertInstanceOf('DOMDocumentFragment', $fragment); + $this->assertSame('&#', $fragment->textContent); + $this->assertEquals('Line 1, Col 2: Expected &#DEC; &#HEX;, got EOF', $this->errors[0]); + } + + public function testStrangeCapitalization() + { + $html = '<!doctype html> + <html> + <head> + <Title>Hello, world!</TitlE> + </head> + <body>TheBody<script>foo</script></body> + </html>'; + $doc = $this->parse($html); + + $this->assertInstanceOf('\DOMDocument', $doc); + $this->assertEquals('html', $doc->documentElement->tagName); + + $xpath = new \DOMXPath($doc); + $xpath->registerNamespace('x', 'http://www.w3.org/1999/xhtml'); + + $this->assertEquals('Hello, world!', $xpath->query('//x:title')->item(0)->nodeValue); + $this->assertEquals('foo', $xpath->query('//x:script')->item(0)->nodeValue); + } + + public function testDocumentWithDisabledNamespaces() + { + $html = '<!DOCTYPE html><html></html>'; + $doc = $this->parse($html, array('disable_html_ns' => true)); + + $this->assertInstanceOf('\DOMDocument', $doc); + $this->assertEquals('html', $doc->documentElement->tagName); + $this->assertNull($doc->documentElement->namespaceURI); + } + + public function testDocumentWithATargetDocument() + { + $targetDom = new \DOMDocument(); + + $html = '<!DOCTYPE html><html></html>'; + $doc = $this->parse($html, array('target_document' => $targetDom)); + + $this->assertInstanceOf('\DOMDocument', $doc); + $this->assertSame($doc, $targetDom); + $this->assertEquals('html', $doc->documentElement->tagName); + } + + public function testDocumentFakeAttrAbsence() + { + $html = '<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><body>foo</body></html>'; + $doc = $this->parse($html, array('xmlNamespaces' => true)); + + $xp = new \DOMXPath($doc); + $this->assertEquals(0, $xp->query('//@html5-php-fake-id-attribute')->length); + } + + public function testFragment() + { + $html = '<div>test</div><span>test2</span>'; + $doc = $this->parseFragment($html); + + $this->assertInstanceOf('\DOMDocumentFragment', $doc); + $this->assertTrue($doc->hasChildNodes()); + $this->assertEquals('div', $doc->childNodes->item(0)->tagName); + $this->assertEquals('test', $doc->childNodes->item(0)->textContent); + $this->assertEquals('span', $doc->childNodes->item(1)->tagName); + $this->assertEquals('test2', $doc->childNodes->item(1)->textContent); + } + + public function testElements() + { + $html = '<!DOCTYPE html><html><head><title></title></head><body></body></html>'; + $doc = $this->parse($html); + $root = $doc->documentElement; + + $this->assertEquals('html', $root->tagName); + $this->assertEquals('html', $root->localName); + $this->assertEquals('html', $root->nodeName); + + $this->assertEquals(2, $root->childNodes->length); + $kids = $root->childNodes; + + $this->assertEquals('head', $kids->item(0)->tagName); + $this->assertEquals('body', $kids->item(1)->tagName); + + $head = $kids->item(0); + $this->assertEquals(1, $head->childNodes->length); + $this->assertEquals('title', $head->childNodes->item(0)->tagName); + } + + public function testImplicitNamespaces() + { + $dom = $this->parse('<!DOCTYPE html><html><body><a xlink:href="bar">foo</a></body></html>'); + $a = $dom->getElementsByTagName('a')->item(0); + $attr = $a->getAttributeNode('xlink:href'); + $this->assertEquals('http://www.w3.org/1999/xlink', $attr->namespaceURI); + + $dom = $this->parse('<!DOCTYPE html><html><body><a xml:base="bar">foo</a></body></html>'); + $a = $dom->getElementsByTagName('a')->item(0); + $attr = $a->getAttributeNode('xml:base'); + $this->assertEquals('http://www.w3.org/XML/1998/namespace', $attr->namespaceURI); + } + + public function testCustomImplicitNamespaces() + { + $dom = $this->parse('<!DOCTYPE html><html><body><a t:href="bar">foo</a></body></html>', array( + 'implicitNamespaces' => array( + 't' => 'http://www.example.com', + ), + )); + $a = $dom->getElementsByTagName('a')->item(0); + $attr = $a->getAttributeNode('t:href'); + $this->assertEquals('http://www.example.com', $attr->namespaceURI); + + $dom = $this->parse('<!DOCTYPE html><html><body><t:a>foo</t:a></body></html>', array( + 'implicitNamespaces' => array( + 't' => 'http://www.example.com', + ), + )); + $list = $dom->getElementsByTagNameNS('http://www.example.com', 'a'); + $this->assertEquals(1, $list->length); + } + + public function testXmlNamespaces() + { + $dom = $this->parse( + '<!DOCTYPE html><html> + <t:body xmlns:t="http://www.example.com"> + <a t:href="bar">foo</a> + </body> + <div>foo</div> + </html>', array( + 'xmlNamespaces' => true, + )); + $a = $dom->getElementsByTagName('a')->item(0); + $attr = $a->getAttributeNode('t:href'); + $this->assertEquals('http://www.example.com', $attr->namespaceURI); + + $list = $dom->getElementsByTagNameNS('http://www.example.com', 'body'); + $this->assertEquals(1, $list->length); + } + + public function testXmlNamespaceNesting() + { + $dom = $this->parse( + '<!DOCTYPE html><html> + <body xmlns:x="http://www.prefixed.com" id="body"> + <a id="bar1" xmlns="http://www.prefixed.com/bar1"> + <b id="bar4" xmlns="http://www.prefixed.com/bar4"><x:prefixed id="prefixed"/></b> + </a> + <svg id="svg"></svg> + <c id="bar2" xmlns="http://www.prefixed.com/bar2"></c> + <div id="div"></div> + <d id="bar3"></d> + <xn:d xmlns:xn="http://www.prefixed.com/xn" xmlns="http://www.prefixed.com/bar5_x" id="bar5"><x id="bar5_x"/></xn:d> + </body> + </html>', array( + 'xmlNamespaces' => true, + )); + + $this->assertEmpty($this->errors); + + $div = $dom->getElementById('div'); + $this->assertEquals('http://www.w3.org/1999/xhtml', $div->namespaceURI); + + $body = $dom->getElementById('body'); + $this->assertEquals('http://www.w3.org/1999/xhtml', $body->namespaceURI); + + $bar1 = $dom->getElementById('bar1'); + $this->assertEquals('http://www.prefixed.com/bar1', $bar1->namespaceURI); + + $bar2 = $dom->getElementById('bar2'); + $this->assertEquals('http://www.prefixed.com/bar2', $bar2->namespaceURI); + + $bar3 = $dom->getElementById('bar3'); + $this->assertEquals('http://www.w3.org/1999/xhtml', $bar3->namespaceURI); + + $bar4 = $dom->getElementById('bar4'); + $this->assertEquals('http://www.prefixed.com/bar4', $bar4->namespaceURI); + + $svg = $dom->getElementById('svg'); + $this->assertEquals('http://www.w3.org/2000/svg', $svg->namespaceURI); + + $prefixed = $dom->getElementById('prefixed'); + $this->assertEquals('http://www.prefixed.com', $prefixed->namespaceURI); + + $prefixed = $dom->getElementById('bar5'); + $this->assertEquals('http://www.prefixed.com/xn', $prefixed->namespaceURI); + + $prefixed = $dom->getElementById('bar5_x'); + $this->assertEquals('http://www.prefixed.com/bar5_x', $prefixed->namespaceURI); + } + + public function testMoveNonInlineElements() + { + $doc = $this->parse('<p>line1<br/><hr/>line2</p>'); + $this->assertEquals('<html xmlns="http://www.w3.org/1999/xhtml"><p>line1<br/></p><hr/>line2</html>', $doc->saveXML($doc->documentElement), 'Move non-inline elements outside of inline containers.'); + + $doc = $this->parse('<p>line1<div>line2</div></p>'); + $this->assertEquals('<html xmlns="http://www.w3.org/1999/xhtml"><p>line1</p><div>line2</div></html>', $doc->saveXML($doc->documentElement), 'Move non-inline elements outside of inline containers.'); + } + + public function testAttributes() + { + $html = "<!DOCTYPE html> + <html> + <head><title></title></head> + <body id='a' class='b c'></body> + </html>"; + $doc = $this->parse($html); + $root = $doc->documentElement; + + $body = $root->GetElementsByTagName('body')->item(0); + $this->assertEquals('body', $body->tagName); + $this->assertTrue($body->hasAttributes()); + $this->assertEquals('a', $body->getAttribute('id')); + $this->assertEquals('b c', $body->getAttribute('class')); + + $body2 = $doc->getElementById('a'); + $this->assertEquals('body', $body2->tagName); + $this->assertEquals('a', $body2->getAttribute('id')); + } + + public function testSVGAttributes() + { + $html = "<!DOCTYPE html> + <html><body> + <svg width='150' viewbox='2'> + <rect textlength='2'/> + <animatecolor>foo</animatecolor> + </svg> + </body></html>"; + $doc = $this->parse($html); + $root = $doc->documentElement; + + $svg = $root->getElementsByTagName('svg')->item(0); + $this->assertTrue($svg->hasAttribute('viewBox')); + + $rect = $root->getElementsByTagName('rect')->item(0); + $this->assertTrue($rect->hasAttribute('textLength')); + + $ac = $root->getElementsByTagName('animateColor'); + $this->assertEquals(1, $ac->length); + } + + public function testMathMLAttribute() + { + $html = '<!doctype html> + <html lang="en"> + <body> + <math> + <mi>x</mi> + <csymbol definitionurl="http://www.example.com/mathops/multiops.html#plusminus"> + <mo>±</mo> + </csymbol> + <mi>y</mi> + </math> + </body> + </html>'; + + $doc = $this->parse($html); + $root = $doc->documentElement; + + $csymbol = $root->getElementsByTagName('csymbol')->item(0); + $this->assertTrue($csymbol->hasAttribute('definitionURL')); + } + + public function testMissingHtmlTag() + { + $html = '<!DOCTYPE html><title>test</title>'; + $doc = $this->parse($html); + + $this->assertEquals('html', $doc->documentElement->tagName); + $this->assertEquals('title', $doc->documentElement->childNodes->item(0)->tagName); + } + + public function testComment() + { + $html = '<html><!--Hello World.--></html>'; + + $doc = $this->parse($html); + + $comment = $doc->documentElement->childNodes->item(0); + $this->assertEquals(XML_COMMENT_NODE, $comment->nodeType); + $this->assertEquals('Hello World.', $comment->data); + + $html = '<!--Hello World.--><html></html>'; + $doc = $this->parse($html); + + $comment = $doc->childNodes->item(1); + $this->assertEquals(XML_COMMENT_NODE, $comment->nodeType); + $this->assertEquals('Hello World.', $comment->data); + + $comment = $doc->childNodes->item(2); + $this->assertEquals(XML_ELEMENT_NODE, $comment->nodeType); + $this->assertEquals('html', $comment->tagName); + } + + public function testCDATA() + { + $html = '<!DOCTYPE html><html><math><![CDATA[test]]></math></html>'; + $doc = $this->parse($html); + + $wrapper = $doc->getElementsByTagName('math')->item(0); + $this->assertEquals(1, $wrapper->childNodes->length); + $cdata = $wrapper->childNodes->item(0); + $this->assertEquals(XML_CDATA_SECTION_NODE, $cdata->nodeType); + $this->assertEquals('test', $cdata->data); + } + + public function testText() + { + $html = '<!DOCTYPE html><html><head></head><body><math>test</math></body></html>'; + $doc = $this->parse($html); + + $wrapper = $doc->getElementsByTagName('math')->item(0); + $this->assertEquals(1, $wrapper->childNodes->length); + $data = $wrapper->childNodes->item(0); + $this->assertEquals(XML_TEXT_NODE, $data->nodeType); + $this->assertEquals('test', $data->data); + + // The DomTreeBuilder has special handling for text when in before head mode. + $html = '<!DOCTYPE html><html> + Foo<head></head><body></body></html>'; + $doc = $this->parse($html); + $this->assertEquals('Line 0, Col 0: Unexpected text. Ignoring: Foo', $this->errors[0]); + $headElement = $doc->documentElement->firstChild; + $this->assertEquals('head', $headElement->tagName); + } + + public function testParseErrors() + { + $html = '<!DOCTYPE html><html><math><![CDATA[test'; + $doc = $this->parse($html); + + // We're JUST testing that we can access errors. Actual testing of + // error messages happen in the Tokenizer's tests. + $this->assertGreaterThan(0, count($this->errors)); + $this->assertTrue(is_string($this->errors[0])); + } + + public function testProcessingInstruction() + { + // Test the simple case, which is where PIs are inserted into the DOM. + $doc = $this->parse('<!DOCTYPE html><html><?foo bar?>'); + $this->assertEquals(1, $doc->documentElement->childNodes->length); + $pi = $doc->documentElement->firstChild; + $this->assertInstanceOf('\DOMProcessingInstruction', $pi); + $this->assertEquals('foo', $pi->nodeName); + $this->assertEquals('bar', $pi->data); + + // Leading xml PIs should be ignored. + $doc = $this->parse('<?xml version="1.0"?><!DOCTYPE html><html><head></head></html>'); + + $this->assertEquals(2, $doc->childNodes->length); + $this->assertInstanceOf('\DOMDocumentType', $doc->childNodes->item(0)); + $this->assertInstanceOf('\DOMElement', $doc->childNodes->item(1)); + } + + public function testAutocloseP() + { + $html = '<!DOCTYPE html><html><body><p><figure></body></html>'; + $doc = $this->parse($html); + + $p = $doc->getElementsByTagName('p')->item(0); + $this->assertEquals(0, $p->childNodes->length); + $this->assertEquals('figure', $p->nextSibling->tagName); + } + + public function testAutocloseLI() + { + $html = '<!doctype html> + <html lang="en"> + <body> + <ul><li>Foo<li>Bar<li>Baz</ul> + </body> + </html>'; + + $doc = $this->parse($html); + $length = $doc->getElementsByTagName('ul')->item(0)->childNodes->length; + $this->assertEquals(3, $length); + } + + public function testMathML() + { + $html = '<!doctype html> + <html lang="en"> + <body> + <math xmlns="http://www.w3.org/1998/Math/MathML"> + <mi>x</mi> + <csymbol definitionurl="http://www.example.com/mathops/multiops.html#plusminus"> + <mo>±</mo> + </csymbol> + <mi>y</mi> + </math> + </body> + </html>'; + + $doc = $this->parse($html); + $math = $doc->getElementsByTagName('math')->item(0); + $this->assertEquals('math', $math->tagName); + $this->assertEquals('math', $math->nodeName); + $this->assertEquals('math', $math->localName); + $this->assertEquals('http://www.w3.org/1998/Math/MathML', $math->namespaceURI); + } + + public function testSVG() + { + $html = '<!doctype html> + <html lang="en"> + <body> + <svg width="150" height="100" viewBox="0 0 3 2" xmlns="http://www.w3.org/2000/svg"> + <rect width="1" height="2" x="2" fill="#d2232c" /> + <text font-family="Verdana" font-size="32"> + <textpath xlink:href="#Foo"> + Test Text. + </textPath> + </text> + </svg> + </body> + </html>'; + + $doc = $this->parse($html); + $svg = $doc->getElementsByTagName('svg')->item(0); + $this->assertEquals('svg', $svg->tagName); + $this->assertEquals('svg', $svg->nodeName); + $this->assertEquals('svg', $svg->localName); + $this->assertEquals('http://www.w3.org/2000/svg', $svg->namespaceURI); + + $textPath = $doc->getElementsByTagName('textPath')->item(0); + $this->assertEquals('textPath', $textPath->tagName); + } + + public function testNoScript() + { + $html = '<!DOCTYPE html><html><head><noscript>No JS</noscript></head></html>'; + $doc = $this->parse($html); + $this->assertEmpty($this->errors); + $noscript = $doc->getElementsByTagName('noscript')->item(0); + $this->assertEquals('noscript', $noscript->tagName); + + $html = '<!DOCTYPE html><html><body><noscript><p>No JS</p></noscript></body></html>'; + $doc = $this->parse($html); + $this->assertEmpty($this->errors); + $p = $doc->getElementsByTagName('p')->item(0); + $this->assertEquals('p', $p->tagName); + } + + /** + * Regression for issue #13. + */ + public function testRegressionHTMLNoBody() + { + $html = '<!DOCTYPE html><html><span id="test">Test</span></html>'; + $doc = $this->parse($html); + $span = $doc->getElementById('test'); + + $this->assertEmpty($this->errors); + + $this->assertEquals('span', $span->tagName); + $this->assertEquals('Test', $span->textContent); + } + + public function testInstructionProcessor() + { + $string = '<!DOCTYPE html><html><?foo bar ?></html>'; + + $treeBuilder = new DOMTreeBuilder(); + $is = new InstructionProcessorMock(); + $treeBuilder->setInstructionProcessor($is); + + $scanner = new Scanner($string); + $parser = new Tokenizer($scanner, $treeBuilder); + + $parser->parse(); + $dom = $treeBuilder->document(); + $div = $dom->getElementsByTagName('div')->item(0); + + $this->assertEquals(1, $is->count); + $this->assertEquals('foo', $is->name); + $this->assertEquals('bar ', $is->data); + $this->assertEquals('div', $div->tagName); + $this->assertEquals('foo', $div->textContent); + } + + public function testSelectGroupedOptions() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testSelectGroupedOptions</title> + </head> + <body> + <select> + <optgroup id="first" label="first"> + <option value="foo">foo</option> + <option value="bar">bar</option> + <option value="baz">baz</option> + </optgroup> + <optgroup id="second" label="second"> + <option value="lorem">lorem</option> + <option value="ipsum">ipsum</option> + </optgroup> + </select> + </body> +</html> +EOM; + $dom = $this->parse($html); + + $this->assertSame(3, $dom->getElementById('first')->getElementsByTagName('option')->length); + $this->assertSame(2, $dom->getElementById('second')->getElementsByTagName('option')->length); + } + + public function testVoidTag() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testVoidTag</title> + <meta> + <meta> + </head> + <body></body> +</html> +EOM; + + $dom = $this->parse($html); + $this->assertSame(2, $dom->getElementsByTagName('meta')->length); + $this->assertSame(0, $dom->getElementsByTagName('meta')->item(0)->childNodes->length); + $this->assertSame(0, $dom->getElementsByTagName('meta')->item(1)->childNodes->length); + } + + public function testIgnoreSelfClosingTag() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testIllegalSelfClosingTag</title> + </head> + <body> + <div /><span>Hello, World!</span></div> + </body> +</html> +EOM; + + $dom = $this->parse($html); + $this->assertSame(1, $dom->getElementsByTagName('div')->item(0)->childNodes->length); + } + + public function testIAudioInParagraph() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testIllegalSelfClosingTag</title> + </head> + <body> + <p> + <audio preload="none" controls="controls"> + <source src="https://example.com/test.mp3" type="audio/mpeg" /> + Your browser does not support the audio element. + </audio> + </p> + </body> +</html>> +</html> +EOM; + + $dom = $this->parse($html); + $audio = $dom->getElementsByTagName('audio')->item(0); + + $this->assertSame('p', $audio->parentNode->nodeName); + $this->assertSame(3, $audio->childNodes->length); + } + + public function testClosingBr() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testClosingBr</title> + </head> + <body> + <p> + This line ends with a normal line break <br class="attribute-should-be-retained"> + This line ends with a line break marked up as a closing tag </br class="attribute-should-be-discarded"> + </p> + </body> +</html>> +</html> +EOM; + + $dom = $this->parse($html); + + $this->assertSame(2, $dom->getElementsByTagName('br')->length); + $this->assertSame(1, $dom->getElementsByTagName('br')->item(0)->attributes->length); + $this->assertSame(0, $dom->getElementsByTagName('br')->item(1)->attributes->length); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/EventStack.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/EventStack.php new file mode 100644 index 000000000..3d1de7708 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/EventStack.php @@ -0,0 +1,116 @@ +<?php + +namespace Masterminds\HTML5\Tests\Parser; + +use Masterminds\HTML5\Elements; +use Masterminds\HTML5\Parser\EventHandler; + +/** + * This testing class gathers events from a parser and builds a stack of events. + * It is useful for checking the output of a tokenizer. + * + * IMPORTANT: + * + * The startTag event also kicks the parser into TEXT_RAW when it encounters + * script or pre tags. This is to match the behavior required by the HTML5 spec, + * which says that the tree builder must tell the tokenizer when to switch states. + */ +class EventStack implements EventHandler +{ + protected $stack; + + public function __construct() + { + $this->stack = array(); + } + + /** + * Get the event stack. + */ + public function events() + { + return $this->stack; + } + + public function depth() + { + return count($this->stack); + } + + public function get($index) + { + return $this->stack[$index]; + } + + protected function store($event, $data = null) + { + $this->stack[] = array( + 'name' => $event, + 'data' => $data, + ); + } + + public function doctype($name, $type = 0, $id = null, $quirks = false) + { + $args = array( + $name, + $type, + $id, + $quirks, + ); + $this->store('doctype', $args); + } + + public function startTag($name, $attributes = array(), $selfClosing = false) + { + $args = func_get_args(); + $this->store('startTag', $args); + if ('pre' == $name || 'script' == $name) { + return Elements::TEXT_RAW; + } + } + + public function endTag($name) + { + $this->store('endTag', array( + $name, + )); + } + + public function comment($cdata) + { + $this->store('comment', array( + $cdata, + )); + } + + public function cdata($data) + { + $this->store('cdata', func_get_args()); + } + + public function text($cdata) + { + // fprintf(STDOUT, "Received TEXT event with: " . $cdata); + $this->store('text', array( + $cdata, + )); + } + + public function eof() + { + $this->store('eof'); + } + + public function parseError($msg, $line, $col) + { + // throw new EventStackParseError(sprintf("%s (line %d, col %d)", $msg, $line, $col)); + // $this->store(sprintf("%s (line %d, col %d)", $msg, $line, $col)); + $this->store('error', func_get_args()); + } + + public function processingInstruction($name, $data = null) + { + $this->store('pi', func_get_args()); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php new file mode 100644 index 000000000..05c0a498f --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php @@ -0,0 +1,7 @@ +<?php + +namespace Masterminds\HTML5\Tests\Parser; + +class EventStackError extends \Exception +{ +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php new file mode 100644 index 000000000..4637a802c --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php @@ -0,0 +1,26 @@ +<?php + +namespace Masterminds\HTML5\Tests\Parser; + +class InstructionProcessorMock implements \Masterminds\HTML5\InstructionProcessor +{ + public $name = null; + + public $data = null; + + public $count = 0; + + public function process(\DOMElement $element, $name, $data) + { + $this->name = $name; + $this->data = $data; + ++$this->count; + + $div = $element->ownerDocument->createElement('div'); + $div->nodeValue = 'foo'; + + $element->appendChild($div); + + return $div; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php new file mode 100644 index 000000000..9f75c4dba --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php @@ -0,0 +1,184 @@ +<?php +/** + * @file + * Test the Scanner. This requires the InputStream tests are all good. + */ + +namespace Masterminds\HTML5\Tests\Parser; + +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\Scanner; + +class ScannerTest extends \Masterminds\HTML5\Tests\TestCase +{ + /** + * A canary test to make sure the basics are setup and working. + */ + public function testConstructDeprecated() + { + $is = new StringInputStream('abc'); + $s = new Scanner($is); + + $this->assertInstanceOf('\Masterminds\HTML5\Parser\Scanner', $s); + } + + public function testConstruct() + { + $this->assertInstanceOf('\Masterminds\HTML5\Parser\Scanner', new Scanner('abc')); + } + + public function testNextDeprecated() + { + $s = new Scanner(new StringInputStream('abc')); + + $this->assertEquals('b', $s->next()); + $this->assertEquals('c', $s->next()); + } + + public function testNext() + { + $s = new Scanner('abc'); + + $this->assertEquals('b', $s->next()); + $this->assertEquals('c', $s->next()); + } + + public function testPosition() + { + $s = new Scanner('abc'); + + $this->assertEquals(0, $s->position()); + + $s->next(); + $this->assertEquals(1, $s->position()); + } + + public function testPeek() + { + $s = new Scanner('abc'); + + $this->assertEquals('b', $s->peek()); + + $s->next(); + $this->assertEquals('c', $s->peek()); + } + + public function testCurrent() + { + $s = new Scanner('abc'); + + // Before scanning the string begins the current is empty. + $this->assertEquals('a', $s->current()); + + $c = $s->next(); + $this->assertEquals('b', $s->current()); + + // Test movement through the string. + $c = $s->next(); + $this->assertEquals('c', $s->current()); + } + + public function testUnconsume() + { + $s = new Scanner('abcdefghijklmnopqrst'); + + // Get initial position. + $s->next(); + $start = $s->position(); + + // Move forward a bunch of positions. + $amount = 7; + for ($i = 0; $i < $amount; ++$i) { + $s->next(); + } + + // Roll back the amount we moved forward. + $s->unconsume($amount); + + $this->assertEquals($start, $s->position()); + } + + public function testGetHex() + { + $s = new Scanner('ab13ck45DE*'); + + $this->assertEquals('ab13c', $s->getHex()); + + $s->next(); + $this->assertEquals('45DE', $s->getHex()); + } + + public function testGetAsciiAlpha() + { + $s = new Scanner('abcdef1%mnop*'); + + $this->assertEquals('abcdef', $s->getAsciiAlpha()); + + // Move past the 1% to scan the next group of text. + $s->next(); + $s->next(); + $this->assertEquals('mnop', $s->getAsciiAlpha()); + } + + public function testGetAsciiAlphaNum() + { + $s = new Scanner('abcdef1ghpo#mn94op'); + + $this->assertEquals('abcdef1ghpo', $s->getAsciiAlphaNum()); + + // Move past the # to scan the next group of text. + $s->next(); + $this->assertEquals('mn94op', $s->getAsciiAlphaNum()); + } + + public function testGetNumeric() + { + $s = new Scanner('1784a 45 9867 #'); + + $this->assertEquals('1784', $s->getNumeric()); + + // Move past the 'a ' to scan the next group of text. + $s->next(); + $s->next(); + $this->assertEquals('45', $s->getNumeric()); + } + + public function testCurrentLine() + { + $s = new Scanner("1784a\n45\n9867 #\nThis is a test."); + + $this->assertEquals(1, $s->currentLine()); + + // Move to the next line. + $s->getAsciiAlphaNum(); + $s->next(); + $this->assertEquals(2, $s->currentLine()); + } + + public function testColumnOffset() + { + $s = new Scanner("1784a a\n45 9867 #\nThis is a test."); + + // Move the pointer to the space. + $s->getAsciiAlphaNum(); + $this->assertEquals(5, $s->columnOffset()); + + // We move the pointer ahead. There must be a better way to do this. + $s->next(); + $s->next(); + $s->next(); + $s->next(); + $s->next(); + $s->next(); + $this->assertEquals(3, $s->columnOffset()); + } + + public function testRemainingChars() + { + $string = "\n45\n9867 #\nThis is a test."; + $s = new Scanner("1784a\n45\n9867 #\nThis is a test."); + + $s->getAsciiAlphaNum(); + $this->assertEquals($string, $s->remainingChars()); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php new file mode 100644 index 000000000..5284d30df --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php @@ -0,0 +1,978 @@ +<?php + +namespace Masterminds\HTML5\Tests\Parser; + +use Masterminds\HTML5\Parser\UTF8Utils; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\Tokenizer; + +class TokenizerTest extends \Masterminds\HTML5\Tests\TestCase +{ + // ================================================================ + // Additional assertions. + // ================================================================ + + /** + * Tests that an event matches both the event type and the expected value. + * + * @param string $type + * Expected event type + * @param string $expects + * The value expected in $event['data'][0] + */ + public function assertEventEquals($type, $expects, $event) + { + $this->assertEquals($type, $event['name'], "Event $type for " . print_r($event, true)); + if (is_array($expects)) { + $this->assertEquals($expects, $event['data'], "Event $type should equal " . print_r($expects, true) . ': ' . print_r($event, true)); + } else { + $d = (is_array($event['data']) ? $event['data'][0] : null); + $this->assertEquals($expects, $d, "Event $type should equal $expects: " . print_r($event, true)); + } + } + + /** + * Assert that a given event is 'error'. + */ + public function assertEventError($event) + { + $this->assertEquals('error', $event['name'], 'Expected error for event: ' . print_r($event, true)); + } + + /** + * Asserts that all of the tests are good. + * + * This loops through a map of tests/expectations and runs a few assertions on each test. + * + * Checks: + * - depth (if depth is > 0) + * - event name + * - matches on event 0. + */ + protected function isAllGood($name, $depth, $tests, $debug = false) + { + foreach ($tests as $try => $expects) { + if ($debug) { + fprintf(STDOUT, "%s expects %s\n", $try, print_r($expects, true)); + } + $e = $this->parse($try); + if ($depth > 0) { + $this->assertEquals($depth, $e->depth(), "Expected depth $depth for test $try." . print_r($e, true)); + } + $this->assertEventEquals($name, $expects, $e->get(0)); + } + } + + // ================================================================ + // Utility functions. + // ================================================================ + public function testParse() + { + list($tok, $events) = $this->createTokenizer(''); + + $tok->parse(); + $e1 = $events->get(0); + + $this->assertEquals(1, $events->Depth()); + $this->assertEquals('eof', $e1['name']); + } + + public function testWhitespace() + { + $spaces = ' '; + list($tok, $events) = $this->createTokenizer($spaces); + + $tok->parse(); + + $this->assertEquals(2, $events->depth()); + + $e1 = $events->get(0); + + $this->assertEquals('text', $e1['name']); + $this->assertEquals($spaces, $e1['data'][0]); + } + + public function testCharacterReference() + { + $good = array( + '&' => '&', + '<' => '<', + '&' => '&', + '&' => '&', + ); + $this->isAllGood('text', 2, $good); + + // Test with broken charref + $str = '&foo'; + $events = $this->parse($str); + $e1 = $events->get(0); + $this->assertEquals('error', $e1['name']); + + $str = 'oo'; + $events = $this->parse($str); + $e1 = $events->get(0); + $this->assertEquals('error', $e1['name']); + + $str = '&#foo'; + $events = $this->parse($str); + $e1 = $events->get(0); + $this->assertEquals('error', $e1['name']); + + // FIXME: Once the text processor is done, need to verify that the + // tokens are transformed correctly into text. + } + + public function testBogusComment() + { + $bogus = array( + '</+this is a bogus comment. +>', + '<!+this is a bogus comment. !>', + '<!D OCTYPE foo bar>', + '<!DOCTYEP foo bar>', + '<![CADATA[ TEST ]]>', + '<![CDATA Hello ]]>', + '<![CDATA[ Hello [[>', + '<!CDATA[[ test ]]>', + '<![CDATA[', + '<![CDATA[hellooooo hello', + '<? Hello World ?>', + '<? Hello World', + ); + foreach ($bogus as $str) { + $events = $this->parse($str); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('comment', $str, $events->get(1)); + } + } + + public function testEndTag() + { + $succeed = array( + '</a>' => 'a', + '</test>' => 'test', + '</test + >' => 'test', + '</thisIsTheTagThatDoesntEndItJustGoesOnAndOnMyFriend>' => 'thisisthetagthatdoesntenditjustgoesonandonmyfriend', + // See 8.2.4.10, which requires this and does not say error. + '</a<b>' => 'a<b', + ); + $this->isAllGood('endTag', 2, $succeed); + + // Recoverable failures + $fail = array( + '</a class="monkey">' => 'a', + '</a <b>' => 'a', + '</a <b <c>' => 'a', + '</a is the loneliest letter>' => 'a', + '</a' => 'a', + ); + foreach ($fail as $test => $result) { + $events = $this->parse($test); + $this->assertEquals(3, $events->depth()); + // Should have triggered an error. + $this->assertEventError($events->get(0)); + // Should have tried to parse anyway. + $this->assertEventEquals('endTag', $result, $events->get(1)); + } + + // BogoComments + $comments = array( + '</>' => '</>', + '</ >' => '</ >', + '</ a>' => '</ a>', + ); + foreach ($comments as $test => $result) { + $events = $this->parse($test); + $this->assertEquals(3, $events->depth()); + + // Should have triggered an error. + $this->assertEventError($events->get(0)); + + // Should have tried to parse anyway. + $this->assertEventEquals('comment', $result, $events->get(1)); + } + } + + public function testComment() + { + $good = array( + '<!--easy-->' => 'easy', + '<!-- 1 > 0 -->' => ' 1 > 0 ', + '<!-- --$i -->' => ' --$i ', + '<!----$i-->' => '--$i', + "<!--\nHello World.\na-->" => "\nHello World.\na", + '<!-- <!-- -->' => ' <!-- ', + ); + foreach ($good as $test => $expected) { + $events = $this->parse($test); + $this->assertEventEquals('comment', $expected, $events->get(0)); + } + + $fail = array( + '<!-->' => '', + '<!--Hello' => 'Hello', + "<!--\0Hello" => UTF8Utils::FFFD . 'Hello', + '<!--' => '', + ); + foreach ($fail as $test => $expected) { + $events = $this->parse($test); + $this->assertEquals(3, $events->depth()); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('comment', $expected, $events->get(1)); + } + } + + public function testCDATASection() + { + $good = array( + '<![CDATA[ This is a test. ]]>' => ' This is a test. ', + '<![CDATA[CDATA]]>' => 'CDATA', + '<![CDATA[ ]] > ]]>' => ' ]] > ', + '<![CDATA[ ]]>' => ' ', + ); + $this->isAllGood('cdata', 2, $good); + } + + public function testDoctype() + { + $good = array( + '<!DOCTYPE html>' => array( + 'html', + 0, + null, + false, + ), + '<!doctype html>' => array( + 'html', + 0, + null, + false, + ), + '<!DocType html>' => array( + 'html', + 0, + null, + false, + ), + "<!DOCTYPE\nhtml>" => array( + 'html', + 0, + null, + false, + ), + "<!DOCTYPE\fhtml>" => array( + 'html', + 0, + null, + false, + ), + '<!DOCTYPE html PUBLIC "foo bar">' => array( + 'html', + EventStack::DOCTYPE_PUBLIC, + 'foo bar', + false, + ), + "<!DOCTYPE html PUBLIC 'foo bar'>" => array( + 'html', + EventStack::DOCTYPE_PUBLIC, + 'foo bar', + false, + ), + '<!DOCTYPE html PUBLIC "foo bar" >' => array( + 'html', + EventStack::DOCTYPE_PUBLIC, + 'foo bar', + false, + ), + "<!DOCTYPE html \nPUBLIC\n'foo bar'>" => array( + 'html', + EventStack::DOCTYPE_PUBLIC, + 'foo bar', + false, + ), + '<!DOCTYPE html SYSTEM "foo bar">' => array( + 'html', + EventStack::DOCTYPE_SYSTEM, + 'foo bar', + false, + ), + "<!DOCTYPE html SYSTEM 'foo bar'>" => array( + 'html', + EventStack::DOCTYPE_SYSTEM, + 'foo bar', + false, + ), + '<!DOCTYPE html SYSTEM "foo/bar" >' => array( + 'html', + EventStack::DOCTYPE_SYSTEM, + 'foo/bar', + false, + ), + "<!DOCTYPE html \nSYSTEM\n'foo bar'>" => array( + 'html', + EventStack::DOCTYPE_SYSTEM, + 'foo bar', + false, + ), + ); + $this->isAllGood('doctype', 2, $good); + + $bad = array( + '<!DOCTYPE>' => array( + null, + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE >' => array( + null, + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo PUB' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo PUB>' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo PUB "Looks good">' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo SYSTME "Looks good"' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + + // Can't tell whether these are ids or ID types, since the context is chopped. + '<!DOCTYPE foo PUBLIC' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo PUBLIC>' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo SYSTEM' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + '<!DOCTYPE foo SYSTEM>' => array( + 'foo', + EventStack::DOCTYPE_NONE, + null, + true, + ), + + '<!DOCTYPE html SYSTEM "foo bar"' => array( + 'html', + EventStack::DOCTYPE_SYSTEM, + 'foo bar', + true, + ), + '<!DOCTYPE html SYSTEM "foo bar" more stuff>' => array( + 'html', + EventStack::DOCTYPE_SYSTEM, + 'foo bar', + true, + ), + ); + foreach ($bad as $test => $expects) { + $events = $this->parse($test); + // fprintf(STDOUT, $test . PHP_EOL); + $this->assertEquals(3, $events->depth(), "Counting events for '$test': " . print_r($events, true)); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('doctype', $expects, $events->get(1)); + } + } + + public function testProcessorInstruction() + { + $good = array( + '<?hph ?>' => 'hph', + '<?hph echo "Hello World"; ?>' => array( + 'hph', + 'echo "Hello World"; ', + ), + "<?hph \necho 'Hello World';\n?>" => array( + 'hph', + "echo 'Hello World';\n", + ), + ); + $this->isAllGood('pi', 2, $good); + } + + /** + * This tests just simple tags. + */ + public function testSimpleTags() + { + $open = array( + '<foo>' => 'foo', + '<FOO>' => 'foo', + '<fOO>' => 'foo', + '<foo >' => 'foo', + "<foo\n\n\n\n>" => 'foo', + '<foo:bar>' => 'foo:bar', + ); + $this->isAllGood('startTag', 2, $open); + + $selfClose = array( + '<foo/>' => 'foo', + '<FOO/>' => 'foo', + '<foo />' => 'foo', + "<foo\n\n\n\n/>" => 'foo', + '<foo:bar/>' => 'foo:bar', + ); + foreach ($selfClose as $test => $expects) { + $events = $this->parse($test); + $this->assertEquals(2, $events->depth(), "Counting events for '$test'" . print_r($events, true)); + $this->assertEventEquals('startTag', $expects, $events->get(0)); + $event = $events->get(0); + $this->assertTrue($event['data'][2]); + } + + $bad = array( + '<foo' => 'foo', + '<foo ' => 'foo', + '<foo/' => 'foo', + '<foo /' => 'foo', + ); + + foreach ($bad as $test => $expects) { + $events = $this->parse($test); + $this->assertEquals(3, $events->depth(), "Counting events for '$test': " . print_r($events, true)); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', $expects, $events->get(1)); + } + } + + public function testTagsWithAttributeAndMissingName() + { + $cases = array( + '<id="top_featured">' => 'id', + '<color="white">' => 'color', + "<class='neaktivni_stranka'>" => 'class', + '<bgcolor="white">' => 'bgcolor', + '<class="nom">' => 'class', + ); + + foreach ($cases as $html => $expected) { + $events = $this->parse($html); + $this->assertEventError($events->get(0)); + $this->assertEventError($events->get(1)); + $this->assertEventError($events->get(2)); + $this->assertEventEquals('startTag', $expected, $events->get(3)); + $this->assertEventEquals('eof', null, $events->get(4)); + } + } + + public function testTagNotClosedAfterTagName() + { + $cases = array( + '<noscript<img>' => array( + 'noscript', + 'img', + ), + '<center<a>' => array( + 'center', + 'a', + ), + '<br<br>' => array( + 'br', + 'br', + ), + ); + + foreach ($cases as $html => $expected) { + $events = $this->parse($html); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', $expected[0], $events->get(1)); + $this->assertEventEquals('startTag', $expected[1], $events->get(2)); + $this->assertEventEquals('eof', null, $events->get(3)); + } + + $events = $this->parse('<span<>02</span>'); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', 'span', $events->get(1)); + $this->assertEventError($events->get(2)); + $this->assertEventEquals('text', '>02', $events->get(3)); + $this->assertEventEquals('endTag', 'span', $events->get(4)); + $this->assertEventEquals('eof', null, $events->get(5)); + + $events = $this->parse('<p</p>'); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', 'p', $events->get(1)); + $this->assertEventEquals('endTag', 'p', $events->get(2)); + $this->assertEventEquals('eof', null, $events->get(3)); + + $events = $this->parse('<strong><WordPress</strong>'); + $this->assertEventEquals('startTag', 'strong', $events->get(0)); + $this->assertEventError($events->get(1)); + $this->assertEventEquals('startTag', 'wordpress', $events->get(2)); + $this->assertEventEquals('endTag', 'strong', $events->get(3)); + $this->assertEventEquals('eof', null, $events->get(4)); + + $events = $this->parse('<src=<a>'); + $this->assertEventError($events->get(0)); + $this->assertEventError($events->get(1)); + $this->assertEventError($events->get(2)); + $this->assertEventEquals('startTag', 'src', $events->get(3)); + $this->assertEventEquals('startTag', 'a', $events->get(4)); + $this->assertEventEquals('eof', null, $events->get(5)); + + $events = $this->parse('<br...<a>'); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', 'br', $events->get(1)); + $this->assertEventEquals('eof', null, $events->get(2)); + } + + public function testIllegalTagNames() + { + $cases = array( + '<li">' => 'li', + '<p">' => 'p', + '<b >' => 'b', + '<static*all>' => 'static', + '<h*0720/>' => 'h', + '<st*ATTRIBUTE />' => 'st', + ); + + foreach ($cases as $html => $expected) { + $events = $this->parse($html); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', $expected, $events->get(1)); + } + } + + public function testTagAttributes() + { + // Opening tags. + $good = array( + '<foo bar="baz">' => array( + 'foo', + array( + 'bar' => 'baz', + ), + false, + ), + '<foo bar=" baz ">' => array( + 'foo', + array( + 'bar' => ' baz ', + ), + false, + ), + "<foo bar=\"\nbaz\n\">" => array( + 'foo', + array( + 'bar' => "\nbaz\n", + ), + false, + ), + "<foo bar='baz'>" => array( + 'foo', + array( + 'bar' => 'baz', + ), + false, + ), + '<foo bar="A full sentence.">' => array( + 'foo', + array( + 'bar' => 'A full sentence.', + ), + false, + ), + "<foo a='1' b=\"2\">" => array( + 'foo', + array( + 'a' => '1', + 'b' => '2', + ), + false, + ), + "<foo ns:bar='baz'>" => array( + 'foo', + array( + 'ns:bar' => 'baz', + ), + false, + ), + "<foo a='blue&red'>" => array( + 'foo', + array( + 'a' => 'blue&red', + ), + false, + ), + "<foo a='blue&red'>" => array( + 'foo', + array( + 'a' => 'blue&red', + ), + false, + ), + "<foo a='blue&&&red'>" => array( + 'foo', + array( + 'a' => 'blue&&&red', + ), + false, + ), + "<foo a='blue&&red'>" => array( + 'foo', + array( + 'a' => 'blue&&red', + ), + false, + ), + "<foo\nbar='baz'\n>" => array( + 'foo', + array( + 'bar' => 'baz', + ), + false, + ), + '<doe a deer>' => array( + 'doe', + array( + 'a' => null, + 'deer' => null, + ), + false, + ), + '<foo bar=baz>' => array( + 'foo', + array( + 'bar' => 'baz', + ), + false, + ), + + // Updated for 8.1.2.3 + '<foo bar = "baz" >' => array( + 'foo', + array( + 'bar' => 'baz', + ), + false, + ), + + // The spec allows an unquoted value '/'. This will not be a closing + // tag. + '<foo bar=/>' => array( + 'foo', + array( + 'bar' => '/', + ), + false, + ), + '<foo bar=baz/>' => array( + 'foo', + array( + 'bar' => 'baz/', + ), + false, + ), + ); + $this->isAllGood('startTag', 2, $good); + + // Self-closing tags. + $withEnd = array( + '<foo bar="baz"/>' => array( + 'foo', + array( + 'bar' => 'baz', + ), + true, + ), + '<foo BAR="baz"/>' => array( + 'foo', + array( + 'bar' => 'baz', + ), + true, + ), + '<foo BAR="BAZ"/>' => array( + 'foo', + array( + 'bar' => 'BAZ', + ), + true, + ), + "<foo a='1' b=\"2\" c=3 d/>" => array( + 'foo', + array( + 'a' => '1', + 'b' => '2', + 'c' => '3', + 'd' => null, + ), + true, + ), + ); + $this->isAllGood('startTag', 2, $withEnd); + + // Cause a parse error. + $bad = array( + // This will emit an entity lookup failure for &+dark. + "<foo a='blue&+dark'>" => array( + 'foo', + array( + 'a' => 'blue&+dark', + ), + false, + ), + '<foo bar=>' => array( + 'foo', + array( + 'bar' => null, + ), + false, + ), + '<foo bar="oh' => array( + 'foo', + array( + 'bar' => 'oh', + ), + false, + ), + '<foo bar=oh">' => array( + 'foo', + array( + 'bar' => 'oh"', + ), + false, + ), + + // these attributes are ignored because of current implementation + // of method "DOMElement::setAttribute" + // see issue #23: https://github.com/Masterminds/html5-php/issues/23 + '<foo b"="baz">' => array( + 'foo', + array(), + false, + ), + '<foo 2abc="baz">' => array( + 'foo', + array(), + false, + ), + '<foo ?="baz">' => array( + 'foo', + array(), + false, + ), + '<foo foo?bar="baz">' => array( + 'foo', + array(), + false, + ), + ) + ; + foreach ($bad as $test => $expects) { + $events = $this->parse($test); + $this->assertEquals(3, $events->depth(), "Counting events for '$test': " . print_r($events, true)); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', $expects, $events->get(1)); + } + + // Cause multiple parse errors. + $reallyBad = array( + '<foo ="bar">' => array( + 'foo', + array( + '=' => null, + '"bar"' => null, + ), + false, + ), + '<foo////>' => array( + 'foo', + array(), + true, + ), + // character "&" in unquoted attribute shouldn't cause an infinite loop + '<foo bar=index.php?str=1&id=29>' => array( + 'foo', + array( + 'bar' => 'index.php?str=1&id=29', + ), + false, + ), + ); + foreach ($reallyBad as $test => $expects) { + $events = $this->parse($test); + // fprintf(STDOUT, $test . print_r($events, true)); + $this->assertEventError($events->get(0)); + $this->assertEventError($events->get(1)); + // $this->assertEventEquals('startTag', $expects, $events->get(1)); + } + + // Regression: Malformed elements should be detected. + // '<foo baz="1" <bar></foo>' => array('foo', array('baz' => '1'), false), + $events = $this->parse('<foo baz="1" <bar></foo>'); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', array( + 'foo', + array( + 'baz' => '1', + ), + false, + ), $events->get(1)); + $this->assertEventEquals('startTag', array( + 'bar', + array(), + false, + ), $events->get(2)); + $this->assertEventEquals('endTag', array( + 'foo', + ), $events->get(3)); + } + + public function testRawText() + { + $good = array( + '<script>abcd efg hijk lmnop</script> ' => 'abcd efg hijk lmnop', + '<script><not/><the/><tag></script>' => '<not/><the/><tag>', + '<script><<<<<<<<</script>' => '<<<<<<<<', + '<script>hello</script</script>' => 'hello</script', + "<script>\nhello</script\n</script>" => "\nhello</script\n", + '<script>&</script>' => '&', + '<script><!--not a comment--></script>' => '<!--not a comment-->', + '<script><![CDATA[not a comment]]></script>' => '<![CDATA[not a comment]]>', + ); + foreach ($good as $test => $expects) { + $events = $this->parse($test); + $this->assertEventEquals('startTag', 'script', $events->get(0)); + $this->assertEventEquals('text', $expects, $events->get(1)); + $this->assertEventEquals('endTag', 'script', $events->get(2)); + } + + $bad = array( + '<script>&</script' => '&</script', + '<script>Hello world' => 'Hello world', + ); + foreach ($bad as $test => $expects) { + $events = $this->parse($test); + $this->assertEquals(4, $events->depth(), "Counting events for '$test': " . print_r($events, true)); + $this->assertEventEquals('startTag', 'script', $events->get(0)); + $this->assertEventError($events->get(1)); + $this->assertEventEquals('text', $expects, $events->get(2)); + } + + // Testing case sensitivity + $events = $this->parse('<TITLE>a test</TITLE>'); + $this->assertEventEquals('startTag', 'title', $events->get(0)); + $this->assertEventEquals('text', 'a test', $events->get(1)); + $this->assertEventEquals('endTag', 'title', $events->get(2)); + + // Testing end tags with whitespaces + $events = $this->parse('<title>Whitespaces are tasty</title >'); + $this->assertEventEquals('startTag', 'title', $events->get(0)); + $this->assertEventEquals('text', 'Whitespaces are tasty', $events->get(1)); + $this->assertEventEquals('endTag', 'title', $events->get(2)); + } + + public function testRcdata() + { + list($tok, $events) = $this->createTokenizer('<title>'<!-- not a comment --></TITLE>'); + $tok->setTextMode(\Masterminds\HTML5\Elements::TEXT_RCDATA, 'title'); + $tok->parse(); + $this->assertEventEquals('text', "'<!-- not a comment -->", $events->get(1)); + } + + public function testText() + { + $events = $this->parse('a<br>b'); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); + $this->assertEventEquals('text', 'a', $events->get(0)); + $this->assertEventEquals('startTag', 'br', $events->get(1)); + $this->assertEventEquals('text', 'b', $events->get(2)); + + $events = $this->parse('<a>Test</a>'); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); + $this->assertEventEquals('startTag', 'a', $events->get(0)); + $this->assertEventEquals('text', 'Test', $events->get(1)); + $this->assertEventEquals('endTag', 'a', $events->get(2)); + + $events = $this->parse('<p>0</p><p>1</p>'); + $this->assertEquals(7, $events->depth(), 'Events: ' . print_r($events, true)); + + $this->assertEventEquals('startTag', 'p', $events->get(0)); + $this->assertEventEquals('text', '0', $events->get(1)); + $this->assertEventEquals('endTag', 'p', $events->get(2)); + + $this->assertEventEquals('startTag', 'p', $events->get(3)); + $this->assertEventEquals('text', '1', $events->get(4)); + $this->assertEventEquals('endTag', 'p', $events->get(5)); + + $events = $this->parse('a<![CDATA[test]]>b'); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); + $this->assertEventEquals('text', 'a', $events->get(0)); + $this->assertEventEquals('cdata', 'test', $events->get(1)); + $this->assertEventEquals('text', 'b', $events->get(2)); + + $events = $this->parse('a<!--test-->b'); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); + $this->assertEventEquals('text', 'a', $events->get(0)); + $this->assertEventEquals('comment', 'test', $events->get(1)); + $this->assertEventEquals('text', 'b', $events->get(2)); + + $events = $this->parse('a&b'); + $this->assertEquals(2, $events->depth(), 'Events: ' . print_r($events, true)); + $this->assertEventEquals('text', 'a&b', $events->get(0)); + + $events = $this->parse('a²b'); + $this->assertEquals(2, $events->depth(), 'Events: ' . print_r($events, true)); + $this->assertEventEquals('text', 'a²b', $events->get(0)); + } + + // ================================================================ + // Utility functions. + // ================================================================ + protected function createTokenizer($string, $debug = false) + { + $eventHandler = new EventStack(); + $scanner = new Scanner($string); + + $scanner->debug = $debug; + + return array( + new Tokenizer($scanner, $eventHandler), + $eventHandler, + ); + } + + public function parse($string, $debug = false) + { + list($tok, $events) = $this->createTokenizer($string, $debug); + $tok->parse(); + + return $events; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php new file mode 100644 index 000000000..45c68bcfb --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php @@ -0,0 +1,118 @@ +<?php +/** + * @file + * Test the Tree Builder's special-case rules. + */ + +namespace Masterminds\HTML5\Tests\Parser; + +use Masterminds\HTML5\Parser\TreeBuildingRules; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\DOMTreeBuilder; + +/** + * These tests are functional, not necessarily unit tests. + */ +class TreeBuildingRulesTest extends \Masterminds\HTML5\Tests\TestCase +{ + const HTML_STUB = '<!DOCTYPE html><html><head><title>test</title></head><body>%s</body></html>'; + + /** + * Convenience function for parsing. + */ + protected function parse($string) + { + $treeBuilder = new DOMTreeBuilder(); + $scanner = new Scanner($string); + $parser = new Tokenizer($scanner, $treeBuilder); + + $parser->parse(); + + return $treeBuilder->document(); + } + + /** + * Convenience function for parsing fragments. + */ + protected function parseFragment($string) + { + $events = new DOMTreeBuilder(true); + $scanner = new Scanner($string); + $parser = new Tokenizer($scanner, $events); + + $parser->parse(); + + return $events->fragment(); + } + + public function testTDFragment() + { + $frag = $this->parseFragment('<td>This is a test of the HTML5 parser</td>'); + + $td = $frag->childNodes->item(0); + + $this->assertEquals(1, $frag->childNodes->length); + $this->assertEquals('td', $td->tagName); + $this->assertEquals('This is a test of the HTML5 parser', $td->nodeValue); + } + + public function testHasRules() + { + $doc = new \DOMDocument('1.0'); + $engine = new TreeBuildingRules($doc); + + $this->assertTrue($engine->hasRules('li')); + $this->assertFalse($engine->hasRules('imaginary')); + } + + public function testHandleLI() + { + $html = sprintf(self::HTML_STUB, '<ul id="a"><li>test<li>test2</ul><a></a>'); + $doc = $this->parse($html); + + $list = $doc->getElementById('a'); + + $this->assertEquals(2, $list->childNodes->length); + foreach ($list->childNodes as $ele) { + $this->assertEquals('li', $ele->tagName); + } + } + + public function testHandleDT() + { + $html = sprintf(self::HTML_STUB, '<dl id="a"><dt>Hello<dd>Hi</dl><a></a>'); + $doc = $this->parse($html); + + $list = $doc->getElementById('a'); + + $this->assertEquals(2, $list->childNodes->length); + $this->assertEquals('dt', $list->firstChild->tagName); + $this->assertEquals('dd', $list->lastChild->tagName); + } + + public function testHandleOptionGroupAndOption() + { + $html = sprintf(self::HTML_STUB, '<optgroup id="foo" label="foo" ><option value="foo">bar</option></optgroup>'); + $doc = $this->parse($html); + + $list = $doc->getElementById('foo'); + + $this->assertEquals(1, $list->childNodes->length); + + $option = $list->childNodes->item(0); + $this->assertEquals('option', $option->tagName); + } + + public function testTable() + { + $html = sprintf(self::HTML_STUB, '<table><thead id="a"><th>foo<td>bar<td>baz'); + $doc = $this->parse($html); + + $list = $doc->getElementById('a'); + + $this->assertEquals(3, $list->childNodes->length); + $this->assertEquals('th', $list->firstChild->tagName); + $this->assertEquals('td', $list->lastChild->tagName); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php new file mode 100644 index 000000000..72c26a4b3 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php @@ -0,0 +1,28 @@ +<?php + +namespace Masterminds\HTML5\Tests\Parser; + +use Masterminds\HTML5\Parser\UTF8Utils; + +class UTF8UtilsTest extends \Masterminds\HTML5\Tests\TestCase +{ + public function testConvertToUTF8() + { + $out = UTF8Utils::convertToUTF8('éàa', 'ISO-8859-1'); + $this->assertEquals('éà a', $out); + } + + /** + * @todo add tests for invalid codepoints + */ + public function testCheckForIllegalCodepoints() + { + $smoke = 'Smoke test'; + $err = UTF8Utils::checkForIllegalCodepoints($smoke); + $this->assertEmpty($err); + + $data = "Foo Bar \0 Baz"; + $errors = UTF8Utils::checkForIllegalCodepoints($data); + $this->assertContains('null-character', $errors); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php new file mode 100644 index 000000000..913051657 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php @@ -0,0 +1,652 @@ +<?php + +namespace Masterminds\HTML5\Tests\Serializer; + +use Masterminds\HTML5\Serializer\OutputRules; +use Masterminds\HTML5\Serializer\Traverser; +use Masterminds\HTML5; + +class OutputRulesTest extends \Masterminds\HTML5\Tests\TestCase +{ + protected $markup = '<!doctype html> + <html lang="en"> + <head> + <meta charset="utf-8"> + <title>Test</title> + </head> + <body> + <p>This is a test.</p> + </body> + </html>'; + + /** + * @var HTML5 + */ + protected $html5; + + public function setUp() + { + $this->html5 = $this->getInstance(); + } + + /** + * Using reflection we make a protected method accessible for testing. + * + * @param string $name + * The name of the method on the Traverser class to test + * + * @return \ReflectionMethod for the specified method + */ + public function getProtectedMethod($name) + { + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\OutputRules'); + $method = $class->getMethod($name); + $method->setAccessible(true); + + return $method; + } + + public function getTraverserProtectedProperty($name) + { + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\Traverser'); + $property = $class->getProperty($name); + $property->setAccessible(true); + + return $property; + } + + public function getOutputRules($options = array()) + { + $options = $options + $this->html5->getOptions(); + $stream = fopen('php://temp', 'w'); + $dom = $this->html5->loadHTML($this->markup); + $r = new OutputRules($stream, $options); + $t = new Traverser($dom, $stream, $r, $options); + + return array( + $r, + $stream, + ); + } + + public function testDocument() + { + $dom = $this->html5->loadHTML('<!doctype html><html lang="en"><body>foo</body></html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $r->document($dom); + $expected = '<!DOCTYPE html>' . PHP_EOL . '<html lang="en"><body>foo</body></html>' . PHP_EOL; + $this->assertEquals($expected, stream_get_contents($stream, -1, 0)); + } + + public function testEmptyDocument() + { + $dom = $this->html5->loadHTML(''); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $r->document($dom); + $expected = '<!DOCTYPE html>' . PHP_EOL; + $this->assertEquals($expected, stream_get_contents($stream, -1, 0)); + } + + public function testDoctype() + { + $dom = $this->html5->loadHTML('<!doctype html><html lang="en"><body>foo</body></html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $m = $this->getProtectedMethod('doctype'); + $m->invoke($r, 'foo'); + $this->assertEquals('<!DOCTYPE html>' . PHP_EOL, stream_get_contents($stream, -1, 0)); + } + + public function testElement() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + <svg width="150" height="100" viewBox="0 0 3 2"> + <rect width="1" height="2" x="0" fill="#008d46" /> + <rect width="1" height="2" x="1" fill="#ffffff" /> + <rect width="1" height="2" x="2" fill="#d2232c" /> + </svg> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('div'); + $r->element($list->item(0)); + $this->assertEquals('<div id="foo" class="bar baz">foo bar baz</div>', stream_get_contents($stream, -1, 0)); + } + + public function testSerializeWithNamespaces() + { + $this->html5 = $this->getInstance(array( + 'xmlNamespaces' => true, + )); + + $source = ' + <!DOCTYPE html> + <html><body id="body" xmlns:x="http://www.prefixed.com"> + <a id="bar1" xmlns="http://www.prefixed.com/bar1"> + <b id="bar4" xmlns="http://www.prefixed.com/bar4"><x:prefixed id="prefixed">xy</x:prefixed></b> + </a> + <svg id="svg">svg</svg> + <c id="bar2" xmlns="http://www.prefixed.com/bar2"></c> + <div id="div"></div> + <d id="bar3"></d> + <xn:d id="bar5" xmlns:xn="http://www.prefixed.com/xn" xmlns="http://www.prefixed.com/bar5_x"><x id="bar5_x">y</x></xn:d> + </body> + </html>'; + + $dom = $this->html5->loadHTML($source, array( + 'xmlNamespaces' => true, + )); + $this->assertFalse($this->html5->hasErrors(), print_r($this->html5->getErrors(), 1)); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $t->walk(); + $rendered = stream_get_contents($stream, -1, 0); + + $clear = function ($s) { + return trim(preg_replace('/[\s]+/', ' ', $s)); + }; + + $this->assertEquals($clear($source), $clear($rendered)); + } + + public function testElementWithScript() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <head> + <script> + var $jQ = jQuery.noConflict(); + // Use jQuery via $jQ(...) + $jQ(document).ready(function () { + $jQ("#mktFrmSubmit").wrap("<div class=\'buttonSubmit\'></div>"); + $jQ(".buttonSubmit").prepend("<span></span>"); + }); + </script> + </head> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $script = $dom->getElementsByTagName('script'); + $r->element($script->item(0)); + $this->assertEquals( + '<script> + var $jQ = jQuery.noConflict(); + // Use jQuery via $jQ(...) + $jQ(document).ready(function () { + $jQ("#mktFrmSubmit").wrap("<div class=\'buttonSubmit\'></div>"); + $jQ(".buttonSubmit").prepend("<span></span>"); + }); + </script>', stream_get_contents($stream, -1, 0)); + } + + public function testElementWithStyle() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <head> + <style> + body > .bar { + display: none; + } + </style> + </head> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $style = $dom->getElementsByTagName('style'); + $r->element($style->item(0)); + $this->assertEquals('<style> + body > .bar { + display: none; + } + </style>', stream_get_contents($stream, -1, 0)); + } + + public function testOpenTag() + { + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('div'); + $m = $this->getProtectedMethod('openTag'); + $m->invoke($r, $list->item(0)); + $this->assertEquals('<div id="foo" class="bar baz">', stream_get_contents($stream, -1, 0)); + } + + public function testCData() + { + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <body> + <div><![CDATA[bar]]></div> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('div'); + $r->cdata($list->item(0)->childNodes->item(0)); + $this->assertEquals('<![CDATA[bar]]>', stream_get_contents($stream, -1, 0)); + + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <body> + <div id="foo"></div> + </body> + </html>'); + + $dom->getElementById('foo')->appendChild(new \DOMCdataSection(']]>Foo<[![CDATA test ]]>')); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $list = $dom->getElementsByTagName('div'); + $r->cdata($list->item(0)->childNodes->item(0)); + + $this->assertEquals('<![CDATA[]]]]><![CDATA[>Foo<[![CDATA test ]]]]><![CDATA[>]]>', stream_get_contents($stream, -1, 0)); + } + + public function testComment() + { + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <body> + <div><!-- foo --></div> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('div'); + $r->comment($list->item(0)->childNodes->item(0)); + $this->assertEquals('<!-- foo -->', stream_get_contents($stream, -1, 0)); + + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <body> + <div id="foo"></div> + </body> + </html>'); + $dom->getElementById('foo')->appendChild(new \DOMComment('<!-- --> --> Foo -->')); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('div'); + $r->comment($list->item(0)->childNodes->item(0)); + + // Could not find more definitive guidelines on what this should be. Went with + // what the HTML5 spec says and what \DOMDocument::saveXML() produces. + $this->assertEquals('<!--<!-- --> --> Foo -->-->', stream_get_contents($stream, -1, 0)); + } + + public function testText() + { + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <head> + <script>baz();</script> + </head> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('script'); + $r->text($list->item(0)->childNodes->item(0)); + $this->assertEquals('baz();', stream_get_contents($stream, -1, 0)); + + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <head id="foo"></head> + </html>'); + $foo = $dom->getElementById('foo'); + $foo->appendChild(new \DOMText('<script>alert("hi");</script>')); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $r->text($foo->firstChild); + $this->assertEquals('<script>alert("hi");</script>', stream_get_contents($stream, -1, 0)); + } + + public function testNl() + { + list($o, $s) = $this->getOutputRules(); + + $m = $this->getProtectedMethod('nl'); + $m->invoke($o); + $this->assertEquals(PHP_EOL, stream_get_contents($s, -1, 0)); + } + + public function testWr() + { + list($o, $s) = $this->getOutputRules(); + + $m = $this->getProtectedMethod('wr'); + $m->invoke($o, 'foo'); + $this->assertEquals('foo', stream_get_contents($s, -1, 0)); + } + + public function getEncData() + { + return array( + array( + false, + '&\'<>"', + '&\'<>"', + '&'<>"', + ), + array( + false, + 'This + is. a < test', + 'This + is. a < test', + 'This + is. a < test', + ), + array( + false, + '.+#', + '.+#', + '.+#', + ), + + array( + true, + '.+#\'', + '.+#\'', + '.+#'', + ), + array( + true, + '&".<', + '&".<', + '&".<', + ), + array( + true, + '&\'<>"', + '&\'<>"', + '&'<>"', + ), + array( + true, + "\xc2\xa0\"'", + ' "\'', + ' "'', + ), + ); + } + + /** + * Test basic encoding of text. + * + * @dataProvider getEncData + */ + public function testEnc($isAttribute, $test, $expected, $expectedEncoded) + { + list($o, $s) = $this->getOutputRules(); + $m = $this->getProtectedMethod('enc'); + + $this->assertEquals($expected, $m->invoke($o, $test, $isAttribute)); + + list($o, $s) = $this->getOutputRules(array( + 'encode_entities' => true, + )); + $m = $this->getProtectedMethod('enc'); + $this->assertEquals($expectedEncoded, $m->invoke($o, $test, $isAttribute)); + } + + /** + * Test basic encoding of text. + * + * @dataProvider getEncData + */ + public function testEscape($isAttribute, $test, $expected, $expectedEncoded) + { + list($o, $s) = $this->getOutputRules(); + $m = $this->getProtectedMethod('escape'); + + $this->assertEquals($expected, $m->invoke($o, $test, $isAttribute)); + } + + public function booleanAttributes() + { + return array( + array('<img alt="" ismap>'), + array('<img alt="">'), + array('<input type="radio" readonly>'), + array('<input type="radio" checked disabled>'), + array('<input type="checkbox" checked disabled>'), + array('<input type="radio" value="" checked disabled>'), + array('<div data-value=""></div>'), + array('<select disabled></select>'), + array('<div ng-app></div>'), + array('<script defer></script>'), + ); + } + + /** + * @dataProvider booleanAttributes + */ + public function testBooleanAttrs($html) + { + $dom = $this->html5->loadHTML('<!doctype html><html lang="en"><body>' . $html . '</body></html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $node = $dom->getElementsByTagName('body')->item(0)->firstChild; + + $m = $this->getProtectedMethod('attrs'); + $m->invoke($r, $node); + + $content = stream_get_contents($stream, -1, 0); + + $html = preg_replace('~<[a-z]+(.*)></[a-z]+>~', '\1', $html); + $html = preg_replace('~<[a-z]+(.*)/?>~', '\1', $html); + + $this->assertEquals($content, $html); + } + + public function testAttrs() + { + $dom = $this->html5->loadHTML('<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('div'); + + $m = $this->getProtectedMethod('attrs'); + $m->invoke($r, $list->item(0)); + + $content = stream_get_contents($stream, -1, 0); + $this->assertEquals(' id="foo" class="bar baz"', $content); + } + + public function testSvg() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + <svg width="150" height="100" viewBox="0 0 3 2"> + <rect width="1" height="2" x="0" fill="#008d46" /> + <rect width="1" height="2" x="1" fill="#ffffff" /> + <rect width="1" height="2" x="2" fill="#d2232c" /> + <rect id="Bar" x="300" y="100" width="300" height="100" fill="rgb(255,255,0)"> + <animate attributeName="x" attributeType="XML" begin="0s" dur="9s" fill="freeze" from="300" to="0" /> + </rect> + </svg> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('svg'); + $r->element($list->item(0)); + $contents = stream_get_contents($stream, -1, 0); + $this->assertRegExp('|<svg width="150" height="100" viewBox="0 0 3 2">|', $contents); + $this->assertRegExp('|<rect width="1" height="2" x="0" fill="#008d46" />|', $contents); + $this->assertRegExp('|<rect id="Bar" x="300" y="100" width="300" height="100" fill="rgb\(255,255,0\)">|', $contents); + } + + public function testMath() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + <math> + <mi>x</mi> + <csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus"> + <mo>±</mo> + </csymbol> + <mi>y</mi> + </math> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('math'); + $r->element($list->item(0)); + $content = stream_get_contents($stream, -1, 0); + $this->assertRegExp('|<math>|', $content); + $this->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|', $content); + } + + public function testProcessorInstruction() + { + $dom = $this->html5->loadHTMLFragment('<?foo bar ?>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $r->processorInstruction($dom->firstChild); + $content = stream_get_contents($stream, -1, 0); + $this->assertRegExp('|<\?foo bar \?>|', $content); + } + + public function testAddressTag() + { + $dom = $this->html5->loadHTML( + '<!doctype html> + <html lang="en"> + <body> + <address> + <a href="../People/Raggett/">Dave Raggett</a>, + <a href="../People/Arnaud/">Arnaud Le Hors</a>, + contact persons for the <a href="Activity">W3C HTML Activity</a> + </address> + </body> + </html>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $list = $dom->getElementsByTagName('address'); + $r->element($list->item(0)); + $contents = stream_get_contents($stream, -1, 0); + + $this->assertRegExp('|<address>|', $contents); + $this->assertRegExp('|<a href="../People/Raggett/">Dave Raggett</a>,|', $contents); + $this->assertRegExp('|<a href="../People/Arnaud/">Arnaud Le Hors</a>,|', $contents); + $this->assertRegExp('|contact persons for the <a href="Activity">W3C HTML Activity</a>|', $contents); + $this->assertRegExp('|</address>|', $contents); + } + + /** + * Ensure direct DOM manipulation doesn't break TEXT_RAW elements (iframe, script, etc...). + */ + public function testHandlingInvalidRawContent() + { + $dom = $this->html5->loadHTML( + '<!doctype html> +<html lang="en" id="base"> + <body> + <script id="template" type="x-tmpl-mustache"> + <h1>Hello!</h1> + </script> + </body> +</html>'); + + $badNode = $dom->createElement('p', 'Bar'); + + // modify the content of the TEXT_RAW element: <script id="template"> appending dom nodes + $styleElement = $dom->getElementById('template'); + $styleElement->appendChild($badNode); + + $contents = $this->html5->saveHTML($dom); + + $this->assertTrue(false !== strpos($contents, '<script id="template" type="x-tmpl-mustache"> + <h1>Hello!</h1> + <p>Bar</p></script>')); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php new file mode 100644 index 000000000..d4ae7b351 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php @@ -0,0 +1,136 @@ +<?php + +namespace Masterminds\HTML5\Tests\Serializer; + +use Masterminds\HTML5\Serializer\OutputRules; +use Masterminds\HTML5\Serializer\Traverser; + +class TraverserTest extends \Masterminds\HTML5\Tests\TestCase +{ + protected $markup = '<!doctype html> + <html lang="en"> + <head> + <meta charset="utf-8"> + <title>Test</title> + </head> + <body> + <p>This is a test.</p> + </body> + </html>'; + + public function setUp() + { + $this->html5 = $this->getInstance(); + } + + /** + * Using reflection we make a protected method accessible for testing. + * + * @param string $name + * The name of the method on the Traverser class to test + * + * @return \ReflectionMethod \ReflectionMethod for the specified method + */ + public function getProtectedMethod($name) + { + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\Traverser'); + $method = $class->getMethod($name); + $method->setAccessible(true); + + return $method; + } + + public function getTraverser() + { + $stream = fopen('php://temp', 'w'); + + $dom = $this->html5->loadHTML($this->markup); + $t = new Traverser($dom, $stream, $html5->getOptions()); + + // We return both the traverser and stream so we can pull from it. + return array( + $t, + $stream, + ); + } + + public function testConstruct() + { + // The traverser needs a place to write the output to. In our case we + // use a stream in temp space. + $stream = fopen('php://temp', 'w'); + + $html5 = $this->getInstance(); + + $r = new OutputRules($stream, $this->html5->getOptions()); + $dom = $this->html5->loadHTML($this->markup); + + $t = new Traverser($dom, $stream, $r, $html5->getOptions()); + + $this->assertInstanceOf('\Masterminds\HTML5\Serializer\Traverser', $t); + } + + public function testFragmentDeprecated() + { + $html = '<span class="bar">foo</span><span></span><div>bar</div>'; + $input = new \Masterminds\HTML5\Parser\StringInputStream($html); + $dom = $this->html5->parseFragment($input); + + $this->assertInstanceOf('\DOMDocumentFragment', $dom); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); + + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } + + public function testFragment() + { + $html = '<span class="bar">foo</span><span></span><div>bar</div>'; + $dom = $this->html5->parseFragment($html); + + $this->assertInstanceOf('\DOMDocumentFragment', $dom); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); + + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } + + public function testProcessorInstructionDeprecated() + { + $html = '<?foo bar ?>'; + $input = new \Masterminds\HTML5\Parser\StringInputStream($html); + $dom = $this->html5->parseFragment($input); + + $this->assertInstanceOf('\DOMDocumentFragment', $dom); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); + + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } + + public function testProcessorInstruction() + { + $html = '<?foo bar ?>'; + $dom = $this->html5->parseFragment($html); + + $this->assertInstanceOf('\DOMDocumentFragment', $dom); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); + + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/HTML5/TestCase.php b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/TestCase.php new file mode 100644 index 000000000..a25ae215c --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/HTML5/TestCase.php @@ -0,0 +1,23 @@ +<?php + +namespace Masterminds\HTML5\Tests; + +use Masterminds\HTML5; +use PHPUnit\Framework\TestCase as BaseTestCase; + +class TestCase extends BaseTestCase +{ + const DOC_OPEN = '<!DOCTYPE html><html><head><title>test</title></head><body>'; + + const DOC_CLOSE = '</body></html>'; + + public function getInstance(array $options = array()) + { + return new HTML5($options); + } + + protected function wrap($fragment) + { + return self::DOC_OPEN . $fragment . self::DOC_CLOSE; + } +} diff --git a/plugins/af_readability/vendor/masterminds/html5/test/benchmark/example.html b/plugins/af_readability/vendor/masterminds/html5/test/benchmark/example.html new file mode 100644 index 000000000..3e1bed030 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/benchmark/example.html @@ -0,0 +1,6403 @@ + +<!DOCTYPE html> +<!--[if (gt IE 9)|!(IE)]> <!--> <html lang="en" class="no-js edition-domestic app-homepage" itemscope xmlns:og="http://opengraphprotocol.org/schema/"> <!--<![endif]--> +<!--[if IE 9]> <html lang="en" class="no-js ie9 lt-ie10 edition-domestic app-homepage" xmlns:og="http://opengraphprotocol.org/schema/"> <![endif]--> +<!--[if IE 8]> <html lang="en" class="no-js ie8 lt-ie10 lt-ie9 edition-domestic app-homepage" xmlns:og="http://opengraphprotocol.org/schema/"> <![endif]--> +<!--[if (lt IE 8)]> <html lang="en" class="no-js lt-ie10 lt-ie9 lt-ie8 edition-domestic app-homepage" xmlns:og="http://opengraphprotocol.org/schema/"> <![endif]--> +<head> + <title>The New York Times - Breaking News, World News & Multimedia</title> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> + <link rel="shortcut icon" href="https://static01.nyt.com/favicon.ico" /> + <link rel="apple-touch-icon-precomposed" sizes="144×144" href="https://static01.nyt.com/images/icons/ios-ipad-144x144.png" /> + <link rel="apple-touch-icon-precomposed" sizes="114×114" href="https://static01.nyt.com/images/icons/ios-iphone-114x144.png" /> + <link rel="apple-touch-icon-precomposed" href="https://static01.nyt.com/images/icons/ios-default-homescreen-57x57.png" /> + <meta name="sourceApp" content="nyt-v5" /> + <meta id="applicationName" name="applicationName" content="homepage" /> + <meta id="foundation-build-id" name="foundation-build-id" content="" /> + <link rel="canonical" href="https://www.nytimes.com" /> + <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml" /> + <link rel="alternate" media="only screen and (max-width: 640px)" href="http://mobile.nytimes.com" /> + <link rel="alternate" media="handheld" href="http://mobile.nytimes.com" /> + <meta name="robots" content="noarchive,noodp,noydir" /> + <meta name="description" content="The New York Times: Find breaking news, multimedia, reviews & opinion on Washington, business, sports, movies, travel, books, jobs, education, real estate, cars & more at nytimes.com." /> + <meta name="CG" content="Homepage" /> + <meta name="SCG" content="" /> + <meta name="PT" content="Homepage" /> + <meta name="PST" content="" /> + <meta name="application-name" content="The New York Times" /> + <meta name="msapplication-starturl" content="https://www.nytimes.com" /> + <meta name="msapplication-task" content="name=Search;action-uri=http://query.nytimes.com/search/sitesearch?src=iepin;icon-uri=https://static01.nyt.com/images/icons/search.ico" /> + <meta name="msapplication-task" content="name=Most Popular;action-uri=http://www.nytimes.com/gst/mostpopular.html?src=iepin;icon-uri=https://static01.nyt.com/images/icons/mostpopular.ico" /> + <meta name="msapplication-task" content="name=Video;action-uri=http://video.nytimes.com/?src=iepin;icon-uri=https://static01.nyt.com/images/icons/video.ico" /> + <meta name="msapplication-task" content="name=Homepage;action-uri=https://www.nytimes.com?src=iepin&adxnnl=1;icon-uri=https://static01.nyt.com/images/icons/homepage.ico" /> + <meta property="og:url" content="https://www.nytimes.com" /> + <meta property="og:type" content="website" /> + <meta property="og:title" content="Breaking News, World News & Multimedia" /> + <meta property="og:description" content="The New York Times: Find breaking news, multimedia, reviews & opinion on Washington, business, sports, movies, travel, books, jobs, education, real estate, cars & more at nytimes.com." /> + <meta property="og:image" content="https://static01.nyt.com/images/icons/t_logo_291_black.png" /> + <meta property="fb:app_id" content="9869919170" /> + <meta name="apple-itunes-app" content="app-id=357066198, affiliate-data=at=10lIEQ&ct=Web%20iPad%20Smart%20App%20Banner&pt=13036" /> + <meta name="keywords" content="Hurricane Harvey (2017),Federal Emergency Management Agency,Beaumont (Tex),Houston (Tex),Hurricane Harvey (2017),Hurricanes and Tropical Storms,Weather,Houston (Tex),Beaumont (Tex),Harris County (Tex),Hurricane Harvey (2017),Texas,Floods,Hurricanes and Tropical Storms,Houston (Tex),Hurricane Harvey (2017),Floods,Deaths (Fatalities),Beaumont (Tex),Hurricane Harvey (2017),Deaths (Fatalities),Louisiana,Texas,Hurricane Harvey (2017),National Hurricane Center,Houston (Tex),Hurricane Harvey (2017),Area Planning and Renewal,Houston (Tex),Floods,New Orleans (La),Hurricane Harvey (2017),Corporate Taxes,Tax Credits, Deductions and Exemptions,Philanthropy,Houston (Tex),Hurricane Harvey (2017),Federal Aid (US),Federal Emergency Management Agency,Small Business Administration,Real Estate and Housing (Residential),Floods,Hurricane Harvey (2017),Humanitarian Aid,Frauds and Swindling,Hurricane Harvey (2017),Floods,Texas,Beaumont (Tex),port arthur texas,Floods,Hurricane Harvey (2017),Houston (Tex),Rain,Refineries,Hurricane Harvey (2017),Hurricanes and Tropical Storms,Evacuations and Evacuees,Texas,United States Politics and Government,Taxation,United States Economy,Springfield (Mo),Trump, Donald J,Tax Shelters,United States Economy,Corporate Taxes,Trump, Donald J,Republican Party,United States Politics and Government,Immigration Detention,Law and Legislation,Illegal Immigration,Trump, Donald J,Patient Protection and Affordable Care Act (2010),Health Insurance and Managed Care,State Children's Health Insurance Program (S-CHIP),United States International Relations,Extortion and Blackmail,Trump, Donald J,North Korea,Cohen, Michael D (1966- ),Russian Interference in 2016 US Elections and Ties to Trump Associates,House Committee on Intelligence,Trump, Donald J,Putin, Vladimir V,United States International Relations,Terrorism,United States Politics and Government,Afghanistan War (2001- ),United States Defense and Military Forces,Haqqani Network,Taliban,Trump, Donald J,Tillerson, Rex W,Pakistan,India,Leukemia,Immune System,Genetic Engineering,Cancer,Children's Hospital of Philadelphia,Food and Drug Administration,Novartis AG,University of Pennsylvania,June, Carl H,Whitehead, Emma,vis-multimedia,Accidents and Safety,Buildings (Structures),Mumbai (India),Tennis,United States Open (Tennis),Sharapova, Maria,Think Tanks,Google Inc,Alphabet Inc,New America Foundation,Schmidt, Eric E,Slaughter, Anne-Marie,Lynn, Barry,Open Markets,Computers and the Internet,Brazil,Amazon Jungle,Mines and Mining,Forests and Forestry,Indigenous People,Temer, Michel (1940- ),Zeid Ra'ad Zeid Al Hussein,Trump, Donald J,United Nations,News and News Media,Freedom of the Press,Newspapers,United States Politics and Government,Charlottesville, Va, Violence (August, 2017),United States Politics and Government,Afghanistan War (2001- ),United States Defense and Military Forces,Defense Department,Afghanistan,Exercise,Cooking and Cookbooks,Seasonal Affective Disorder (SAD),Sleep,Airlines and Airplanes,Comedy and Humor,Travel and Vacations,Monuments and Memorials (Structures),Politics and Government,de Blasio, Bill,Columbus, Christopher,New York City,David Tang,Deaths (Obituaries),Fashion and Apparel,Shanghai Tang,Entrepreneurship,London (England),Hong Kong,National Aeronautics and Space Administration,Space and Astronomy,Solar System,Exploration and Explorers,The Big Bang Theory (TV Program),Young Sheldon (TV Program),Television,Lorre, Chuck,Parsons, Jim,Social Media,Family Courts,Ethics and Official Misconduct,Administration for Children's Services (NYC),Legal Aid Society,Hansell, David,vis-multimedia,Australia,Same-Sex Marriage, Civil Unions and Domestic Partnerships,Political Advertising,Whales and Whaling,International Court of Justice (UN),Sea Shepherd Conservation Society,Antarctic Regions,Japan,Southern Ocean,Mathematics,Archaeology and Anthropology,Babylon (Iraq),Mansfield, Daniel F,Wildberger, Norman J,Historia Mathematica (Journal),Olympic Games,Olympic Games (1972),International Olympic Committee,Munich (Germany),Glasgow (Scotland),Great Britain,Travel and Vacations,Writing and Writers,Books and Literature,Ward, Jesmyn" /> + <meta name="video:playerId" content="2640832222001" /> + <meta name="video:publisherId" content="1749339200" /> + <meta name="video:publisherReadToken" content="cE97ArV7TzqBzkmeRVVhJ8O6GWME2iG_bRvjBTlNb4o." /> + <meta name="dfp-ad-unit-path" content="homepage/us" /> + <meta name="dfp-amazon-enabled" content="false" /> + <meta name="adxPage" content="homepage.nytimes.com/index.html" /> + + <link id="legacy-zam5nzz" rel="stylesheet" type="text/css" href="https://typeface.nyt.com/css/zam5nzz.css" media="all" /> + <!--[if (gt IE 9)|!(IE)]> <!--> + <link rel="stylesheet" type="text/css" media="screen" href="https://a1.nyt.com/assets/homepage/20170810-135137/css/homepage/styles.css" /> + <!--<![endif]--> + <!--[if lte IE 9]> + <link rel="stylesheet" type="text/css" media="screen" href="https://a1.nyt.com/assets/homepage/20170810-135137/css/homepage/styles-ie.css" /> + <![endif]--> + <!-- begin abra --> + <script> + var NYTD=NYTD||{};NYTD.Abra=function(t){"use strict";function n(t){var n=i[t];return n&&n[1]||null}function e(t,n){if(t){var e,o,r=n[0],i=n[1],u=0,c=0;if(1!==i.length||4294967296!==i[0])for(e=a(t+" "+r)>>>0,u=0,c=0;o=i[u++];)if(e<(c+=o[0]))return o}}function o(n,e,o,a){s+="subject="+n+"&test="+encodeURIComponent(e)+"&variant="+encodeURIComponent(o||0)+"&url="+encodeURIComponent(t.location.href)+"&instant=1&skipAugment=true\n",a&&f.push(a),c||(c=t.setTimeout(r,0))}function r(){var n=new t.XMLHttpRequest,e=f;n.withCredentials=!0,n.open("POST",u),n.onreadystatechange=function(){var t,o;if(4==n.readyState)for(t=200==n.status?null:new Error(n.statusText);o=e.shift();)o(t)},n.send(s),s="",f=[],c=null}function a(t){for(var n,e,o,r,a,i,u,c=0,s=0,f=[],l=[n=1732584193,e=4023233417,~n,~e,3285377520],h=[],p=t.length;s<=p;)h[s>>2]|=(s<p?t.charCodeAt(s):128)<<8*(3-s++%4);for(h[u=p+8>>2|15]=p<<3;c<=u;c+=16){for(n=l,s=0;s<80;n=[0|[(i=((t=n[0])<<5|t>>>27)+n[4]+(f[s]=s<16?~~h[c+s]:i<<1|i>>>31)+1518500249)+((e=n[1])&(o=n[2])|~e&(r=n[3])),a=i+(e^o^r)+341275144,i+(e&o|e&r|o&r)+882459459,a+1535694389][0|s++/20],t,e<<30|e>>>2,o,r])i=f[s-3]^f[s-8]^f[s-14]^f[s-16];for(s=5;s;)l[--s]=l[s]+n[s]|0}return l[0]}var i,u,c,s="",f=[];return n.init=function(n,r){var a,c,s,f,l,h=[],p=(t.document.cookie.match(/(^|;) *nyt-a=([^;]*)/)||[])[2],d=(t.document.cookie.match(/(^|;) *ab7=([^;]*)/)||[])[2],m=new RegExp("[?&]abra(=([^&#]*))"),g=m.exec(t.location.search);if(g&&g[2]&&(d=d?g[2]+"&"+d:g[2]),i)throw new Error("can't init twice");if(u=r,i={},d)for(d=decodeURIComponent(d).split("&"),a=0;a<d.length;a++)l=d[a].split("="),l[0]in i||(i[l[0]]=[,l[1],1],o("ab-alloc",l[0],l[1]),l[1]&&h.push(l[0]+"="+l[1]));for(a=0;a<n.length;a++)s=n[a],(c=s[0])in i||(f=e(p,s)||[],i[c]=f,f[1]&&h.push(c.replace(/[^\w-]/g)+"="+(""+f[1]).replace(/[^\w-]/g)),f[2]&&o("ab-alloc",c,f[1]));h.length&&t.document.documentElement.setAttribute("data-nyt-ab",h.join(" "))},n.reportExposure=function(n,e){var r=i[n];r&&r[2]?o("ab-expose",n,r[1],e):e&&t.setTimeout(function(){e(null)},0)},n}(this); + </script> + <script>NYTD.Abra.init([["HOME_ComingUp",[[2147483648,"control",1],[2147483648,"comingup",1]]],["HOME_NewsEvent2",[[3865470567,"full",1],[429496729,"control",1]]],["HOME_ElectionPrediction",[[3865470567,"on",1],[429496729,"control",1]]],["HOME_geoTrending",[[1460288881,"Control",1],[1417339208,"Header",1],[1417339207,"NoHeader",1]]],["www-ad-diagnostic",[[21474837,"1",0],[4273492459,null,0]]],["www-signup-favor-test",[[773094114,"0",1],[773094113,"1",1],[773094113,"2",1],[773094114,"3",1],[773094113,"4",1],[429496729,"5",1],[0,null,0]]],["www-readlater-test-1",[[1073741824,"control",1],[360777253,"controlHoldout",1],[1073741824,"variant1",1],[356482286,"variant1Holdout",1],[1073741824,"variant2",1],[356482285,"variant2Holdout",1]]],["www-signup-favor-test-v3",[[1288490189,"1",1],[1288490189,"2",1],[429496730,"4",1],[1288490188,"5",1]]],["www-signup-favor-test-v4",[[214748365,"control",1],[858993459,"1",1],[858993460,"2",1],[644245094,"4",1],[858993459,"5",1],[858993459,"6",1]]],["www-fabrik-off",[[4294967296,"1",1]]],["Liftoff",[[19520627,"0",1],[19520626,"1",1],[19520627,"2",1],[19520626,"3",1],[19520626,"4",1],[19520627,"5",1],[14839112,"0",1],[14839112,"1",1],[14839112,"2",1],[14839112,"3",1],[14839112,"4",1],[14839112,"5",1],[34359738,"8",1],[34359738,"9",1],[34359739,"12",1],[34359738,"13",1],[34359739,"16",1],[34359738,"17",1],[3882650435,null,0]]],["HP_AATest",[[2147483648,"0",1],[2147483648,"1",1]]],["EC_SampleTest",[[2147483648,"variantA",0],[2147483648,"variantB",0]]],["EC_DigiAbandonmentTest",[[4294967296,"sendAbandonmentEmail",1]]],["EC_HdAbandonmentTest",[[4294967296,"sendAbandonmentEmail",1]]],["EC_CrosswordsUpsellTest",[[2147483648,"control",1],[2147483648,"upsell",1]]],["EC_NewSubOnboardingTest",[[2147483648,"control",1],[2147483648,"sov1",1]]],["PaywallAU",[[429496730,"0",1],[3865470566,"1",1]]]], '//et.nytimes.com/')</script> + <!-- end abra --> + + <script> + (function () { + var e; + if (/^mobile\./.test(window.location.hostname)) { + var vi2 = (document.cookie.match(/(?:^|;) *vi=([^;]*)/) || [])[1] || '', + vi1 = (document.cookie.match(/(?:^|;) *nyt\.np\.vi=([^;]*)/) || [])[1] || ''; + e = /^b1/.test(vi2) ? 'WP_ProjectVi&variant=vi' + : /^z1/.test(vi2) ? 'WP_ProjectVi&variant=0' + : /^a2/.test(vi2) ? 'WP_ProjectVi2&variant=hp-st' + : /^b2/.test(vi2) ? 'WP_ProjectVi2&variant=hp' + : /^c2/.test(vi2) ? 'WP_ProjectVi2&variant=st' + : /^z2/.test(vi2) ? 'WP_ProjectVi2&variant=0' + : /^1\|/.test(vi1) ? 'WP_ProjectVi&variant=vi' + : /^2\|/.test(vi1) ? 'WP_ProjectVi&variant=0' + : ''; + } else if (/^www\./.test(window.location.hostname)) { + var vi = (document.cookie.match(/(?:^|;) *vi_www_hp=([^;]*)/) || [])[1] || ''; + e = /^a2/.test(vi) ? 'WP_ProjectVi_www_hp&variant=hp-st' + : /^b2/.test(vi) ? 'WP_ProjectVi_www_hp&variant=hp' + : /^c2/.test(vi) ? 'WP_ProjectVi_www_hp&variant=st' + : /^z2/.test(vi) ? 'WP_ProjectVi_www_hp&variant=0' + : ''; + } + if (e) { + var x = new XMLHttpRequest(); + x.withCredentials = true; + x.open('POST','//et.nytimes.com/'); + x.send('subject=ab-alloc&test=' + e + '&url=' + encodeURIComponent(window.location.href) + '&instant=1&skipAugment=true\n'); + } + })(); + </script> + <script type="text/javascript"> + document.addEventListener('DOMContentLoaded', function () { + if (!window.NYTD) { + window.NYTD = {}; + } + window.NYTD.Global = { + displayBriefings: function (time) { + var timedBriefings = document.getElementsByClassName('timedBriefing'); + if (!timedBriefings.length) { + return; + } + var attrClass, attrStart, attrEnd, startTime, endTime; + var reFormat = /^\d{2}:\d{2}$/; + var reHide = / timedBriefingHide/i; + + for (var i = 0; i < timedBriefings.length; i++) { + attrClass = timedBriefings[i].getAttribute('class'); + attrStart = timedBriefings[i].getAttribute('data-start-time'); + attrEnd = timedBriefings[i].getAttribute('data-end-time'); + if (attrStart && attrEnd && reFormat.test(attrStart) && reFormat.test(attrEnd)) { + startTime = Number.parseInt(attrStart.replace(':', ''), 10); + endTime = Number.parseInt(attrEnd.replace(':', ''), 10); + + // need to account for when the time span is across midnight + if (startTime > endTime) { + if (((time >= startTime) || (time < endTime)) && reHide.test(attrClass)) { + timedBriefings[i].setAttribute('class', attrClass.replace(reHide, '')); + } + if (((time < startTime) && (time >= endTime)) && !reHide.test(attrClass)) { + timedBriefings[i].setAttribute('class', (attrClass + ' timedBriefingHide')); + } + } else { + if ((time >= startTime) && (time < endTime) && reHide.test(attrClass)) { + timedBriefings[i].setAttribute('class', attrClass.replace(reHide, '')); + } + if (((time < startTime) || (time >= endTime)) && !reHide.test(attrClass)) { + timedBriefings[i].setAttribute('class', (attrClass + ' timedBriefingHide')); + } + } + } + } + }, + testTZ: function (offset) { + var testTime = new Date(new Date().getTime() + (offset * 3600 * 1000)); + window.NYTD.Global.displayBriefings((testTime.getUTCHours() * 100) + testTime.getUTCMinutes()); + return testTime.toUTCString().replace(' GMT', ''); + } + }; + var now = new Date(); + var previewTime = (now.getHours() * 100) + now.getMinutes(); + var rePreviewTime = /previewTime=(\d*)/; + var matches = window.location.search.match(rePreviewTime); + if (matches) { + previewTime = Number.parseInt(matches[1]); + } + window.NYTD.Global.displayBriefings(previewTime); + }); + </script> + <script type="text/javascript">var googletag=googletag||{};googletag.cmd=googletag.cmd||[],function(){var t=document.createElement("script");t.async=!0,t.type="text/javascript";var e="https:"==document.location.protocol;t.src=(e?"https:":"http:")+"//www.googletagservices.com/tag/js/gpt.js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(t,o)}();</script> + <script src="https://cdn.optimizely.com/public/3013110282/s/home_prod.js"></script> + + <!--esi +<script id="user-info-data" type="application/json"> +<esi:include src="/svc/web-products/userinfo-v3.json" /> +</script> +--> + <script id="magnum-feature-flags" type="application/json">["limitFabrikSave","moreFollowSuggestions","unfollowComments","allTheEmphases","videoVHSCover","videoVHSHomepageCover","videoVHSHomepageNewControls","videoVHSNewControls","videoVHSEmbeddedOnly","additionalOpinionRegions","hpViewability","freeTrial","hpPrototype","useCollectionApiForWell","enableFlexFrameAds","weatherLocation","fabrikWebsocketsOnly","NYTExperiment","hpRealEstateAd","jitterbug","updatedVideoPromoSmall","videoEmbed360","PersonalizationApiUpdate","globalBriefings","removeInternationalEdition","clientSideABRA","abraOverrideVersion","signupFavor","mapleFreeTrial","piiBlockDFP","anchorsHttps","smarterLivingRec","viDesktopTest","caslOpt"]</script> + <script id="mpulse"> + (function(){ + if (window.BOOMR && window.BOOMR.version) { return; } + var dom,doc,where,iframe = document.createElement("iframe"),win = window; + + function boomerangSaveLoadTime(e) { + win.BOOMR_onload=(e && e.timeStamp) || new Date().getTime(); + } + if (win.addEventListener) { + win.addEventListener("load", boomerangSaveLoadTime, false); + } else if (win.attachEvent) { + win.attachEvent("onload", boomerangSaveLoadTime); + } + + iframe.src = "javascript:void(0)"; + iframe.title = ""; iframe.role = "presentation"; + (iframe.frameElement || iframe).style.cssText = "width:0;height:0;border:0;display:none;"; + where = document.getElementsByTagName("script")[0]; + where.parentNode.insertBefore(iframe, where); + + try { + doc = iframe.contentWindow.document; + } catch(e) { + dom = document.domain; + iframe.src="javascript:var d=document.open();d.domain='"+dom+"';void(0);"; + doc = iframe.contentWindow.document; + } + doc.open()._l = function() { + var js = this.createElement("script"); + if (dom) { this.domain = dom; } + js.id = "boomr-if-as"; + js.src = "//c.go-mpulse.net/boomerang/" + + "ATH8A-MAMN8-XPXCH-N5KAX-8D239"; + BOOMR_lstart=new Date().getTime(); + this.body.appendChild(js); + }; + doc.write('<body onload="document._l();">'); + doc.close(); + })(); + </script> + <script> + var require = { + baseUrl: 'https://a1.nyt.com/assets/', + waitSeconds: 20, + paths: { + 'foundation': 'homepage/20170810-135137/js/foundation', + 'shared': 'homepage/20170810-135137/js/shared', + 'homepage': 'homepage/20170810-135137/js/homepage', + 'application': 'homepage/20170810-135137/js/homepage/', + 'videoFactory': 'https://static01.nyt.com/js2/build/video/2.0/videofactoryrequire', + 'videoPlaylist': 'https://static01.nyt.com/js2/build/video/players/extended/2.0/appRequire', + 'auth/mtr': 'https://static01.nyt.com/js/mtr', + 'auth/growl': 'https://static01.nyt.com/js/auth/growl/default', + 'vhs': 'https://static01.nyt.com/video/vhs/build/vhs-2.x.min', + 'vhs3': 'https://static01.nyt.com/video-static/vhs3/vhs.min' + } + }; + </script> + <!--[if (gte IE 9)|!(IE)]> <!--> + <script data-main="foundation/main" src="https://a1.nyt.com/assets/homepage/20170810-135137/js/foundation/lib/framework.js"></script> + <!--<![endif]--> + <!--[if lt IE 9]> + <script> + require.map = { '*': { 'foundation/main': 'foundation/legacy_main' } }; + </script> + <script data-main="foundation/legacy_main" src="https://a1.nyt.com/assets/homepage/20170810-135137/js/foundation/lib/framework.js"></script> + <![endif]--> +</head> +<body> + +<style> + .lt-ie10 .messenger.suggestions { + display: block !important; + height: 50px; + } + + .lt-ie10 .messenger.suggestions .message-bed { + background-color: #f8e9d2; + border-bottom: 1px solid #ccc; + } + + .lt-ie10 .messenger.suggestions .message-container { + padding: 11px 18px 11px 30px; + } + + .lt-ie10 .messenger.suggestions .action-link { + font-family: "nyt-franklin", arial, helvetica, sans-serif; + font-size: 10px; + font-weight: bold; + color: #a81817; + text-transform: uppercase; + } + + .lt-ie10 .messenger.suggestions .alert-icon { + background: url('https://static01.nyt.com/images/icons/icon-alert-12x12-a81817.png') no-repeat; + width: 12px; + height: 12px; + display: inline-block; + margin-top: -2px; + float: none; + } + + .lt-ie10 .masthead, + .lt-ie10 .navigation, + .lt-ie10 .comments-panel { + margin-top: 50px !important; + } + + .lt-ie10 .ribbon { + margin-top: 97px !important; + } +</style> +<div id="suggestions" class="suggestions messenger nocontent robots-nocontent" style="display:none;"> + <div class="message-bed"> + <div class="message-container last-message-container"> + <div class="message"> + <span class="message-content"> + <i class="icon alert-icon"></i><span class="message-title">NYTimes.com no longer supports Internet Explorer 9 or earlier. Please upgrade your browser.</span> + <a href="http://www.nytimes.com/content/help/site/ie9-support.html" class="action-link">LEARN MORE »</a> + </span> + </div> + </div> + </div> +</div> + +<div id="shell" class="shell"> + <header id="masthead" class="masthead theme-pinned-masthead" role="banner"> + + <div id="announcements-container" class="announcements-container"></div> + + <div id="Header1" class="ad header1-ad"></div> + + <div class="masthead-cap-container"> + + <div id="masthead-cap" class="masthead-cap"> + + <div class="quick-navigation button-group"> + + <button class="button sections-button enable-a11y"> + <i class="icon sprite-icon"></i><span class="button-text">Sections</span> + </button> + <button class="button search-button"> + <i class="icon sprite-icon"></i><span class="button-text">Search</span> + </button> + <a class="button skip-button skip-to-content visually-hidden focusable" href="#top-news">Skip to content</a> + <a class="button skip-button skip-to-navigation visually-hidden focusable" href="#site-index-navigation">Skip to navigation</a> + </div><!-- close quick-navigation --> + + <div class="user-tools"> + + <div id="Bar1" class="ad bar1-ad"></div> + + <div class="user-tools-button-group button-group"> + <button class="button subscribe-button hidden" data-href="https://www.nytimes.com/subscriptions/Multiproduct/lp3004.html?campaignId=4XUYF">Subscribe Now</button> + <button class="button login-button hidden">Log In</button> + <button class="button notifications-button hidden"><i class="icon sprite-icon"></i><span class="button-text">0</span></button> + <button class="button user-settings-button"> + <i class="icon sprite-icon"></i><span class="button-text">Settings</span> + </button> + </div> + + </div><!-- close user-tools --> + + </div><!-- close masthead-cap --> + + </div><!-- close masthead-cap-container --> + + <div class="masthead-meta"> + <div class="editions tab"> + + <ul class="editions-menu"> + <li class="edition-domestic-toggle active">English</li> + <li class="edition-chinese-toggle"><a href="http://cn.nytimes.com" target="_blank" data-edition="chinese">中文 (Chinese)</a></li> + <li class="edition-spanish-toggle"><a href="https://www.nytimes.com/es/" data-edition="spanish">Español</a></li> + </ul> + + </div><!-- close editions --> + + <div id="TopLeft" class="ad top-left-ad"></div> + <div id="TopRight" class="ad top-right-ad"></div> + + <h2 class="branding"><a href="https://www.nytimes.com/"> + <svg class="nyt-logo" width="379" height="64" role="img" aria-label="The New York Times"> + <image width="379" height="64" xlink:href="https://a1.nyt.com/assets/homepage/20170810-135137/images/foundation/logos/nyt-logo-379x64.svg" src="https://a1.nyt.com/assets/homepage/20170810-135137/images/foundation/logos/nyt-logo-379x64.png" alt="The New York Times" border="0"/> + </svg> + + </a></h2> + <ul class="masthead-menu"> + <li class="date">Thursday, August 31, 2017</li><li class="todays-paper"><a href="http://www.nytimes.com/pages/todayspaper/index.html" data-collection="todays-paper"><i class="icon sprite-icon"></i>Today’s Paper</a></li><li class="video"><a href="https://www.nytimes.com/video" data-collection="video"><i class="icon sprite-icon"></i>Video</a></li><li id="weather" class="weather hidden" data-collection="weather"><button class="button weather-button"></button></li><li id="markets" class="markets hidden" data-collection="markets"></li> + </ul> + + </div><!-- close masthead-meta --> + + <nav id="mini-navigation" class="mini-navigation"> + <h2 class="visually-hidden">Quick Site Sections Navigation</h2> + <ul class="mini-navigation-menu"> + <li> + <button class="button sections-button"> + <i class="icon sprite-icon"></i> + <span class="button-text">Sections</span> + </button> + </li><li> + <button class="button search-button"> + <i class="icon sprite-icon"></i> + <span class="button-text">Search</span> + </button> + </li> + + <li class="shortcuts-9A43D8FC-F4CF-44D9-9B34-138D30468F8F "> + <a href="https://www.nytimes.com/pages/world/index.html">World</a> + </li> + + + <li class="shortcuts-23FD6C8B-62D5-4CEA-A331-6C2A9A1223BE "> + <a href="https://www.nytimes.com/pages/national/index.html">U.S.</a> + </li> + + + <li class="shortcuts-80E6DEE6-87E4-4AD0-9152-14FA6B07E5AB "> + <a href="https://www.nytimes.com/pages/politics/index.html">Politics</a> + </li> + + + <li class="shortcuts-C4DC8C0C-E148-4201-BF10-82F1C903DBFB "> + <a href="https://www.nytimes.com/pages/nyregion/index.html">N.Y.</a> + </li> + + + <li class="shortcuts-104D1E63-9701-497B-8CF4-A4D120C9014E domestic"> + <a href="https://www.nytimes.com/pages/business/index.html">Business</a> + </li> + + + <li class="shortcuts-A257D89A-0D3C-40AF-9C34-1A25A7947D94 international"> + <a href="https://www.nytimes.com/pages/business/international/index.html">Business</a> + </li> + + + <li class="shortcuts-AD8090D7-4137-4D71-84C8-70DA3BD89778 domestic"> + <a href="https://www.nytimes.com/pages/opinion/index.html">Opinion</a> + </li> + + + <li class="shortcuts-09736473-CB3F-4B2F-9772-3AF128ABE12D international"> + <a href="https://www.nytimes.com/pages/opinion/international/index.html">Opinion</a> + </li> + + + <li class="shortcuts-78FBAD45-31A9-4EC7-B172-7D62A2B9955E "> + <a href="https://www.nytimes.com/pages/technology/index.html">Tech</a> + </li> + + + <li class="shortcuts-A4B35924-DB6C-4EA3-997D-450810F4FEE6 "> + <a href="https://www.nytimes.com/section/science">Science</a> + </li> + + + <li class="shortcuts-7D6BE1AF-8CD8-430B-8B2A-17CD0EAA99AC "> + <a href="https://www.nytimes.com/pages/health/index.html">Health</a> + </li> + + + <li class="shortcuts-DE2B278B-2783-4506-AAD5-C15A5BB6DA1A domestic"> + <a href="https://www.nytimes.com/pages/sports/index.html">Sports</a> + </li> + + + <li class="shortcuts-BE66F420-C51B-461D-B487-CACF62E94AAE international"> + <a href="https://www.nytimes.com/pages/sports/international/index.html">Sports</a> + </li> + + + <li class="shortcuts-C5BFA7D5-359C-427B-90E6-6B7245A6CDD8 domestic"> + <a href="https://www.nytimes.com/pages/arts/index.html">Arts</a> + </li> + + + <li class="shortcuts-0202D0E4-C59B-479A-BD42-6F1766459781 international"> + <a href="https://www.nytimes.com/pages/arts/international/index.html">Arts</a> + </li> + + + <li class="shortcuts-B3DFBD82-F298-43B3-9458-219B4F6AA2A5 domestic"> + <a href="https://www.nytimes.com/pages/fashion/index.html">Style</a> + </li> + + + <li class="shortcuts-CC9E2674-F6C4-4A39-813B-F5AB0C515CEA international"> + <a href="https://www.nytimes.com/pages/style/international/index.html">Style</a> + </li> + + + <li class="shortcuts-D9C94A2B-0364-4D25-8383-592CC66F82D4 domestic"> + <a href="https://www.nytimes.com/pages/dining/index.html">Food</a> + </li> + + + <li class="shortcuts-FDEFB811-B483-4C3D-A25A-FD07BE5EAD96 international"> + <a href="https://www.nytimes.com/pages/dining/international/index.html">Food</a> + </li> + + + <li class="shortcuts-FDA10AC4-4738-4099-91E8-15584765C8D7 "> + <a href="https://www.nytimes.com/section/travel">Travel</a> + </li> + + + <li class="shortcuts-E57A148E-0CB9-4C02-966D-28B119710151 "> + <a href="https://www.nytimes.com/pages/magazine/index.html">Magazine</a> + </li> + + + <li class="shortcuts-052C33AD-1404-4DB6-AA70-0901DB1AD95B "> + <a href="https://www.nytimes.com/section/t-magazine">T Magazine</a> + </li> + + + <li class="shortcuts-92720057-BCB6-4BDB-9351-12F29393259F "> + <a href="https://www.nytimes.com/section/realestate">Real Estate</a> + </li> + + <li><button class="button all-sections-button">all</button></li> + </ul> + </nav> + <div class="search-flyout-panel flyout-panel"> + <button class="button close-button" type="button"><i class="icon"></i><span class="visually-hidden">Close search</span></button> + <nav class="search-form-control form-control layout-horizontal"> + <h2 class="visually-hidden">Site Search Navigation</h2> + <form class="search-form" role="search"> + <div class="control"> + <div class="label-container visually-hidden"> + <label for="search-input">Search NYTimes.com</label> + </div> + <div class="field-container"> + <input id="search-input" name="search-input" type="text" class="search-input text" autocomplete="off" placeholder="Search NYTimes.com" /> + + <button type="button" class="button clear-button" tabindex="-1" aria-describedby="clear-search-input"><i class="icon"></i><span id="clear-search-input" class="visually-hidden">Clear this text input</span></button> + <div class="auto-suggest" style="display: none;"> + <ol></ol> + </div> + <button class="button submit-button" type="submit">Go</button> + </div> + </div><!-- close control --> + </form> + </nav> + + + </div><!-- close flyout-panel --> + <div id="notification-modals" class="notification-modals"></div> + + </header><!-- close masthead --> + <div id="masthead-placeholder" class="masthead-placeholder"></div> + <nav id="navigation" class="navigation"> + <h2 class="visually-hidden">Site Navigation</h2> + </nav><!-- close navigation --> + + <nav id="mobile-navigation" class="mobile-navigation hidden"> + <h2 class="visually-hidden">Site Mobile Navigation</h2> + </nav><!-- close mobile-navigation --> + + <div id="navigation-edge" class="navigation-edge"></div> + <div id="page" class="page"> + <main id="main" class="main" role="main"> + <div id="Top" class="ad hp-top-ad nocontent nojitter robots-nocontent"></div> + <div id="Top_Close" class="ad hp-top-ad-close hidden nocontent robots-nocontent"></div> + <div id="Top5" class="ad top5-ad hidden nocontent robots-nocontent"></div> + + <div class="span-abc-region region"> + <div class="collection"> + <script type="text/javascript"> + /*! geoip_resolver 2016-06-30 */ + +function(a){"function"==typeof define&&define.amd?define("nytint-geoip",[],a):window.nytint_geoip=a()}(function(){"use strict";var a="nyt-geoip",b=document.getElementsByTagName("html"),c=!1,d=["continent_code","country_code","region","dma_code","postal_code","time_zone","zone_abbr"],e=function(b){var c=new XMLHttpRequest,d=null,e=null;try{if(d=JSON.parse(sessionStorage.getItem(a)),d&&void 0!==d.country_code)return g(d,b),d}catch(h){}c.onload=function(a){return a.target?(e=f(a.target),"undefined"==typeof e?!1:(g(e,b),e)):!1},c.onreadystatechange=function(){4===c.readyState&&200!==c.status&&console.error(c.status)},c.open("GET","https://geoip.newsdev.nytimes.com/",!0);try{c.responseType="json"}catch(h){}c.send()},f=function(a){var b=null;switch(!0){case"json"===a.responseType:b=a.response.data;break;case null!==a.response:b=JSON.parse(a.response).data;break;case null!==a.responseText:b=JSON.parse(a.responseText).message}return void 0!==b?b:null},g=function(e,f){if(!b)return!1;try{sessionStorage.setItem(a,JSON.stringify(e))}catch(g){}if(void 0!==e&&!c){for(var i,j=0;i=d[j];j++)if(void 0!==e[i]){var k=["geo",h(i),e[i]].join("-");b[0].classList.add(k)}c=!0}return"function"==typeof f&&f(e),e},h=function(a){var b=a;switch(!0){case a.indexOf("zone_abbr")>=0:b=a.replace("zone_abbr","us-timezone");break;case a.indexOf("_zone")>=0:b=a.replace("_zone","zone");break;case a.indexOf("_code")>=0:b=a.replace("_code","")}return b};return window.NYTINT_TESTING||e(),e}); + (function() { require(['nytint-geoip']); })(); + </script><!-- HP CSS Fixes --> + <style> + + /* Fix for Small Video Promo Heds */ + .story.theme-feature.video-promo-small.updated-video-promo-small .video-promo-small-container .story-heading{ padding: 0!important; } + + + /* Fix MM icons in kickers */ + .kicker .icon:before { top: 0px; } + .kicker .media.slideshow { margin-bottom: 0px; } + + /* Hiding Hacks */ + + .nythpHideKickers .kicker, .nythpHideBylines .byline, .nythpHideTimestamps .timestamp { + display: none; + } + + /* banner hed modifications */ + .span-ab-top-region .story.theme-summary .story-heading { + line-height: 2.1rem; + } + + /* spacing fixes */ + .collection.headlines { + margin-bottom: 12px; + } + + + /* Alterations to the Centered Feature Photo Spot Treatment */ + + .b-column .photo-spot-region .story.theme-feature .story-heading { + font-size: 1.35rem; + line-height: 1.65rem; + } + + .b-column .photo-spot-region .story.theme-feature .story-heading { + padding: 0 22px; /* for headline wrapping */ + } + .b-column .photo-spot-region .story.theme-feature .summary { + line-height: 18px; + } + + .story.theme-feature .summary { + line-height: 1.125rem; + color: #333; + margin: 0 10px 3px; + } + + + + + /* Bullet Treatments */ + + .ab-column .collection article ul, .span-abc-region .collection article ul { + margin-top: 8px; + margin-bottom: -3px; + } + + .ab-column .collection article ul.refer, .span-abc-region .collection article ul.refer { + margin-top: 2px; + margin-bottom: 0px; + } + + .ab-column .collection article ul li, .span-abc-region .collection article ul li { + position: relative; + margin-bottom: 8px; + padding-left: 9px; + font-size: 13px; + font-size: 0.8125rem; + line-height: 18px; + line-height: 1.125rem; + font-weight: 400; + } + .ab-column .collection article ul li:before, .span-abc-region .collection article ul li:before { + border-radius: 1px; + background-color: #000; + width: 3px; + height: 3px; + content: ''; + position: absolute; + display: block; + top: 7px; + left: 2px; + } + + .ab-column .collection article ul li:last-child, .span-abc-region .collection article ul li:last-child { + margin-bottom: 0=; + } + + .ab-column .collection article[data-collection-renderstyle="HpSumMediumMedia"] ul { + margin-bottom: 0px; + } + + .theme-news-headlines li { + position: relative!important; + margin-bottom: 4px!important; + padding-left: 8px!important; + } + .theme-news-headlines { + margin-top: 2px!important; + } + + .a-column .story.theme-summary.headline-medium-summary .medium-thumb { + float: none; + clear: none; + margin-left: 0px; + } + + .first-column-region .story.theme-summary.headline-medium-summary .story-heading, .a-lede-package-region .story.theme-summary.headline-medium-summary .story-heading { + font-style: italic; + } + + .first-column-region .collection:first-child .story.theme-summary.headline-medium-summary .story-heading, .a-lede-package-region .collection:first-child .story.theme-summary.headline-medium-summary .story-heading { + font-size: 26px; + font-size: 1.625rem; + line-height: 28px; + line-height: 1.75rem; + font-weight: 700; + } + + + /* Breaking News/Developing Headers */ + .nythpBreaking { + color: #A81817; + border-top: 3px solid #A81817; + padding-top: 2px; + padding-bottom: 3px; + margin-top: 12px; + } + + .nythpBreaking h6 { + text-transform: uppercase; + font-family: "nyt-franklin",arial,helvetica,sans-serif; + font-weight: 700; + } + + .nythpDeveloping { + color: #FD8249; + border-top-color: #FD8249; + } + + .nythpBreaking.nythpNoRule { + border: none; + margin-top: 0px; + } + + .above-banner-region .nythpBreaking { + margin-bottom: 10px; + } + + + /* BEGIN .HPHEADER STYLING */ + + .hpHeader, .span-abc-region h3.collection-kicker { + margin-bottom: 10px; + } + + .hpHeader h6, .span-abc-region h3.collection-kicker { + color: #000; + font-family: "nyt-franklin",helvetica,arial,sans-serif; + text-transform: uppercase; + font-size: 12px; + font-weight: 700; + letter-spacing: .5px; + border-bottom: 2px solid #ccc; + display: inline-block; + line-height: 15px; + } + + .span-abc-region h6, .span-abc-region h3.collection-kicker { + font-size: 13px; + line-height: 16px; + + } + + .hpHeader h6 a, .span-abc-region h3.collection-kicker a, + .hpHeader h6 a:visited, .span-abc-region h3.collection-kicker a:visited { + text-decoration: none; + color: #000; + } + + .hpHeader h6:hover, + .hpHeader h6:active { + border-color: #222222; + } + + .above-banner-region .hpHeader, .span-ab-top-region .hpHeader, .span-ab-lede-package-region .hpHeader, .b-column .hpHeader, .c-column .hpHeader { + text-align: center; + } + + .above-banner-region .hpHeader h6, .span-ab-top-region .hpHeader h6, .span-ab-lede-package-region .hpHeader h6, .b-column .hpHeader h6, .c-column .hpHeader h6 { + margin: 0 auto; + padding: 0 2px; + } + + .span-ab-top-region .a-column .hpHeader, .span-ab-lede-package-region .a-column .hpHeader, .b-column .split-layout .hpHeader, .b-column .nythpSplitCode .hpHeader { + text-align: left; + } + + .b-column .split-layout .hpHeader h6, .b-column .nythpSplitCode .hpHeader h6 { + margin: 0; + padding: 0; + } + + .hpLive h6, .hpLive h6:hover, .hpLive h6:active { + color: #a81817; + border-color: #a81817; + } + + .hpDeveloping h6, .hpDeveloping h6:hover, .hpDeveloping h6:active { + color: #fd8249; + border-color: #fd8249; + } + + .hpSingleRule { + border-top: 1px solid #e2e2e2; + padding-top: 12px; + } + + + + /* added by matte to fix slideshow bug */ + + .loader-container { + display: none; + } + + /* Newsletter Sign-Up Modules (updated 6/28/2017) */ + + div.notification-widget { + min-height:38px; + } + .notification-signup .notifications-title { + color: black; + font-family: "nyt-cheltenham-sh",georgia,"times new roman",times,serif; + font-size: 15px; + line-height: 18px; + font-weight: 200; + } + .notification-signup .notification-text { + margin-top: 3px; + margin-bottom: 5px; + color: #999; + font-size: 13px; + line-height: 18px; + } + + .notification-widget input, + .notification-widget button { + outline: none; + } + + .notification-widget .notify-email { + height: 30px; + width: 312px; + margin-top: 0px; + padding: 14px; + color: #a6a6a6; + border: 1px solid rgba(97,136,166,.5); + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; + box-shadow: none; + font-family: 'nyt-franklin', Helvetica, sans-serif; + font-size: 14px; + line-height: 1; + } + .notification-widget .notify-email:hover{ + border-color:rgba(97,136,166,1); + border-width:2px; + padding:13px; + } + .notification-widget .notify-email.error { + border-color: #FF9859; + } + .notification-widget .button { + margin-top: 0px; + padding: 8px; + border: none; + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; + background: #6288a5; + color: white; + font-family: 'nyt-franklin', Helvetica, sans-serif; + font-size: 14px; + font-weight: 500; + line-height: 1; + text-transform: capitalize; + } + + .notification-widget .dirtyform .button:hover, + .notification-widget .signedin .button:hover { + background-color: #326891; + } + + .notification-widget .signedin .button { + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; + } + + .notification-widget div.error { + font-family: 'nyt-franklin', Helvetica, sans-serif; + color: #FF9859; + font-size: 12px; + margin-top: 5px; + } + + /* post subscribe notification */ + .notification-signup span { + font-size: 14px; + color: ##ffffff; + font-family: 'nyt-franklin', Helvetica, sans-serif; + font-weight: 600; + } + .notification-widget div[data-status="initial"]{ + display:inline-block; + float:right; + } + + .notification-widget div[data-status="working"]{ + opacity:0; + } + + /* already subscribed notification */ + .notification-widget div[data-status="initial"] div, + .notification-widget div[data-status="subscribed"] div, + .notification-widget div[data-status="working"] div { + font-family: 'nyt-franklin', Helvetica, sans-serif; + font-size: 14px; + color: #666 !important; + } + .notification-widget div[data-status="initial"] div{ + line-height: 31px; + } + .notification-widget div[data-status="initial"] div div{ + margin-right:8px; + display:inline-block; + } + + .notification-widget div[data-status="initial"] div .account-name, + .notification-widget div[data-status="subscribed"] div .account-name{ + font-weight: 700; + } + .notification-signup a { + font-size: 14px; + font-family: 'nyt-franklin', Helvetica, sans-serif; + font-weight: 400; + margin-top: 10px; + display: block; + color: #6187a6!important; + } + .notification-widget .email-address a{ + margin-top: 5px; + display: block; + color: #6187a6!important; + } + .viewport-medium-10 .interactive-leadin, .viewport-medium-10 .notification-signup .notification-text{ + max-width: 375px; + } + .notification-signup{ + padding-top:11px; + } + + a[data-reactid=".0.0.2"] { + font-size: 11px; } + + .notification-widget div[data-status="initial"][data-show-disclaimer="true"] div.disclaimer { + display: none; + color: #CCC !important; + font-size: 14px; + } + + .notification-widget div.signedin[data-status="initial"][data-show-disclaimer="true"] div.disclaimer { + top: -20px; + right: 14px; + position: relative; + height: 8px; + display: block; + } + + .notification-widget div.not-signedin[data-status="initial"][data-show-disclaimer="true"] div.disclaimer { + display: block; + text-align: right; + } + + + .notification-widget div[data-status="initial"][data-show-disclaimer="true"] div.disclaimer a { + color: #CCC !important; + text-decoration: underline; + } + + .notification-widget div[data-status="initial"][data-show-disclaimer="true"] div.welcome { + position: relative; + top: -5px; + color: #999 !important; + } + + + /* Show All hack */ + html.showAllGeoAb .timedBriefingHide, html.showAllGeoAb .nythpElectionPredictionCCol, html.showAllGeoAb .nythpNYRegionPromo, html.showAllGeoAb .nythpGeoCanada, html.showAllGeoAb .nythpCAToday { display: block !important } + + + </style> + + + + + <!-- Begin Smarter Living Styles and Scripts --> + + <script type="text/javascript"> + require(['foundation/main'], function () { + require([ + 'jquery/nyt', + 'foundation/helpers/utils', + 'foundation/views/page-manager' + ], function ($, utils, pageManager) { + $(document).ready(function () { + var param = { + 'contentCollection': 'smarter-living' + }; + $('.nythpSmarterLiving a').each(function () { + var href = $(this).attr('href'); + href = utils.appendQueryParams(href, param); + $(this).attr('href', href); + }); + }); + }); + }); + </script> + <style> + + .nythpSmarterLiving { + zoom:1; + border-bottom: 0px solid #e2e2e2; + margin-bottom: 12px; + } + + .nythpSmarterLiving:after, + .nythpSmarterLiving:before { + content: ""; + display: table; + } + .nythpSmarterLiving:after{ + clear: both; + } + .nythpSmarterLiving article { + float:left; + width: 177px; + } + .nythpSmarterLiving article.story.theme-summary { + margin-bottom: 0px; + } + + .nythpSmarterLiving article:last-child, + .nythpSmarterLiving article:nth-of-type(2) { + margin-left: 21px; + } + + .nythpSmarterLiving .byline, .nythpSmarterLiving .summary, .nythpSmarterLiving article .kicker, .nythpSmarterLiving .theme-comments, .nythpSmarterLiving .refer { + display: none; + } + + .nythpSmarterLiving .story.theme-summary .story-heading { + width: 96px; + float: right; + } + + .nythpSmarterLiving .story.theme-summary .thumb { + margin: 3px 6px 6px 0px; + float: left; + clear: none; + } + + + </style></div> + <div class="collection"> + <style type="text/css"> + .span-abc-region .story.theme-summary h1.story-heading { + font-size: 38px; + font-style: italic; + line-height: 44px; + margin-bottom: 10px; + margin-top:-8px; + font-family: "nyt-cheltenham",georgia,"times new roman",times,serif; + } + + .span-abc-region .nythpParisMega1stCol article[data-collection-renderstyle="LedeSum"].story.theme-summary h2.story-heading { + font-size: 1.625rem; + line-height: 1.75rem; + font-weight: 700; + font-style: italic; + font-family: "nyt-cheltenham",georgia,"times new roman",times,serif; + letter-spacing: 0.01em; + word-spacing: -0.1em; + } + + .span-abc-region .nythpParisMega1stCol .story.theme-summary h2.story-heading { + font-size: 20px; + font-size: 1.25rem; + line-height: 22px; + line-height: 1.375rem; + font-weight: 700; + font-style: normal; + font-family: "nyt-cheltenham",georgia,"times new roman",times,serif; + letter-spacing: 0.01em; + word-spacing: -0.1em; + } + + .span-abc-region .nythpSpanABCMiddleColumn .nytHPSplit-AB-Half .story.theme-summary h2.story-heading { + font-size: 16px; + font-size: 1rem; + line-height: 22px; + line-height: 1.375rem; + font-weight: 700; + font-style: normal; + font-family: "nyt-cheltenham",georgia,"times new roman",times,serif; + letter-spacing: 0.01em; + word-spacing: -0.1em; + } + + + .span-abc-region .nythpSpanABCMiddleColumn .nytHPSplit-AB-Half .story.theme-summary .thumb { + margin-top:-20px; + } + + + + + </style><!--FOR ALL CAPS--> + <style> + .span-ab-top-region .story.theme-summary h1.story-heading{ + line-height:45px; + margin-top:2px; + } + </style> + + <div class="span-ab-top-region"><article class="story theme-summary banner" data-collection-renderstyle="Banner"><h1 class="story-heading"> + + <!-- Link and Hed Go Here --> + <a href="https://www.nytimes.com/2017/08/30/us/small-towns-harvey.html">The Storm Marches On as Houston Surveys Wreckage + </a> + + + + + <span class="product-label theme-nyt-now" style="display:none;"><span class="visually-hidden">NYT Now</span><i class="icon dot-logo-icon"></i></span></h1></article></div></div> + <div class="collection"> + <style> + .nythpSplitCode .column { margin-left: 21px; } + .nythpSplitCode .column:first-child { margin-left: 0px; } + .nythpSplitCode.layout { background: none; } + .nythpSplitCode .media.photo.medium-thumb { float: none; margin-left: 0; } + .nythpSpanABCMiddleColumn {width: 573px; float: right;} + .nythpSplitCode .nythpSpanABC_ABCol {width: 771px; float: left;} + .nythpSplitCode .nythpSpanABC_SpanABBottom {clear: both;} + <!--.nythpParisMegaBanner {} --> + </style> + + <div class="layout nythpSplitCode nythpParisMega"> + <div class="nythpSpanABC_ABCol"> + <div class="column nythpParisMega1stCol"><div> + + </div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005401006" data-story-id="100000005401006" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/small-towns-harvey.html">Hundreds of Towns in Harvey’s Path Hit by Devastating Rain</a></h2> + + <p class="byline">By CAMPBELL ROBERTSON, RICK ROJAS and SHAILA DEWAN </p> + + <p class="summary"><ul> <li>Harvey, downgraded to a tropical depression, moved to the east and punished a region of roughly 11 million people. + </li> + <li>In Houston, after the first night of a citywide curfew, many residents went outside for the first time in days to survey the wreckage. Officials have reported at least 38 deaths. + </li> + </ul></p> + + + </article> + </div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005399284" data-story-id="100000005399284" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h3 class="kicker"><span class="timestamp"><strong>Live</strong></span> </h3> + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/hurricane-harvey-flooding-houston.html">Explosions Reported at Chemical Plant</a></h2> + + <p class="byline">By THE NEW YORK TIMES <time class="timestamp" datetime="2017-08-31" data-eastern-timestamp="6:47 AM" data-utc-timestamp="1504176457">6:47 AM ET</time></p> + + <p class="summary">Two explosions were reported at a chemical plant about 30 miles from Houston that was damaged by Hurricane Harvey.</p> + + <p class="theme-comments"> + <a href="https://www.nytimes.com/2017/08/30/us/hurricane-harvey-flooding-houston.html?hp&target=comments#commentsContainer" class="comments-link"><i class="icon sprite-icon comments-icon"></i><span class="comment-count"> Comments</span></a> + </p> + + </article> + </div> + <div class="collection"> + <style> + .first-column-region .nythpMakeAColHedLikeB .story.theme-summary .story-heading, + .a-lede-package-region .nythpMakeAColHedLikeB .story.theme-summary .story-heading, + .span-abc-region .nythpParisMega1stCol .nythpMakeAColHedLikeB .story.theme-summary h2.story-heading { + font-size: 14px; + font-size: 0.875rem; + line-height: 16px; + line-height: 1rem; + font-weight: 700; + font-style: normal; + font-family: "nyt-cheltenham-sh",georgia,"times new roman",times,serif; + margin-bottom: 2px; + } + </style> + + <div class="nythpMakeAColHedLikeB"><article class="story theme-summary" id="topnews-100000005395157" data-story-id="100000005395157" data-rank="1" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/28/us/hurricane-harvey-texas.html">A Guide to the Storm</a></h2> + + + <p class="summary">Here’s an overview of coverage by The New York Times.</p> + + + </article> + </div></div> + <div class="collection"> + </div></div> + <div class="column nythpSpanABCMiddleColumn"><div></div> + <div class="collection"> + <!-- + +====================================================== + +THIS IS A GENERATED TEMPLATE FILE. DO NOT EDIT. + +====================================================== + +--> + <!-- hp promo --> + + <!-- this file is generated from src/style.less --> + <style>/* + SHOW LIBRARY + ===================== */ + .g-show-xsmall, + .g-show-small, + .g-show-smallplus, + .g-show-submedium, + .g-show-sub-medium, + .g-show-medium, + .g-show-large, + .g-show-xlarge { + display: none; + } + .g-show { + display: block; + } + .lt-ie10 .g-aiImg { + width: 100%; + } + /* story top */ + .story.theme-main .story-header .story-meta .story-heading { + max-width: 720px; + margin: 0 auto 10px; + text-align: center; + line-height: 2.844rem; + font-size: 2.4rem; + } + @media only screen and (max-width: 1244px) { + .story.theme-main .story-header .story-meta .story-heading { + line-height: 2.5596rem; + font-size: 2.16rem; + } + } + @media only screen and (max-width: 719px) { + .story.theme-main .story-header .story-meta .story-heading { + line-height: 2.2752rem; + font-size: 1.92rem; + } + } + .story.theme-main .story-header .story-meta .interactive-leadin.summary { + max-width: 460px; + margin: 0 auto 20px auto; + text-align: center; + font-size: 17px; + line-height: 1.6; + } + .story.theme-main .story-header .story-meta .byline-dateline { + text-align: center; + } + /* top asset */ + .g-top-asset { + margin-left: auto; + margin-right: auto; + margin-bottom: 20px; + } + .g-top-asset img { + width: 100%; + } + /* body text */ + .g-body { + max-width: 460px; + margin-left: auto; + margin-right: auto; + } + .viewport-medium .g-body { + font-size: 17px; + line-height: 1.6; + } + .g-body a { + text-decoration: underline; + } + /* subhed */ + .g-subhed h2 { + max-width: 460px; + margin: 2em auto 1em auto; + font: 700 1.2em/1.3em 'nyt-franklin', arial, sans-serif; + text-align: center; + } + .viewport-small-10 .g-subhed h2 { + font-size: 1.5em; + } + /* refer text box */ + .g-refer { + max-width: 460px; + margin: 0 auto 25px; + padding: 12px 15px; + box-sizing: border-box; + background: #fffcd9; + } + .g-refer .g-body { + font-family: 'nyt-franklin', arial, sans-serif; + font-size: 16px; + line-height: 1.3; + margin-bottom: 0; + } + .g-refer a { + text-decoration: underline; + } + /* images */ + .g-item-image { + margin: 25px auto; + } + .g-item-image img { + width: 100%; + } + /* video */ + .g-item-video { + margin: 25px auto; + } + /* sources and credits */ + .g-asset-source { + padding-top: 3px; + } + .g-asset-source .g-source { + font: 400 12px/15px 'nyt-franklin', arial, sans-serif; + color: #999; + } + .g-asset-source .g-pipe { + margin: 0 6px 0 3px; + font: 400 12px/12px 'nyt-franklin', arial, sans-serif; + color: #999; + } + .g-asset-source .g-caption { + font: 300 14px/17px georgia, 'times new roman', times, serif; + } + .g-asset-source .g-credit { + font: 400 12px/17px 'nyt-franklin', arial, sans-serif; + display: inline-block; + color: #999; + } + /* graphics */ + .g-item-ai2html { + margin: 25px auto; + } + p.g-asset-hed { + font: 700 16px/18px 'nyt-franklin', arial, sans-serif; + margin-bottom: 0; + } + .g-map-key { + float: none; + clear: both; + overflow: hidden; + margin: 10px auto 4px auto; + } + .g-map-key .g-key-row { + margin-bottom: 5px; + margin-right: 15px; + float: left; + } + .viewport-small .g-map-key .g-key-row { + width: auto; + margin-bottom: 0; + } + .viewport-small-20 .g-map-key .g-key-row { + width: auto; + } + .g-map-key .g-key-row .g-key-rect, + .g-map-key .g-key-row .g-key-circle { + vertical-align: middle; + margin-right: 8px; + display: inline-block; + } + .g-map-key .g-key-row p { + font: 500 0.9em/1.6 'nyt-franklin', arial, sans-serif; + display: inline-block; + vertical-align: middle; + margin: -2px 0 0 0; + } + .viewport-small .g-map-key .g-key-row p { + max-width: 92%; + } + .viewport-small-20 .g-map-key .g-key-row p { + width: auto; + max-width: none; + } + .g-map-key .g-key-row .g-key-rect { + width: 22px; + height: 10px; + } + .g-map-key .g-key-row .g-key-circle { + width: 9px; + height: 9px; + border-radius: 50%; + } + .g-map-key .g-key-row .g-key-custom { + width: 20px; + height: 20px; + background-size: 100%; + display: block; + display: inline-block; + width: 24px; + height: 24px; + margin: -4px 2px 0 0; + } + .viewport-small .g-map-key .g-key-row-title p { + width: 100%; + max-width: none; + } + .g-red-dot, + .g-black-dot { + display: inline-block; + background: #d00; + color: white; + font-weight: bold; + width: 20px; + height: 20px; + font: 700 14px/1.4 'nyt-franklin', arial, sans-serif; + text-align: center; + border-radius: 10px; + line-height: 20px; + } + .g-black-dot { + background: #222; + } + /* column text */ + .g-column-container { + max-width: 460px; + margin: 20px auto 0 auto; + } + .viewport-medium .g-column-container { + max-width: 1050px; + } + .viewport-large .g-column-container { + margin-bottom: 30px; + } + .g-column-container .g-column-hed { + font-family: 'nyt-franklin', arial, sans-serif; + font-weight: 700; + margin-bottom: 2px; + } + .g-column-container .g-column-col { + vertical-align: top; + } + .viewport-small .g-column-container .g-column-col { + display: block; + min-width: 100%; + } + .viewport-medium .g-column-container .g-column-col { + min-width: 0; + display: inline-block; + margin-right: 15px; + } + .viewport-medium .g-column-container .g-column-col:last-child { + margin-right: 0; + } + .g-column-container .g-column-asset, + .g-column-container .g-column-image { + margin-bottom: 8px; + } + .g-column-container .g-column-image img { + width: 100%; + } + /* tables */ + .g-table { + margin: 0 auto; + margin-bottom: 25px; + } + .g-table tr { + border-bottom: 1px solid #ececec; + } + .g-table p { + font: 500 14px/1.4 'nyt-franklin', arial, sans-serif; + text-align: left; + margin: 6px 0; + } + /* charts */ + .g-chart { + margin: 0 auto; + margin-bottom: 25px; + font: 500 14px/1.4 'nyt-franklin', arial, sans-serif; + } + .g-chart .g-chart-header { + font-weight: bold; + } + .g-chart .g-chart-row, + .g-chart .g-chart-header { + clear: both; + height: 22px; + margin-bottom: 9px; + } + .g-chart .g-chart-bar-container, + .g-chart .g-chart-label { + float: left; + height: 100%; + } + .g-chart .g-chart-bar-container { + margin-left: 20px; + } + .g-chart .g-chart-bar-pos, + .g-chart .g-chart-bar-neg { + height: 100%; + float: left; + } + .g-chart .g-chart-label, + .g-chart .g-chart-bar { + padding-top: 3px; + } + .g-chart .g-chart-label.not-first { + margin-left: 20px; + } + .g-chart .g-chart-bar { + height: 100%; + background: lightsteelblue; + position: relative; + } + .g-chart .g-chart-bar-label { + padding-left: 6px; + } + .g-chart .g-chart-bar-neg .g-chart-bar { + float: right; + } + .g-chart .g-chart-bar-neg .g-chart-bar-label { + text-align: right; + padding-right: 6px; + padding-left: 0px; + } + .g-chart .out-label { + padding-top: 3px; + display: none; + } + .g-chart .outside .out-label { + display: block; + } + .g-chart .outside .in-label { + display: none; + } + .g-chart .g-bold { + font-weight: bold; + } + /* grid */ + .g-grid { + margin-bottom: 15px; + } + .g-grid .g-grid-item { + position: relative; + display: inline-block; + min-width: calc(50% - 5px); + } + .viewport-small-20 .g-grid .g-grid-item { + min-width: calc(33% - 5px); + } + .viewport-medium .g-grid .g-grid-item { + min-width: 0; + } + .g-grid .g-grid-item p { + font: 500 15px/1.4 'nyt-franklin', arial, sans-serif; + position: absolute; + bottom: 10px; + left: 10px; + color: #fff; + margin-bottom: 0; + } + /* lazy images */ + .g-freebird-lazy { + display: block; + width: 100%; + height: auto; + } + .g-freebird-lazy.ll-init { + transition: opacity 0.3s ease-out; + opacity: 0; + } + .g-freebird-lazy.ll-loaded { + opacity: 1; + } + /* Mobile issues */ + /* Get rid of border under intro and share tools on mobile */ + .story-header.interactive-header { + border-bottom: none !important; + } + /* Share tools issues */ + /* Pad out the kicker/sharetool space */ + .story.theme-main .story-header .story-meta .kicker-container { + margin-bottom: 12px; + } + /* Override the moving sharetools on mobile */ + .story.theme-main .story-header .story-meta .kicker-container .sharetools { + position: relative; + float: right; + /*right: 0px;*/ + bottom: auto; + left: auto; + width: auto; + margin-top: -6px; + clear: none; + } + /* Maintain the proper space with the section name and kicker next to share tools */ + .story.theme-main .story-header .story-meta .interactive-kicker { + float: left; + width: 70%; + display: inline-block; + } + .g-graphic.g-graphic-freebird .g-ad-wrapper { + margin: 30px auto; + max-width: 1050px; + } + .viewport-medium .g-graphic.g-graphic-freebird .g-ad-wrapper { + margin: 50px auto; + } + .g-graphic.g-graphic-freebird .g-ad-wrapper .ad { + border-top: 1px solid #e2e2e2 !important; + border-bottom: 1px solid #e2e2e2 !important; + margin: 0 auto; + padding: 10px 0; + overflow: hidden; + max-width: 100%; + } + .g-graphic.g-graphic-freebird .g-ad-wrapper .ad div { + margin: 0 auto; + display: block !important; + } + .g-graphic.g-graphic-freebird .g-ad-wrapper iframe { + margin: 0 auto; + display: block; + } + .g-graphic.g-graphic-freebird .g-ad-wrapper .g-ad-text { + text-align: center; + font: 500 12px/1.2 "nyt-franklin", arial, sans-serif; + color: #bfbfbf; + text-transform: uppercase; + margin-bottom: 7px; + } + .ad.top-ad { + border: none; + margin-left: auto; + margin-right: auto; + } + /* Center headlines for standalone and embedded interactives */ + /* @import (inline) "nyt5/centered-headline.css"; */ + /* Fullbleed interactive-graphic container */ + /* remove left offset */ + .viewport-medium-50 .masthead.masthead-theme-standard, + .viewport-large-20 .masthead.masthead-theme-standard { + margin-left: 0; + } + + .viewport-large-70 .masthead.masthead-theme-standard { + margin-left: auto; + } + + .viewport-medium-50 .masthead.masthead-theme-standard .quick-navigation, + .viewport-large-20 .masthead.masthead-theme-standard .quick-navigation { + left: 15px; + } + + #navigation-edge { + display: none; + } + + /* fullbleed #main */ + #main { + padding-left: 0; + padding-right: 0; + } + + .viewport-medium-10 #main { + width: 100%; + max-width: 100%; + } + + /* constrain template containers */ + .ad.top-ad { + margin-left: 0; + margin-right: 0; + } + + .story-header.interactive-header, + .story.theme-main .story-footer, + .related-coverage { + margin-left: 10px; + margin-right: 10px; + } + + .viewport-medium-10 .ad.top-ad, + .viewport-medium-10 .story-header.interactive-header, + .viewport-medium-10 .story.theme-main .story-footer, + .viewport-medium-10 .related-coverage { + max-width: 720px; + margin-left: auto; + margin-right: auto; + } + + .viewport-medium-30 .ad.top-ad, + .viewport-medium-30 .story-header.interactive-header, + .viewport-medium-30 .story.theme-main .story-footer, + .viewport-medium-30 .related-coverage { + max-width: 945px; + } + + .viewport-large-30 .ad.top-ad, + .viewport-large-30 .story-header.interactive-header, + .viewport-large-30 .story.theme-main .story-footer, + .viewport-large-30 .related-coverage { + max-width: 1050px; + } + + .g-body, .g-map-key, .g-asset-source, .g-table-container, .g-column-container, .g-asset-hed { + padding-left: 10px; + padding-right: 10px; + } + + .viewport-large .g-body, + .viewport-large .g-map-key, + .viewport-large .g-asset-source, + .viewport-large .g-table-container, + .viewport-large .g-column-container, + .viewport-large .g-asset-hed { + padding-left: 0; + padding-right: 0; + } + + /* For use with LaziestLoader */ + /* @import (inline) "nyt5/laziestloader.css"; */ + /* Fix spacing at top of story */ + .has-top-ad .story.theme-interactive, + .has-ribbon .story.theme-interactive { + margin-top: 10px; + } + + /* Fix comments button margin */ + .story.theme-interactive .comments-button.theme-kicker { + margin-top: 0; + } + + /* Get rid of border under intro and share tools on mobile */ + .page-interactive-default .story.theme-main .story-header { + border-bottom: none; + } + + /* Pad out the kicker/sharetool space */ + .story.theme-interactive .story-meta .kicker { + margin-bottom: 22px; + } + + .viewport-medium-10 .story.theme-interactive .story-meta .kicker { + margin-bottom: 24px; + } + + /* Override the moving sharetools on mobile */ + .story.theme-interactive .story-header .story-meta .kicker-container .sharetools { + position: relative; + left: auto; + bottom: auto; + width: auto; + margin-top: -6px; + float: right; + clear: none; + } + + /* Maintain the proper space with the section name and kicker next to share tools */ + .story.theme-interactive .story-header .story-meta .interactive-kicker { + float: left; + width: 65%; + display: inline-block; + } + + /* Gets rid of the extra space under the intro that puts too much space there in mobile and desktop */ + .page-interactive-default .story.theme-main .story-header { + margin-bottom: 0; + } + + .page-interactive-default .story.theme-main .story-header .story-meta { + margin-bottom: 10px; + } + + /*Fixes styling on share tools at bottom of minimal interactives*/ + .story.theme-minimal .sharetools.layout-horizontal{ + width:auto; + margin-top:11px; + } + .story.theme-minimal .sharetools.layout-horizontal .sharetool { + display: inline-block; + border-top: 0; + } + .story.theme-minimal .sharetools.layout-horizontal .sharetool:first-child a { + margin-left: 0; + padding-left: 0; + border-left: none; + } + .story.theme-minimal .sharetools.layout-horizontal .sharetool a { + padding-left: 15px; + padding-right: 5px; + height: 20px; + border-left: 1px solid #e2e2e2; + } + .story.theme-minimal .sharetools.layout-horizontal .sharetool a:hover { + background-color: transparent; + } + + /* uncomment to fix related content and footer layout on max_width: 720 pages */ + /* +.related-coverage { + max-width: 720px; +} + +.viewport-medium-30 .page-footer nav ul, +.viewport-medium-50 .page-footer nav ul { + margin-left: 28px; +} + +.viewport-medium-30 .page-footer nav.last-nav { + float: none; +} + +.viewport-medium-30 .page-footer nav.last-nav ul { + margin-left: 239px; +} +*/ + + .g-subhed h2 { + font: 300 24px/1.2 'nyt-franklin', Arial, sans-serif; + margin-bottom: 0.65em; + } + .viewport-small-10 .g-subhed h2 { + font-size: 28px; + } + .g-animation { + margin: 0 -15px; + max-width: calc(130%); + } + @media (min-width: 780px) { + .g-animation { + margin: 0; + } + } + .g-locator { + max-width: 300px; + margin: 100px auto 30px auto; + } + .g-locator .g-locator-in { + display: inline-block; + width: 120px; + vertical-align: middle; + z-index: -1; + position: relative; + overflow: hidden; + } + .viewport-medium .g-locator .g-locator-in { + margin: 0 -10px 0 -20px; + } + .g-locator .g-subhed { + display: inline-block; + width: calc(100% - 130px); + vertical-align: middle; + z-index: 100; + position: relative; + } + .g-request p.g-body { + padding: 8px 16px; + border-radius: 3px; + box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.15); + border: 1px solid #e4e4e4; + font: 300 16px/1.4 'nyt-franklin', Arial, sans-serif; + } + div.tooltip { + top: -1000px; + position: fixed; + padding: 5px; + background: rgba(255, 255, 255, 0.95); + border: 1px solid lightgray; + pointer-events: none; + width: 300px; + font: 300 14px / 1.2 'nyt-franklin', Arial, sans-serif; + } + .tooltip-hidden { + opacity: 0; + transition: all .3s; + transition-delay: .1s; + } + @media (max-width: 590px) { + div.tooltip { + bottom: -1px; + width: calc(100%); + left: -1px !important; + right: -1px !important; + top: auto !important; + width: auto !important; + } + } + #g-harvey_basemap-box { + position: relative; + } + #g-houston-rescue-map-box { + position: absolute; + top: 0px; + font: 300 15px / 1.2 'nyt-franklin'; + } + #g-houston-rescue-map-box .g-key { + width: 200px; + text-align: center; + position: absolute; + bottom: 50px; + right: 4px; + font-size: 20px; + font-weight: 600; + } + #g-houston-rescue-map-box .g-key p { + font: 300 15px / 1.2 'nyt-franklin'; + display: inline-block; + margin-bottom: 0px; + } + #g-houston-rescue-map-box .g-key .g-key-circle { + width: 9px; + height: 9px; + display: inline-block; + margin-right: 8px; + position: relative; + top: -2px; + border-radius: 100%; + } + .description { + margin-left: 10px; + font-size: 15px; + line-height: 15px; + max-width: 150px; + padding: 8px 12px; + color: #000; + border-radius: 3px; + background: #ffffff; + box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.33); + } + .description:after { + content: ''; + position: absolute; + left: 0; + top: 50%; + width: 0; + height: 0; + border: 5px solid transparent; + border-right-color: #ffffff; + border-left: 0; + margin-top: -5px; + margin-left: -5px; + } + .description.lefty:after { + position: absolute; + left: auto; + right: 0; + top: 50%; + width: 0; + height: 0; + border: 5px solid transparent; + border-left-color: #ffffff; + box-shadow: none; + border-right: 0; + margin-top: -5px; + margin-right: -5px; + } + .hpgraphic { + width: 573px; + position: relative; + z-index: 3; + min-height: 322px; + background: #eee; + } + .hpgraphic .g-item-ai2html { + margin: 0; + } + .hpgraphic .description { + font-size: 13px; + border-radius: 2px; + padding: 2px 5px; + } + .g-timer { + opacity: 0; + } + .g-text strong, + .g-text b { + font-family: 'nyt-franklin', arial, sans-serif; + } + </style> + + <a href="https://www.nytimes.com/interactive/2017/08/30/us/houston-flood-rescue-cries-for-help.html"> + <div class="g-graphic hpgraphic g-graphic-freebird" data-preview-slug="2017-08-30-houston-rescues"> + + <div class="g-item-ai2html" style="max-width:573px;"> + + + + + + <!-- SCOOP CSS --> + <!-- Generated by ai2html v0.65.5 - 2017-08-31 01:22 --> + <!-- ai file: harvey_hp.ai --> + <!-- preview: 2017-08-30-houston-rescues --> + <!-- scoop: houston-rescues-animation-573 --> + <style type='text/css' media='screen,print'> + #g-harvey_hp-Artboard_2-box { + max-width:600px; + } + #g-harvey_hp-Artboard_2-box .g-artboard { + margin:0 auto; + } + #g-harvey_hp-Artboard_2-box .g-artboard p { + margin:0; + } + .g-aiAbs { + position:absolute; + } + .g-aiImg { + display:block; + width:100% !important; + } + .g-aiPointText p { white-space: nowrap; } + #g-harvey_hp-Artboard_2 { + position:relative; + overflow:hidden; + width:573px; + } + #g-harvey_hp-Artboard_2 p { + font-family:nyt-franklin,arial,helvetica,sans-serif; + font-weight:500; + font-size:13px; + line-height:17px; + filter:alpha(opacity=100); + -ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100); + opacity:1; + letter-spacing:0.2em; + text-align:left; + color:rgb(156,156,156); + text-transform:none; + padding-bottom:0; + padding-top:0; + mix-blend-mode:normal; + font-style:normal; + } + #g-harvey_hp-Artboard_2 .g-pstyle0 { + font-weight:700; + font-size:21px; + line-height:23px; + filter:alpha(opacity=70); + -ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=70); + opacity:0.7; + letter-spacing:0em; + color:rgb(0,0,0); + } + #g-harvey_hp-Artboard_2 .g-pstyle1 { + text-align:center; + } + #g-harvey_hp-Artboard_2 .g-pstyle2 { + font-weight:300; + font-style:italic; + filter:alpha(opacity=40); + -ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=40); + opacity:0.4; + mix-blend-mode:multiply; + letter-spacing:0.3em; + text-align:center; + color:rgb(5,96,147); + } + #g-harvey_hp-Artboard_2 .g-pstyle3 { + font-weight:300; + font-size:15px; + line-height:23px; + letter-spacing:0em; + color:rgb(0,0,0); + } + #g-harvey_hp-Artboard_2 .g-pstyle4 { + font-weight:300; + font-size:12px; + line-height:23px; + filter:alpha(opacity=60); + -ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=60); + opacity:0.6; + letter-spacing:0em; + color:rgb(0,0,0); + } + + </style> + + <!-- SCOOP HTML --> + <!-- Generated by ai2html v0.65.5 - 2017-08-31 01:22 --> + <!-- ai file: harvey_hp.ai --> + <!-- preview: 2017-08-30-houston-rescues --> + <!-- scoop: houston-rescues-animation-573 --> + <div id="g-harvey_hp-Artboard_2-box" class="ai2html"> + + <!-- Artboard: Artboard_2 --> + <div id="g-harvey_hp-Artboard_2" class="g-artboard g-artboard-v3"> + <img id="g-ai0-0" class="g-aiImg" src="https://static01.nyt.com/newsgraphics/2017/08/30/houston-rescues/3217ab7ea858a2c388ceacbca5f753f34faf5343/harvey_hp-Artboard_2.png"/> + <div id="timer" class="g-timer g-aiAbs g-aiPointText" style="top:10.2033%;margin-top:-11.9px;left:5.2511%;width:150px;"> + <p class="g-pstyle0">12 a.m. Monday</p> + </div> + <div id="g-ai0-2" class="g-text g-aiAbs g-aiPointText" style="top:31.0397%;margin-top:-8.9px;left:75.3489%;margin-left:-7.8534%;width:92px;"> + <p class="g-pstyle1">BEAUMONT</p> + </div> + <div id="g-ai0-3" class="g-text g-aiAbs g-aiPointText" style="top:45.0983%;margin-top:-17.2px;left:81.9842%;margin-left:-5.6719%;width:67px;"> + <p class="g-pstyle1">PORT</p> + <p class="g-pstyle1">ARTHUR</p> + </div> + <div id="g-ai0-4" class="g-text g-aiAbs g-aiPointText" style="top:60.5454%;margin-top:-8.9px;left:28.1349%;margin-left:-6.719%;width:79px;"> + <p class="g-pstyle1">HOUSTON</p> + </div> + <div id="g-ai0-5" class="g-text g-aiAbs g-aiPointText" style="top:72.8327%;margin-top:-17.5px;left:82.169%;margin-left:-6.8063%;width:80px;"> + <p class="g-pstyle2">GULF OF</p> + <p class="g-pstyle2">MEXICO</p> + </div> + <div id="g-ai0-6" class="g-text g-aiAbs g-aiPointText" style="top:93.7756%;margin-top:-11.9px;left:79.5415%;width:102px;"> + <p class="g-pstyle3">Rescue request</p> + </div> + <div id="g-ai0-7" class="g-text g-aiAbs g-aiPointText" style="top:93.4021%;margin-top:-11.7px;left:1.6973%;width:45px;"> + <p class="g-pstyle4">10 miles</p> + </div> + </div> + + </div> + + + + + + </div> + + </div> + </a> + + <script> + define('_nytg/2017-08-30-houston-rescues/assets', function() { return 'https://static01.nyt.com/newsgraphics/2017/08/30/houston-rescues/3217ab7ea858a2c388ceacbca5f753f34faf5343/'; }); + define('_nytg/2017-08-30-houston-rescues/big-assets', function() { return 'https://static01.nyt.com/newsgraphics/2017/08/30/houston-rescues/assets/'; }); + + require(['foundation/main'], function() { + require(['https://static01.nyt.com/newsgraphics/2017/08/30/houston-rescues/3217ab7ea858a2c388ceacbca5f753f34faf5343/build.js']); // generated from src/script.js + }); + </script> + <!-- Pipeline: 2017-08-30-houston-rescues August 31, 2017, 01:24AM 3217ab7ea858a2c388ceacbca5f753f34faf5343 --></div> + <div class="collection"> + <div class="photo-spot-region"><div class="story theme-summary lede"><article class="story theme-summary" id="topnews-100000005401681" data-story-id="100000005401681" data-rank="1" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/interactive/2017/08/30/us/houston-flood-rescue-cries-for-help.html">‘Running Out of Time’</a></h2> + + + <p class="summary">As Houston was overcome by floodwaters, thousands of people cried out for help online.</p> + + + </article> + </div></div></div> + <div class="collection"> + <div style="margin-top: +5px;"></div></div> + <div class="collection"> + <hr class="single-rule" /> + </div> + <div class="collection"> + <style> + .nythpSplitCode .column { margin-left: 21px; } + .nythpSplitCode .column:first-child { margin-left: 0px; } + .nythpSplitCode.layout { background: none; } + .nythpSplitCode .media.photo.medium-thumb { float: none; margin-left: 0; } + </style> + + <div class="layout nythpSplitCode wide-b-layout"> + <div class="column"><div></div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005400393" data-story-id="100000005400393" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/victims-harvey-death-toll-houston.html">Clinging to Her Drowning Mother, a Girl Survives</a></h2> + + <p class="byline">By SIMON ROMERO and JULIE BOSMAN </p> + + <p class="summary">“Mama was saying her prayers,” 3-year-old Jordyn Grace told a relative.</p> + + + </article> + </div> + <div class="collection headlines"> + <ul class="theme-news-headlines"> + <li> + <div style="margin-top: -10px;"></div> </li> + <li> + <article class="story" id="topnews-100000005400407" data-story-id="100000005400407" data-rank="1" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/us/harvey-death-toll.html">Stories Emerge of Harvey’s Victims as Death Toll Rises</a></h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005398786" data-story-id="100000005398786" data-rank="2" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/us/hurricane-center-timeline.html">From Forecast to Disaster: A Timeline</a></h2> + </article> + </li> + </ul> + </div> + <div class="collection"> + </div></div> + <div class="column b-column"><div></div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005401072" data-story-id="100000005401072" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/houston-flooding-growth-regulation.html">Houston, the Limitless City, Is Forced to Consider Its Limits</a></h2> + + <p class="byline">By MANNY FERNANDEZ and RICHARD FAUSSET </p> + + <p class="summary">A muscular metropolitan area that embraced growth now wonders whether growth made its flooding woes worse.</p> + + + </article> + </div> + <div class="collection headlines"> + <ul class="theme-news-headlines"> + <li> + <div style="margin-top: -10px;"></div> </li> + <li> + <article class="story" id="topnews-100000005396839" data-story-id="100000005396839" data-rank="1" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/business/harvey-recovery-houston-businesses.html">After Harvey, Will Big Business Repay Houston’s Generosity?</a></h2> + </article> + </li> + </ul> + </div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005400885" data-story-id="100000005400885" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/business/harvey-aid-sba-disaster-loans.html">Victims Face Hurdles, and Maybe Bills, in Getting Aid</a></h2> + + <p class="byline">By STACY COWLEY </p> + + <p class="summary">Thousands are applying for federal assistance, but it may be slow to arrive and require them to take on debt.</p> + + + </article> + </div> + <div class="collection headlines"> + <ul class="theme-news-headlines"> + <li> + <div style="margin-top: -10px;"></div> </li> + <li> + <article class="story" id="topnews-100000005396158" data-story-id="100000005396158" data-rank="1" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/28/us/donate-harvey-charities-scams.html">Where to Donate to Storm Victims (and How to Avoid Scams)</a></h2> + </article> + </li> + </ul> + </div> + <div class="collection"> + </div></div> + <div class="column"><div></div> + <div class="collection"> + </div></div></div></div> + <div class="collection"> + </div></div></div> + <div class="column megaSPanC"><div></div> + <div class="collection"> + <style type="text/css"> + .paywall-hp-note { + padding: 13px 15px 12px 15px; + background-color: #f7f7f7; + border-radius: 2px; + margin-bottom: 18px; + } + .paywall-hp-note:after { + content: ""; + display: table; + clear: both; + } + .paywall-hp-note h5, + .paywall-hp-note p { + font: 400 14px/16px 'nyt-cheltenham-sh',georgia,'times new roman',serif; + color: #808080; + -webkit-font-smoothing: antialiased; + } + .paywall-hp-note h5 { + font-weight: 700; + color: #4d4d4d; + margin-bottom: 9px; + } + .paywall-hp-note p { + font-style: italic; + margin-bottom: 0; + } + </style> + <div class="paywall-hp-note"> + <h5>To Our Readers</h5> + <p>The Times is providing free digital access to coverage of the storm.</p> + </div></div> + <div class="collection"> + <hr class="single-rule" style="width: 50%; text-align: center; margin: 12px auto 0;" /> + + </div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005399973" data-story-id="100000005399973" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/port-arthur-flooding.html">Port Arthur Overcome by Instant Flooding: ‘Our Whole City Is Underwater’</a></h2> + + <p class="byline">By JONAH ENGEL BROMWICH </p> + + <p class="summary">Jefferson County, Tex., about 100 miles east of Houston, was “slammed with 20 inches of rainfall” overnight. Thousands of people were stranded on their roofs, on top of cars and in attics.</p> + + + </article> + </div> + <div class="collection"> + <figure class="story theme-feature video media video-promo-small updated-video-promo-small"> + <a href="https://www.nytimes.com/video/us/100000005400001/harvey-houston-port-arthur-flooding.html"> + <div class="video-promo-small-container" style="background-image: url('https://static01.nyt.com/images/2017/08/31/us/31storm4_xp/31storm4_xp-filmstrip.jpg');"> + <div class="metadata"> + <div class="play-button-and-duration"> + <div class="play-icon"> + <svg class="play-circle" height="28" width="28"> + <circle cx="14" cy="14" r="13" stroke="#FFF" fill="transparent" stroke-width="1.5" /> + </svg> + <svg version="1.2" class="play-triangle" height="10" width="10"> + <polyline points="5,1.2264973081037427 10,9.88675134594813 0,9.88675134594813" transform="rotate(90, 5, 5)"></polyline> + </svg> + </div> + <div class="duration"> + <span>1:36</span> + </div> + </div> + <h2 class="story-heading"> + Path of Destruction Continues </h2> + <div class="orientation-icon"> + <svg width="28px" height="28px" viewBox="0 0 28 28" version="1.1" xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink"> + <g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> + <g id="Compass-Cover-ACol"> + <g id="360-View-Indicator"> + <circle id="Oval-44" fill-opacity="0.1" fill="#000000" cx="14" cy="14" r="12.75"></circle> + <path d="M14,28 C21.7319865,28 28,21.7319865 28,14 C28,6.2680135 21.7319865,0 14,0 C6.2680135,0 0,6.2680135 0,14 C0,21.7319865 6.2680135,28 14,28 Z M14,26.75 C21.0416306,26.75 26.75,21.0416306 26.75,14 C26.75,6.95836944 21.0416306,1.25 14,1.25 C6.95836944,1.25 1.25,6.95836944 1.25,14 C1.25,21.0416306 6.95836944,26.75 14,26.75 Z" id="Border" fill="#FFFFFF"></path> + <g id="eyes" transform="translate(9.488845, 14.454531)" fill="#FFFFFF"> + <ellipse id="Oval-12" cx="2.01115463" cy="2.04546933" rx="1.5" ry="1.5"></ellipse> + <ellipse id="Oval-12-Copy" cx="7.01115463" cy="2.04546933" rx="1.5" ry="1.5"></ellipse> + </g> + <path d="M13.9960842,13 L21.5,5.88357462 C19.5796583,4.05113973 16.9264365,3 13.9960843,3 C11.065732,3 8.42034167,4.05113973 6.5,5.88357462 L13.9960842,13 Z" id="view" fill="#FFFFFF"></path> + </g> + </g> + </g> + </svg> + </div> + </div> + </div> + </a> + <figcaption class="caption"> + <p class="credit">By MALACHY BROWNE, BARBARA MARCOLINI and CHRIS CIRILLO</p> + </figcaption> + </figure> + </div> + <div class="collection headlines"> + <ul class="theme-news-headlines"> + <li> + <article class="story" id="topnews-100000005398038" data-story-id="100000005398038" data-rank="0" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/29/us/harvey-email-callout.html">Are You Affected? We Want to Hear From You</a></h2> + </article> + </li> + </ul> + </div> + <div class="collection"> + </div></div> + + <div style="background-color: #fff;"><div></div> + </div> + </div> + </div></div> + <div class="collection"> + <script>function getFlexData() { return {"data":{"item":[{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/09\/01\/science\/01WATER1\/01WATER1-videoSixteenByNine310.jpg","type":"article","headline":"A Sea of Hazards in Floodwaters","link":"https:\/\/www.nytimes.com\/2017\/08\/31\/us\/houston-contaminated-floodwaters.html"},{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/08\/31\/insider\/mattress-mack\/mattress-mack-videoSixteenByNine310.jpg","type":"video","headline":"A Mattress Store Turned Shelter","link":"https:\/\/www.nytimes.com\/video\/us\/100000005398367\/houston-harvey-mattress-shelter.html"},{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/08\/31\/us\/stormpics74\/stormpics74-videoSixteenByNine310.jpg","type":"slideshow","headline":"Harvey in Pictures","link":"https:\/\/www.nytimes.com\/2017\/08\/27\/us\/harvey-pictures-hurricane-storm.html?mcubz=0&_r=0"},{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/08\/31\/dining\/360-tamircover\/360-tamircover-videoSixteenByNine310.jpg","type":"video","headline":"The Daily 360: Submerged Streets ","link":"https:\/\/www.nytimes.com\/video\/us\/100000005399523\/harvey-houston-flooding-rescue.html"}]}}; }var NYTD=NYTD || {}; NYTD.FlexTypes = NYTD.FlexTypes || []; NYTD.FlexTypes.push({"target":"FT100000005396835","type":"HP Thumbstrip","data":{"item":[{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/09\/01\/science\/01WATER1\/01WATER1-videoSixteenByNine310.jpg","type":"article","headline":"A Sea of Hazards in Floodwaters","link":"https:\/\/www.nytimes.com\/2017\/08\/31\/us\/houston-contaminated-floodwaters.html"},{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/08\/31\/insider\/mattress-mack\/mattress-mack-videoSixteenByNine310.jpg","type":"video","headline":"A Mattress Store Turned Shelter","link":"https:\/\/www.nytimes.com\/video\/us\/100000005398367\/houston-harvey-mattress-shelter.html"},{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/08\/31\/us\/stormpics74\/stormpics74-videoSixteenByNine310.jpg","type":"slideshow","headline":"Harvey in Pictures","link":"https:\/\/www.nytimes.com\/2017\/08\/27\/us\/harvey-pictures-hurricane-storm.html?mcubz=0&_r=0"},{"thumb":"https:\/\/static01.nyt.com\/images\/2017\/08\/31\/dining\/360-tamircover\/360-tamircover-videoSixteenByNine310.jpg","type":"video","headline":"The Daily 360: Submerged Streets ","link":"https:\/\/www.nytimes.com\/video\/us\/100000005399523\/harvey-houston-flooding-rescue.html"}]}});</script><link rel="stylesheet" type="text/css" href="https://static01.nyt.com/newsgraphics/2015/hp-thumbstrip/assets/build.css" /> + <style> + .nytd-hp-thumbstrip{ display:flex; } + .nytd-hp-thumbstrip .ts-link{ width:100%; } + .nytd-hp-thumbstrip .ts-link .ts-item{ width:94%; } + </style> + + <script> + var NYTG_ASSETS = "_assets/"; + var NYTG_BIG_ASSETS = "_big_assets/"; + require(['foundation/main'], function() { + require(["https://static01.nyt.com/newsgraphics/2015/hp-thumbstrip/assets/build.js"]); + }); + </script><div id="FT100000005396835"></div></div> + <div class="collection"> + <hr class="scotch-rule" /></div> + </div><!-- close span-abc-region --> + + <div class="span-ab-layout layout"> + + <div class="ab-column column"> + + <section id="top-news" class="top-news"> + <h2 class="section-heading visually-hidden">Top News</h2> + + + + + <div class="wide-b-layout layout"> + + <div class="a-column column"> + + <div class="first-column-region region"> + + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005399055" data-story-id="100000005399055" data-rank="0" data-collection-renderstyle="HpSumSmallMedia"> + + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/politics/trump-missouri-tax-plan.html">Trump Pitches Tax Cuts on Business as Aiding Middle Class</a></h2> + + <p class="byline">By JULIE HIRSCHFELD DAVIS and BINYAMIN APPELBAUM </p> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/08/30/us/politics/trump-missouri-tax-plan.html"><img src="https://static01.nyt.com/images/2017/08/31/us/31dc-trump-promo/31dc-trump-promo-thumbStandard.jpg" alt=""></a> + </div> + + <p class="summary"> + In a speech on Wednesday in Springfield, Mo., President Trump laid out the case for cutting taxes for businesses and individuals and for simplifying the tax code. </p> + + <p class="theme-comments"> + <a href="https://www.nytimes.com/2017/08/30/us/politics/trump-missouri-tax-plan.html?hp&target=comments#commentsContainer" class="comments-link"><i class="icon sprite-icon comments-icon"></i><span class="comment-count"> Comments</span></a> + </p> + + </article> + + </div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005398833" data-story-id="100000005398833" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/29/business/economy/trump-corporate-tax-plan.html">Trump Tax Plan May Free Corporate Dollars. Then What?</a></h2> + + <p class="byline">By PATRICIA COHEN </p> + + <p class="summary">Republicans are promising to stimulate investment and create jobs. But steps to undo tax dodges may not produce the intended economic lift.</p> + + <p class="theme-comments"> + <a href="https://www.nytimes.com/2017/08/29/business/economy/trump-corporate-tax-plan.html?hp&target=comments#commentsContainer" class="comments-link"><i class="icon sprite-icon comments-icon"></i><span class="comment-count"> Comments</span></a> + </p> + + </article> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-summary" id="topnews-100000005401510" data-story-id="100000005401510" data-rank="0" data-collection-renderstyle="HpSumMediumMedia" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/judge-texas-sanctuary-cities.html">Federal Judge Blocks Texas’ Ban on ‘Sanctuary Cities’</a></h2> + + <p class="byline">By MANNY FERNANDEZ </p> + + <p class="summary"> + The temporary ruling prevents the state from going ahead with provisions that were to go into effect on Friday. </p> + + + + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="https://www.nytimes.com/2017/08/30/us/judge-texas-sanctuary-cities.html"><img src="https://static01.nyt.com/images/2017/08/31/us/31sanctuary/31sanctuary-mediumFlexible177.jpg" alt="" /></a> + </div> + </figure> + </article> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-summary" id="topnews-100000005401018" data-story-id="100000005401018" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/politics/trump-obamacare-enrollment-markets-subsidies.html">Seeking to Stabilize Health Markets, but Offering Few Details</a></h2> + + <p class="byline">By ROBERT PEAR </p> + + <p class="summary">A Trump administration official refused to say what, if anything, the government would do to encourage people to sign up for health insurance under the Affordable Care Act.</p> + + + </article> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-summary" id="topnews-100000005399964" data-story-id="100000005399964" data-rank="0" data-collection-renderstyle="HpSumMediumMedia" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/us/politics/trump-north-korea-extortion-money.html">On North Korea, Trump Says ‘Talking Is Not the Answer!’</a></h2> + + <p class="byline">By MARK LANDLER </p> + + <p class="summary"> + While Mr. Trump’s threats against North Korea have been unnerving, it is the prospect of a risky dialogue that most unsettles former officials. </p> + + + + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="https://www.nytimes.com/2017/08/30/us/politics/trump-north-korea-extortion-money.html"><img src="https://static01.nyt.com/images/2017/08/31/us/31dc-prexy1/merlin-to-scoop-126571670-887690-mediumFlexible177.jpg" alt="" /></a> + </div> + </figure> + </article> + </div> + <div class="collection headlines"> + <h3 class="kicker collection-kicker">More in Politics</h3> + <ul class="theme-news-headlines"> + <li> + <article class="story" id="topnews-100000005400483" data-story-id="100000005400483" data-rank="0" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/us/politics/trump-russia-michael-cohen.html">Trump Lawyer ‘Vehemently’ Denies Russian Collusion</a> </h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005401238" data-story-id="100000005401238" data-rank="1" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/us/politics/us-aid-pakistan-terror.html">U.S. Gives Military Assistance to Pakistan, With Strings Attached</a> </h2> + </article> + </li> + </ul> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-summary" id="topnews-100000005400786" data-story-id="100000005400786" data-rank="0" data-collection-renderstyle="HpSum" data-start-time="" data-end-time=""> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/health/gene-therapy-cancer.html">F.D.A. Approves Gene-Altering Leukemia Treatment</a></h2> + + <p class="byline">By DENISE GRADY </p> + + <p class="summary">The Food and Drug Administration approved the first treatment that alters a patient’s cells to fight cancer. It will cost $475,000.</p> + + + </article> + </div> + <hr class="single-rule" /><div class="collection headlines"> + <h3 class="kicker collection-kicker">More News</h3> + <ul class="theme-news-headlines"> + <li> + <article class="story" id="topnews-100000005401772" data-story-id="100000005401772" data-rank="0" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/31/world/asia/building-collapse-in-mumbai-kills-at-least-7.html">Building Collapse in Mumbai Kills at Least 7</a></h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005401309" data-story-id="100000005401309" data-rank="1" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/sports/tennis/maria-sharapova-timea-babos-us-open.html">U.S. Open: Maria Sharapova, With No Tears, Advances</a></h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005399026" data-story-id="100000005399026" data-rank="2" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/us/politics/eric-schmidt-google-new-america.html">Think Tank Backed by Google Ousts Critic of Monopolies</a></h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005401178" data-story-id="100000005401178" data-rank="3" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/world/americas/brazil-amazon-mining-temer-environmentalists-judge.html">Brazilian Judge Stymies Plan for Mining in Amazon Region</a></h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005400012" data-story-id="100000005400012" data-rank="4" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/world/europe/trump-press-united-nations.html">U.N. Human Rights Chief Condemns Trump’s Attacks on Media</a></h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005400793" data-story-id="100000005400793" data-rank="5" data-collection-renderstyle="HpBlogHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/world/asia/afghanistan-troop-totals.html">11,000 U.S. Troops in Afghanistan, Pentagon Says</a></h2> + </article> + </li> + </ul> + </div> + <hr class="single-rule" /><div class="collection"> + <!-- + +====================================================== + +THIS IS A GENERATED TEMPLATE FILE. DO NOT EDIT. + +====================================================== + +--> + <!-- this is generated from src/style.css --> + <style>.tips-promo { + position: relative; + width: 100%; + height: auto; } + .tips-promo .nyt-logo { + position: absolute; + top: 1rem; + left: 0; + right: 0; + margin: 0 auto; + width: 6rem; } + .tips-promo svg { + width: 6rem; + margin: 0 auto; } + .tips-promo .text-bubble { + padding: 1rem 0; } + .tips-promo .text-bubble h1 { + font-family: "nyt-cheltenham", times, serif; + color: black; + position: relative; + font-size: 1.5rem; + font-weight: 400; + line-height: 0.9; + -webkit-font-smoothing: antialiased; + z-index: 0; } + .tips-promo .text-bubble h2 { + font-family: "nyt-cheltenham-sh", times, serif; + color: black; + position: relative; + font-size: 14px; + font-weight: 400; + line-height: 1.3; + -webkit-font-smoothing: antialiased; + z-index: 0; + padding-top: 0.5rem; } + .tips-promo .text-bubble .contact { + font-family: "nyt-cheltenham-sh", times, serif; + display: inline-block; + border-style: none; + border-color: transparent; + font-size: 13px; + font-weight: bold; + padding: 0; + background: none; + color: #326891; + text-decoration: underline; } + </style> + + <div id="g-graphic" data-preview-slug="2016-10-31-tips-hp"> + <div class="tips-promo"> + <div class="text-bubble"> + <h1><a href="https://www.nytimes.com/tips">Got a confidential news tip?</a></h1> + <h2>The New York Times offers several ways to get in touch with and provide materials to our journalists. <a href="https://www.nytimes.com/tips"><span class="contact">Learn more</span></a>.</h2> + </div> + </div> + </div> + + <script> + var _gaq = _gaq || []; + define('_nytg/2016-10-31-tips-hp/assets', function() { return 'https://static01.nyt.com/newsgraphics/2016/10/31/tips-hp/00b5b741a6c5682e24f945c547f78fbe98f2c27f/'; }); + define('_nytg/2016-10-31-tips-hp/big-assets', function() { return 'https://static01.nyt.com/newsgraphics/2016/10/31/tips-hp/assets/'; }); + + require(['foundation/main'], function() { + require(['https://static01.nyt.com/newsgraphics/2016/10/31/tips-hp/00b5b741a6c5682e24f945c547f78fbe98f2c27f/build.js']); // generated from src/script.js + }); + </script> + <!-- Pipeline: 2016-10-31-tips-hp December 22, 2016, 09:17PM 00b5b741a6c5682e24f945c547f78fbe98f2c27f --></div> + + </div><!-- close first-column-region --> + + </div><!-- close a-column --> + + <div class="b-column column"> + + + + <div class="second-column-region region"> + + <div class="collection"> + <script>function getFlexData() { return {"data":{"options":{"width":375,"height":380,"jsonp":"https:\/\/static01.nyt.com\/slideshow\/2017\/08\/28\/world\/europe\/tk.slideshow.jsonp","link":"https:\/\/www.nytimes.com\/2017\/08\/30\/world\/europe\/princess-diana-death-anniversary.html"},"photos":{"photo":{"url":"","credit":""}},"advanced":{"delay":3,"limitjsonp":0,"rendition":"largeHorizontal375","targetoverride":"","abbreviatecredits":false}}}; }var NYTD=NYTD || {}; NYTD.FlexTypes = NYTD.FlexTypes || []; NYTD.FlexTypes.push({"target":"FT100000005396180","type":"FadingSlideShow","data":{"options":{"width":375,"height":380,"jsonp":"https:\/\/static01.nyt.com\/slideshow\/2017\/08\/28\/world\/europe\/tk.slideshow.jsonp","link":"https:\/\/www.nytimes.com\/2017\/08\/30\/world\/europe\/princess-diana-death-anniversary.html"},"photos":{"photo":{"url":"","credit":""}},"advanced":{"delay":3,"limitjsonp":0,"rendition":"largeHorizontal375","targetoverride":"","abbreviatecredits":false}}});</script><script src="https://static01.nyt.com/packages/js/multimedia/libs/jquery-1.7.1.min.js"></script><script src="https://static01.nyt.com/packages/js/multimedia/bundles/projects/2013/FadingSlideShow2.js"></script> + <style type="text/css"> + .edition-domestic .span-ab-layout .nytmm_FadingSlideShow .credit, .edition-international .span-ab-layout .nytmm_FadingSlideShow .credit { + color: #BAB8B3; + display: inline-block; + font-family: arial,helvetica,sans-serif; + font-size: 0.5625rem !important; + font-weight: 400; + line-height: 0.75rem; + } + </style><div id="FT100000005396180"></div></div> + <div class="collection"> + <div style="margin-top: +25px;"></div></div> + <div class="collection"> + <article class="story theme-feature" id="topnews-100000005401664" data-story-id="100000005401664" data-rank="0" data-collection-renderstyle="LargeMediaHeadlineSumCentered"> + + + + <h1 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/world/europe/princess-diana-death-anniversary.html">Death of Diana Transformed </br> the Monarchy, and Britain Itself</a></h1> + + <p class="summary">Twenty years after her death, the influence of Diana, Princess of Wales, can still be felt in unexpected ways in Britain.</p> + + <p class="byline">By SARAH LYALL </p> + + + <ul class="refer theme-news-headlines"> + <li> + <article class="story" id="topnews-100000005401664"> + <h2 class="refer-heading"><a href="https://www.nytimes.com/2017/08/30/world/europe/princess-diana-anniversary.html">Diana’s Public Life, in Photos and Headlines</a> </h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005401664"> + <h2 class="refer-heading"><a href="https://www.nytimes.com/2017/08/30/world/europe/uk-princess-diana-20th-anniversary.html">Death of a Princess: Times Journalists Recall Covering Diana</a> </h2> + </article> + </li> + </ul> + </article> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-summary timedBriefing timedBriefingHide" id="topnews-100000005368865" data-story-id="100000005368865" data-rank="0" data-collection-renderstyle="HpSumMediumMediaHigh" data-start-time="05:00" data-end-time="13:00"> + + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="https://www.nytimes.com/2017/08/31/briefing/harvey-diana-david-tang.html"><img src="https://static01.nyt.com/images/2017/09/01/world/31USBriefing-Texas/31USBriefing-Texas-mediumFlexible177-v2.gif" alt="" /></a> + </div> + </figure> + + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/31/briefing/harvey-diana-david-tang.html">Your Thursday Briefing</a></h2> + + <p class="byline">By CHRIS STANFORD <time class="timestamp" datetime="2017-08-31" data-eastern-timestamp="6:34 AM" data-utc-timestamp="1504175651">6:34 AM ET</time></p> + + <p class="summary"> + Here’s what you need to know to start your day. </p> + + + <ul class="refer theme-news-headlines"> + <li> + <article class="story" id="topnews-100000005368865"> + <h2 class="refer-heading"><a href="https://www.nytimes.com/2017/08/31/nyregion/new-york-today-hurricanes-in-nyc-harvey-tropical-storm.html">New York Today: Reflecting on Harvey, in the Northeast</a> <time class="timestamp" data-eastern-timestamp="6:00 AM" datetime="2017-08-31" data-utc-timestamp="1504173618000">6:00 AM</time></h2> + </article> + </li> + </ul> + + </article> + </div> + <div class="collection"> + <style> + /*default display conditions*/ + .nythpCAToday {display: none;} + /*geocoded display conditions*/ + html.geo-region-CA .nythpCAToday {display: block;} + + .nythpCAToday article::before { + content: ""; + background: #e2e2e2; + width: 187px; + height: 1px; + margin: 12px 0 12px 93px; + } + + .second-column-region .collection:first-child .nythpCAToday article::before { + display: none; + } + + .second-column-region .collection:first-child .nythpCAToday { border-bottom: 1px solid #ccc; + padding-bottom: 8px; + } + + </style> + + <div class="nythpCAToday"> + + + </div></div> + <hr class="single-rule" /><div class="collection"> + <link rel="stylesheet" type="text/css" href="https://web-player.art19.com/releases/0.0.42.css"> + <link rel="stylesheet" type="text/css" href="https://static01.nyt.com/packages/html/mobile/2017/Audio/nyt-micro-player.min.css"> + <script src="https://static01.nyt.com/packages/html/mobile/2017/Audio/nyt-micro-player-template.min.js"></script> + <style> + .audio-brief .image { + width: 75px; + height: 75px; + float: right; + clear: right; + margin: 4px 0 6px 12px; + } + .audio-brief .summary { + padding-bottom: 10px; + } + .audio-brief .audio { + margin: 0; + } + .audio-brief .art19-web-player { + margin-bottom: 0; + } + .audio-brief .art19-web-player.awp-micro .awp-left { + border-right: none; + } + .audio-brief .art19-web-player.awp-micro .awp-brand-logo { + padding: 0; + } + .audio-brief .awp-brand-logo img { + display: none; + } + + .audio-brief .awp-embed-button{ + cursor: pointer; + } + #daily-sub-links{ + width:100%; + padding:0; + margin:-10px 0 0 0; + } + #daily-sub-links p{ + font-family:"nyt-franklin",arial,helvetica,sans-serif; + font-weight:400; + font-size: 12px; + line-height: 15px; + color:#000; + } + #daily-sub-links p a{ + display:inline-block; + color: #326891; + padding-right: 8px; + padding-left: 6px; + border-right:1px solid #ccc; + } + #daily-sub-links p a:last-child{ + border-right:none; + } + </style> + <article class="story audio-brief theme-summary"> + <div class="image"> + <a href="https://www.nytimes.com/column/the-daily"> + <img src="https://static01.nyt.com/images/2017/02/23/podcasts/the-daily/the-daily-logo-png-version/the-daily-logo-png-version-thumbLarge-v3.png" height="75" width="75" alt="The Daily Logo"> + </a> + </div> + <h3 class="kicker"><a href="https://www.nytimes.com/podcasts/">Audio</a></h3> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/thedaily"> + Listen to ‘The Daily’ + </a> + </h2> + <p class="summary">The uniquely American success story of a city built on a swampy bayou, and how Harvey’s destruction recasts the narrative.</p> + <figure id="audio" class="art19 media audio" aria-label="media" role="group" data-audio-url="" data-audio-duration=""> + <span class="visually-hidden">Audio</span> + <div data-require-template="art19-web-player/templates/nyt-micro-player" data-preload='false' class="art19-web-player awp-micro awp-theme-light" data-episode-id='1ed84d54-17bf-4d6b-be2f-405f51402cc6' data-squery='max-width:280px=awp-nyt-size-1 max-width:460px=awp-nyt-size-2' data-download-enabled='false' data-embed-enabled='false' data-brand-logo-enabled='false' data-ad-progress-color='#4d7b9f' data-emit-events='true' > + </div> + </figure> + </article> + <div id="daily-sub-links"> + <p>Follow The Daily: <a href="https://itunes.apple.com/us/podcast/the-daily/id1200361736?mt=2&ign-mpt=uo%3D4" target="_blank">Apple Podcasts</a> <a href="https://play.radiopublic.com/88f7d8c3-7289-4dc6-b300-5ba71b43f5e5" target="_blank">Radio Public</a> <a href="http://www.stitcher.com/podcast/the-new-york-times/the-daily-10" target="_blank">Stitcher</a></p> + </div> + <script src="https://web-player.art19.com/releases/0.0.42.js"></script></div> + <hr class="single-rule" /><div class="collection"> + <div class="hpHeader"> + <h6><a href="http://www.nytimes.com/spotlight/times-tips?contentCollection=smarter-living">Smarter Living</a></h6> + </div><div class="nythpSmarterLiving smarterLiving-promo-region region"> + <article class="story theme-summary" id="topnews-100000005400342" data-story-id="100000005400342" data-rank="2" data-collection-renderstyle="HpSumSmallMediaHigh"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/31/smarter-living/5-cheap-ish-wellness-items-you-didnt-know-you-needed.html">5 Wellness Items You Didn’t Know You Needed</a></h2> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/08/31/smarter-living/5-cheap-ish-wellness-items-you-didnt-know-you-needed.html"><img src="https://static01.nyt.com/images/2017/08/31/us/31sl-newsletter/31sl-newsletter-thumbStandard.jpg" alt=""></a> + </div> + + <p class="byline">By TIM HERRERA <time class="timestamp" datetime="2017-08-31" data-eastern-timestamp="2:45 AM" data-utc-timestamp="1504161901">2:45 AM ET</time></p> + + <p class="summary"> + Welcome to the latest edition of the Smarter Living newsletter. </p> + + + </article> + <article class="story theme-summary" id="topnews-100000005278952" data-story-id="100000005278952" data-rank="3" data-collection-renderstyle="HpSumSmallMediaHigh"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/07/19/travel/british-airways-flight-safety-videos.html">5 Flight Safety Videos Worth Watching</a></h2> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/07/19/travel/british-airways-flight-safety-videos.html"><img src="https://static01.nyt.com/images/2017/07/18/travel/18flight-videos1/18flight-videos1-thumbStandard.png" alt=""></a> + </div> + + <p class="byline">By JUSTIN SABLICH </p> + + <p class="summary"> + A new British Airways video featuring some of the country’s best-known actors and comedians is the latest in a long line of entertaining flight safety films. </p> + + + </article> + </div> + + + <!-- Begin A/B Personalization Test --> + + <style> + .flag-smarterLivingRec-on .nythpSmarterLiving { + display: none; + } + </style> + <script type="text/javascript"> + require(['foundation/main'], function (main) { + require([ + 'underscore/nyt', + 'jquery/nyt', + 'foundation/views/base-view' + ], + function (_, $, BaseView) { + var SmarterLiving = BaseView.extend({ + + template: _.template('<article class="story theme-summary" id="topnews-<%= id %>"' + + ' data-story-id="<%= id %>" data-collection-renderstyle="HpSumSmallMediaHigh"><h2 class="story-heading">' + + '<a href="<%= url %>"><%= headline %></a></h2><div class="thumb"><a href="<%= url %>">' + + '<img src="<%= thumb_url %>" alt=""></a></div></article>'), + + events: { + 'click article a': 'handleArticleLinkClick' + }, + + articles: [], + + initialize: function () { + const view = this; + + if (!this.pageManager.flag('smarterLivingRec')) { + return; + } + + this.$el = $('.nythpSmarterLiving'); + this.setupImpressionTracking = _.once(this._setupImpressionTracking); + $.ajax( + { + url: 'https://rec.api.nytimes.com/svc/recommendations/v4/smarter_living.json', + xhrFields: { + withCredentials: true + } + }) + .done(function(data) { + view.setupImpressionTracking(); + _.each(data.assets, function(item) { + view.articles.push(item.url); + }); + // iterate over the existing articles + view.$el.find('article').each(function (index) { + // replace with articles from rec service + $(this).replaceWith(view.template(data.assets[index])); + }); + }) + .always(function() { + // unhide articles + view.$el.css('display', 'block'); + }); + }, + + _setupImpressionTracking: function () { + if (this.pageManager.isComponentVisible(this.$el)) { + this.recordTrackingImpression(); + } else { + this.subscribe('nyt:page-scroll', this.handleScroll); + } + }, + + handleArticleLinkClick: function (ev) { + const view = this; + const $el = $(ev.currentTarget); + var href = this.trackingAppendParams($el.attr('href'), { + 'action': 'click', + 'pgtype': 'Homepage', + 'clickSource': 'story-heading', + 'module': 'smarter-living', + 'region': 'second-column-region', + 'contentCollection': 'smarter-living', + 'mData': $.param({ + articles: view.articles + }), + }); + + $el.attr('href', href); + }, + + handleScroll: function () { + if (this.pageManager.isComponentVisible(this.$el)) { + this.recordTrackingImpression(); + this.stopSubscribing('nyt:page-scroll'); + } + }, + + recordTrackingImpression: function () { + const view = this; + this.trackingTriggerImpression('Impression', { + 'module': 'smarter-living', + 'pgtype': 'Homepage', + 'region': 'second-column-region', + 'action': 'impression', + 'proxyEventType': 'impression', + 'timestamp': new Date().getTime(), + 'mData': { + articles: view.articles + }, + }); + }, + + }); + + new SmarterLiving(); + }); + }); + </script> + <div id="g-graphic" class="nythp-smarter-living-formonly-email-promo notification-widget story"> + <hr class="single-rule" style="width: 50%; text-align: center; margin: 12px auto 12px;" /> + + <p class="theme-summary">Get a weekly roundup of the best advice from The Times on living a better, smarter, more fulfilling life.</p> + <div id="smarter-living-form-only"></div> + + </div> + + <script> + require.config({ + paths: { + 'nytint/email-subscriber' : 'https://int.nyt.com/applications/email-subscriber/client' + } + }); + + require(['foundation/main'], function() { + require(['nytint/email-subscriber'], function(Subscriber) { + Subscriber.setup({ + containerId: 'smarter-living-form-only', + productCode: 'SL', + elementToHideOnSubscribe: '.nythp-smarter-living-formonly-email-promo', + text: {unregisteredButton: 'Sign Up', + unregisteredPlaceholder: 'Get Smarter Living by email', + registeredButton: 'Sign Up', + alreadySubscribedMessage: 'You’re already subscribed.', + thanksMessage: 'You’ve signed up as %email%', + emailPreferencesLinkText: 'Update your mail preferences »', + errorMessage: 'Error submitting, please try again.', + registeredWelcome: 'Get Smarter Living by email'} + }); + + setTimeout(function(){ + var widget = document.getElementById('smarter-living-form-only'); + var container = widget.getElementsByTagName('div')[0]; + var form = widget.getElementsByTagName('form')[0]; + var status = container.getAttribute('data-status'); + var notify = widget.getElementsByClassName('notify-email')[0]; + + if(notify !== undefined){ + + var origtext = notify.getAttribute('placeholder'); + var newtext = 'Please enter your email address'; + var button = container.getElementsByTagName('button')[0]; + + widget.setAttribute('class','clearfix'); + + notify.addEventListener('mouseover',function(){ + notify.setAttribute('placeholder',newtext); + }); + + notify.addEventListener('mouseout',function(){ + notify.setAttribute('placeholder',origtext); + }); + + notify.addEventListener('focus',function(){ + notify.setAttribute('placeholder',''); + }); + + } + + if(form !== undefined){ + notify.addEventListener('keyup',function(){ + form.setAttribute('class','dirtyform'); + }); + container.setAttribute('class','not-signedin'); + } else { + container.setAttribute('class','signedin'); + } + },2000); + + }); + }); + </script></div> + <div class="collection"> + <style> + .signup-favor { + text-align: center; + color: #326891; + cursor: pointer; + padding-top: 15px; + padding-bottom: 15px; + } + + .signup-favor.top-border { + margin-top: 8px; + padding-top: 32px; + border-top: 1px solid #ccc; + } + + .signup-favor.bottom-border { + padding-bottom: 33px; + border-bottom: 1px solid #ccc; + } + + .signup-favor a:hover { + text-decoration: none; + } + + .signup-favor .tagline { + display: block; + font-size: 1.25rem; + line-height: 1.75rem; + font-weight: 700; + font-style: normal; + font-family: "nyt-cheltenham", georgia, "times new roman", times, serif; + color: #000; + } + + .signup-favor .subscribe { + font-size: 12px; + line-height: 1.0625rem; + font-weight: 500; + font-style: normal; + font-family: "nyt-franklin", arial, helvetica, sans-serif; + color: #326891; + border-bottom: 1px solid rgba(50,104,145,.2); + letter-spacing: .04em; + margin: 5px auto 0; + padding-bottom: 1px; + text-transform: uppercase; + display: inline-block; + -moz-transition: border 0.2s ease; + -webkit-transition: border 0.2s ease; + -ms-transition: border 0.2s ease; + transition: border 0.2s ease; + } + .signup-favor .tagline .support { + font-size: 1.25rem; + } + + .signup-favor .tagline .no-break { + white-space: nowrap; + } + .signup-favor:hover .subscribe { + border-color: rgba(50,104,145,1); + } + + #nythp-sub-promo { display: none; } + + </style> + <div id="g-graphic" class="sub-promo-click"> + <div class="signup-favor hidden" id="signup-favor"> + <a href="https://www.nytimes.com/DesktopHome" class="subscribe-link"> + <span class="tagline"><span class="no-break">Journalism that matters.</span> <br /><span class="no-break">More essential than ever.</span></span> + <span class="subscribe">Subscribe to the Times</span> + </a> + + </div> + </div> + + <div id="nythp-sub-promo"></div> + + <script type="text/javascript"> + require(['foundation/main'], function(main) { + require(['jquery/nyt', 'underscore/nyt', 'foundation/models/user-data', 'foundation/tracking/tracking-mixin', 'foundation/views/page-manager', 'foundation/hosts'], + function ($, _, userData, trackingMixin, pageManager, hosts) { + var signupPromo = { + + taglines: { + 'promo1': '<span style="white-space: nowrap">Journalism that matters.</span><br /><span style="white-space: nowrap"> More essential than ever.</span>', + 'promo2': '<span style="white-space: nowrap">Independent journalism.</span><br /><span style="white-space: nowrap">More essential than ever.</span>', + 'promo3': 'Real reporting. Real news.', + 'promo4': 'Independent. Trusted. Real.', + 'promo5': 'Real journalism. <span style="white-space: nowrap">Like nowhere else.</span>', + 'promo6': 'Truth is hard to find.<br /><span style="white-space: nowrap; font-size: 1.25rem;">But easier with 1,000+ journalists looking.</span>' + }, + + /** + * Initialization called when instantiating the view + * + * @method initialize + **/ + initialize: function () { + this.$el = $('#signup-favor'); + $(document).on('click', "#g-graphic.sub-promo-click", function(e){ + if (e) { + e.preventDefault(); + } + signupPromo.handleClick(); + }); + + this.version = 'promo1'; + + userData.ready(function() { + signupPromo.handleUserReady(); + }); + + this.link = 'https://www.nytimes.com/DesktopHome'; + + }, + + + trackImpression: function() { + + setTimeout(function() { + signupPromo.tracking.trackingTriggerRaw( + signupPromo.version, + { + module: 'election-sub-desktop-home', + action: 'impression' + }, + 'impression' + ); + }, 1000); + + }, + + + + handleUserReady: function () { + + var view = this; + console.log("abra "+ window.NYTD.Abra('www-signup-favor-test-v4')); + + if (window.NYTD.Abra('www-signup-favor-test-v4') == 'control') { + return; + } + + + if (userData) { + + if (!userData.isHomeDeliverySubscriber() && + !userData.isWebSubscriber() && + !userData.isMobileSubscriber() && + !userData.isTabletSubscriber()) { + if (!$('html').hasClass('geo-country-US')) { + this.link = 'https://www.nytimes.com/DesktopHomeINYT'; + this.$el.find(".subscribe-link").attr("href", "http://www.nytimes.com/DesktopHomeINYT") + } + this.switchText(); + } else { + this.$el.find('.tagline').html('<span class="no-break support">Support the mission of The Times.</span>'); + this.$el.find('.subscribe').html('Sponsor a student subscription today.'); + this.version = 'studentSponsor'; + this.link = 'https://www.nytimes.com/NativeSponsor'; + this.$el.find('.subscribe-link').attr('href', 'https://www.nytimes.com/NativeSponsor'); + } + + // if user is not already subscribed, show the element + this.$el.removeClass('hidden'); + this.trackImpression(); + if (this.$el.closest('.column').hasClass('ab-column')){ + this.$el.addClass('top-border'); + } else if (this.$el.closest('.column').hasClass('b-column')) { + this.$el.addClass('top-border').addClass('bottom-border'); + } + + } + + }, + + switchText: function () { + var hasAbra = false; + + hasAbra = window.NYTD && window.NYTD.Abra && window.NYTD.Abra('www-signup-favor-test-v4'); + // check if this is part of an AB test + if (hasAbra) { + switch (window.NYTD.Abra('www-signup-favor-test-v4')) { + case '1': + this.$el.find('.tagline').html(this.taglines['promo1']); + this.version = 'promo1'; + break; + case '2': + this.$el.find('.tagline').html(this.taglines['promo2']); + this.version = 'promo2'; + break; + case '3': + this.$el.find('.tagline').html(this.taglines['promo3']); + this.version = 'promo3'; + break; + case '4': + this.$el.find('.tagline').html(this.taglines['promo4']); + this.version = 'promo4'; + break; + case '5': + this.$el.find('.tagline').html(this.taglines['promo5']); + this.version = 'promo5'; + break; + case '6': + this.$el.find('.tagline').html(this.taglines['promo6']); + this.version = 'promo6'; + break; + } + } + }, + + handleClick: function (e) { + + if (e) { + e.preventDefault(); + } + + this.tracking.trackingTriggerRaw( + this.version, + { + module: 'election-sub-desktop-home', + action: 'click', + eventName: 'sign-up' + }, + 'interaction' + ); + + setTimeout(function() { + window.location.href = signupPromo.link; + }, 300); + + }, + }; + + signupPromo.tracking = trackingMixin; + signupPromo.pageManager = pageManager; + signupPromo.hosts = hosts; + signupPromo.initialize(); + }); + }); + + </script></div> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005400160" data-story-id="100000005400160" data-rank="0" data-collection-renderstyle="HpSumSmallMediaHigh"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/nyregion/ordering-review-of-statues-puts-de-blasio-in-tricky-spot.html">Ordering Review of Statues Puts de Blasio in Tricky Spot</a></h2> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/08/30/nyregion/ordering-review-of-statues-puts-de-blasio-in-tricky-spot.html"><img src="https://static01.nyt.com/images/2017/08/31/nyregion/31monument1/31monument1-thumbStandard.jpg" alt=""></a> + </div> + + <p class="byline">By WILLIAM NEUMAN </p> + + <p class="summary"> + Since Mayor de Blasio called for a review of all possible symbols of hate, he has been peppered with questions about how far it will go. </p> + + + </article> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-summary" id="topnews-100000005399785" data-story-id="100000005399785" data-rank="0" data-collection-renderstyle="HpSumSmallMediaHigh"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/business/david-tang-dead-fashion-retailer.html">David Tang, Fashion Retailer and Raconteur, Dies at 63</a></h2> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/08/30/business/david-tang-dead-fashion-retailer.html"><img src="https://static01.nyt.com/images/2017/08/31/business/31TANG1/31TANG1-thumbStandard-v2.jpg" alt=""></a> + </div> + + <p class="byline">By KEITH BRADSHER and ELIZABETH PATON </p> + + <p class="summary"> + A lifelong entrepreneur from a wealthy family, he founded a succession of businesses catering to the affluent but also backed democracy for Hong Kong. </p> + + + </article> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-video theme-video-updated" + id="topnews-100000005343497" + data-story-id="100000005343497" + data-rank="0" + data-collection-renderstyle="VideoEmbed"> + <figure class="promo media video embedded" + data-position="secondcolumn" + data-page="homepage" + data-videoid="100000005343497" + data-headline="Forty Years of Voyager" + data-summary="Long after they have stopped communicating with Earth, the twin Voyager spacecraft will forever drift among the stars." + data-live="false" + data-media-action="inline" + data-autoplay="false" + data-collection-renderstyle="VideoEmbed"> + <figcaption class="caption"> + <p class="credit credit-right" itemprop="copyrightHolder"> + Video by DENNIS OVERBYE, JONATHAN CORUM and JASON DRAKEFORD </p> + </figcaption> + </figure> + <p class="summary">Long after they have stopped communicating with Earth, the twin Voyager spacecraft will forever drift among the stars.</p> + </article> + </div> + <hr class="single-rule" /><div class="collection"> + <article class="story theme-summary" id="topnews-100000005387970" data-story-id="100000005387970" data-rank="0" data-collection-renderstyle="HpSumSmallMediaHigh"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/31/arts/television/young-sheldon-the-big-bang-theory-spinoff-cbs.html">‘Young Sheldon’ Remakes ‘The Big Bang Theory’ Formula</a></h2> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/08/31/arts/television/young-sheldon-the-big-bang-theory-spinoff-cbs.html"><img src="https://static01.nyt.com/images/2017/09/10/arts/10YOUNGSHELDON1/10YOUNGSHELDON1-thumbStandard.jpg" alt=""></a> + </div> + + <p class="byline">By JOHN KOBLIN <time class="timestamp" datetime="2017-08-31" data-eastern-timestamp="5:00 AM" data-utc-timestamp="1504170026">5:00 AM ET</time></p> + + <p class="summary"> + For the CBS prequel, co-creator Chuck Lorre abandoned the format that made him successful by instead using a single camera, voice-over narration and a child actor. </p> + + + </article> + </div> + <div class="collection"> + <style> + /*default display conditions*/ + .nythpNYRegionPromo {display: none;} + /*geocoded display conditions*/ + html.geo-dma-501 .nythpNYRegionPromo, html.geo-region-NJ .nythpNYRegionPromo {display: block;} + + .nythpNYRegionPromo { + border-top: 1px solid #e2e2e2; + margin-top: 10px; + padding-top: 10px; + } + </style> + + + <div class="nythpNYRegionPromo nygeo-promo-region region"><div> + + <article class="story theme-summary" id="topnews-100000005398183" data-story-id="100000005398183" data-rank="1" data-collection-renderstyle="HpSumSmallMediaHigh"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/nyregion/acs-legal-aid-lawyers-facebook-posts.html">Lawyers Under Scrutiny for Family Court Facebook Posts</a></h2> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/08/30/nyregion/acs-legal-aid-lawyers-facebook-posts.html"><img src="https://static01.nyt.com/images/2017/08/31/nyregion/31acs/31acs-thumbStandard.jpg" alt=""></a> + </div> + + <p class="byline">By NIKITA STEWART </p> + + <p class="summary"> + Lawyers who worked for the Legal Aid Society and the city’s child welfare agency are under review for social media posts that mocked people in Family Court in Queens. </p> + + + </article> + </div></div></div> + <hr class="single-rule" /><div class="collection"> + <style> + .nythpGeoMBPromo-AU, .nythpGeoMBPromo-EU, .nythpGeoMBPromo-AS, .nythpGeoCalTodayPromo { + display: none; + } + + html.geo-continent-AS .nythpGeoMBPromo-AS, html.geo-continent-OC .nythpGeoMBPromo-AU, html.geo-country-AU .nythpGeoMBPromo-AU, html.geo-continent-EU .nythpGeoMBPromo-EU, html.geo-continent-AF .nythpGeoMBPromo-EU, html.geo-continent-NA.geo-region-CA .nythpGeoCalTodayPromo { display: block; } + html.geo-continent-AS .nythpGeoMBPromo, html.geo-continent-OC .nythpGeoMBPromo, html.geo-country-AU .nythpGeoMBPromo, html.geo-continent-EU .nythpGeoMBPromo, html.geo-continent-AF .nythpGeoMBPromo, html.geo-continent-NA.geo-region-CA .nythpGeoMBPromo { display: none; } + + </style> + + + + + <article class="story theme-summary nythpGeoMBPromo-AU" id="topnews-100000005085460" data-story-id="100000005085460" data-rank="0" data-collection-renderstyle="HpSumMediumMediaHigh" data-start-time="" data-end-time=""> + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="https://www.nytimes.com/newsletters/morning-briefing-australia"><img src="https://static01.nyt.com/images/2017/05/08/world/asia/australia-briefing-signup01/australia-briefing-signup01-mediumFlexible177.png" alt=""></a> + </div> + </figure> + <h2 class="story-heading"><a href="https://www.nytimes.com/newsletters/morning-briefing-australia">Morning Briefing: Australia Edition</a></h2> + <p class="summary">The news and stories that matter to readers in Australia. Sign up to get it by email, Monday through Friday. </p> + + <div id="g-graphic" class="nythp-morning-briefing-email-promo notification-widget"> + <div id="morning-briefing-widget-au"></div> + </div> + + <script> + require.config({ + paths: { + 'nytint/email-subscriber' : 'https://int.nyt.com/applications/email-subscriber/client' + } + }); + + require(['foundation/main'], function() { + require(['nytint/email-subscriber'], function(Subscriber) { + Subscriber.setup({ + containerId: 'morning-briefing-widget-au', + productCode: 'MBAU', + /* elementToHideOnSubscribe: '.nythp-morning-briefing-email-promo', */ + text: {unregisteredButton: 'Sign Up', + unregisteredPlaceholder: 'Get the Morning Briefing by email.', + registeredButton: 'Sign Up', + alreadySubscribedMessage: 'You’re already subscribed.', + thanksMessage: 'You’ve signed up as %email%', + emailPreferencesLinkText: 'Update your mail preferences »', + errorMessage: 'Error submitting, please try again.', + registeredWelcome: 'Get the Morning Briefing by email.'} + }); + + setTimeout(function(){ + var widget = document.getElementById('morning-briefing-widget-au'); + var container = widget.getElementsByTagName('div')[0]; + var form = widget.getElementsByTagName('form')[0]; + var status = container.getAttribute('data-status'); + var notify = widget.getElementsByClassName('notify-email')[0]; + + if(notify !== undefined){ + + var origtext = notify.getAttribute('placeholder'); + var newtext = 'Please enter your email address'; + var button = container.getElementsByTagName('button')[0]; + + widget.setAttribute('class','clearfix'); + + notify.addEventListener('mouseover',function(){ + notify.setAttribute('placeholder',newtext); + }); + + notify.addEventListener('mouseout',function(){ + notify.setAttribute('placeholder',origtext); + }); + + notify.addEventListener('focus',function(){ + notify.setAttribute('placeholder',''); + }); + + } + + if(form !== undefined){ + notify.addEventListener('keyup',function(){ + form.setAttribute('class','dirtyform'); + }); + container.setAttribute('class','not-signedin'); + } else { + container.setAttribute('class','signedin'); + } + },2000); + + }); + }); + </script> + + </article> + + + + + <article class="story theme-summary nythpGeoMBPromo-AS" id="topnews-100000005085459" data-story-id="100000005085459" data-rank="1" data-collection-renderstyle="HpSumMediumMediaHigh" data-start-time="" data-end-time=""> + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="https://www.nytimes.com/newsletters/morning-briefing-asia"><img src="https://static01.nyt.com/images/2017/05/26/world/26asiapromo2/26asiapromo2-mediumFlexible177.jpg" alt=""></a> + </div> + </figure> + <h2 class="story-heading"><a href="https://www.nytimes.com/newsletters/morning-briefing-asia">Morning Briefing: Asia Edition</a></h2> + <p class="summary">The news and stories that matter to readers in Asia. Sign up to get it by email, Monday through Friday. </p> + + <div id="g-graphic" class="nythp-morning-briefing-email-promo notification-widget"> + <div id="morning-briefing-widget-as"></div> + </div> + + <script> + require.config({ + paths: { + 'nytint/email-subscriber' : 'https://int.nyt.com/applications/email-subscriber/client' + } + }); + + require(['foundation/main'], function() { + require(['nytint/email-subscriber'], function(Subscriber) { + Subscriber.setup({ + containerId: 'morning-briefing-widget-as', + productCode: 'MBAE', + /* elementToHideOnSubscribe: '.nythp-morning-briefing-email-promo', */ + text: {unregisteredButton: 'Sign Up', + unregisteredPlaceholder: 'Get the Morning Briefing by email.', + registeredButton: 'Sign Up', + alreadySubscribedMessage: 'You’re already subscribed.', + thanksMessage: 'You’ve signed up as %email%', + emailPreferencesLinkText: 'Update your mail preferences »', + errorMessage: 'Error submitting, please try again.', + registeredWelcome: 'Get the Morning Briefing by email.'} + }); + + setTimeout(function(){ + var widget = document.getElementById('morning-briefing-widget-as'); + var container = widget.getElementsByTagName('div')[0]; + var form = widget.getElementsByTagName('form')[0]; + var status = container.getAttribute('data-status'); + var notify = widget.getElementsByClassName('notify-email')[0]; + + if(notify !== undefined){ + + var origtext = notify.getAttribute('placeholder'); + var newtext = 'Please enter your email address'; + var button = container.getElementsByTagName('button')[0]; + + widget.setAttribute('class','clearfix'); + + notify.addEventListener('mouseover',function(){ + notify.setAttribute('placeholder',newtext); + }); + + notify.addEventListener('mouseout',function(){ + notify.setAttribute('placeholder',origtext); + }); + + notify.addEventListener('focus',function(){ + notify.setAttribute('placeholder',''); + }); + + } + + if(form !== undefined){ + notify.addEventListener('keyup',function(){ + form.setAttribute('class','dirtyform'); + }); + container.setAttribute('class','not-signedin'); + } else { + container.setAttribute('class','signedin'); + } + },2000); + + }); + }); + </script> + + + </article> + + + + + + <article class="story theme-summary nythpGeoMBPromo-EU" id="topnews-100000004906098" data-story-id="100000004906098" data-rank="2" data-collection-renderstyle="HpSumMediumMediaHigh" data-start-time="" data-end-time=""> + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="https://www.nytimes.com/newsletters/morning-briefing-europe"><img src="https://static01.nyt.com/images/2017/05/26/world/26europeanpromo2/26europeanpromo2-mediumFlexible177.jpg" alt=""></a> + </div> + </figure> + <h2 class="story-heading"><a href="https://www.nytimes.com/newsletters/morning-briefing-europe">Morning Briefing: Europe Edition</a></h2> + <p class="summary">The news and stories that matter to readers in Europe. Sign up to get it by email, Monday through Friday. </p> + <div id="g-graphic" class="nythp-morning-briefing-email-promo notification-widget"> + <div id="morning-briefing-widget-eu"></div> + </div> + + <script> + require.config({ + paths: { + 'nytint/email-subscriber' : 'https://int.nyt.com/applications/email-subscriber/client' + } + }); + + require(['foundation/main'], function() { + require(['nytint/email-subscriber'], function(Subscriber) { + Subscriber.setup({ + containerId: 'morning-briefing-widget-eu', + productCode: 'MBE', + /* elementToHideOnSubscribe: '.nythp-morning-briefing-email-promo', */ + text: {unregisteredButton: 'Sign Up', + unregisteredPlaceholder: 'Get the Morning Briefing by email.', + registeredButton: 'Sign Up', + alreadySubscribedMessage: 'You’re already subscribed.', + thanksMessage: 'You’ve signed up as %email%', + emailPreferencesLinkText: 'Update your mail preferences »', + errorMessage: 'Error submitting, please try again.', + registeredWelcome: 'Get the Morning Briefing by email.'} + }); + + setTimeout(function(){ + var widget = document.getElementById('morning-briefing-widget-eu'); + var container = widget.getElementsByTagName('div')[0]; + var form = widget.getElementsByTagName('form')[0]; + var status = container.getAttribute('data-status'); + var notify = widget.getElementsByClassName('notify-email')[0]; + + if(notify !== undefined){ + + var origtext = notify.getAttribute('placeholder'); + var newtext = 'Please enter your email address'; + var button = container.getElementsByTagName('button')[0]; + + widget.setAttribute('class','clearfix'); + + notify.addEventListener('mouseover',function(){ + notify.setAttribute('placeholder',newtext); + }); + + notify.addEventListener('mouseout',function(){ + notify.setAttribute('placeholder',origtext); + }); + + notify.addEventListener('focus',function(){ + notify.setAttribute('placeholder',''); + }); + + } + + if(form !== undefined){ + notify.addEventListener('keyup',function(){ + form.setAttribute('class','dirtyform'); + }); + container.setAttribute('class','not-signedin'); + } else { + container.setAttribute('class','signedin'); + } + },2000); + + }); + }); + </script> + + </article> + + + <!-- California Today --> + + <article class="story theme-summary nythpGeoCalTodayPromo" data-rank="2" data-collection-renderstyle="HpSumMediumMediaHigh" data-start-time="" data-end-time=""> + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="http://www.nytimes.com/newsletters/california-today"><img src="https://static01.nyt.com/packages/images/email/assets/california_news.jpg" alt=""></a> + </div> + </figure> + <h2 class="story-heading"><a href="http://www.nytimes.com/newsletters/california-today">California Today</a></h2> + <p class="summary">The news and stories that matter to Californians, delivered weekday mornings.</p> + + + <div id="g-graphic" class="nythp-morning-briefing-email-promo notification-widget"> + <div id="california-today-widget"></div> + </div> + + <script> + require.config({ + paths: { + 'nytint/email-subscriber' : 'https://int.nyt.com/applications/email-subscriber/client' + } + }); + + require(['foundation/main'], function() { + require(['nytint/email-subscriber'], function(Subscriber) { + Subscriber.setup({ + containerId: 'california-today-widget', + productCode: 'CA', + /* elementToHideOnSubscribe: '.nythp-morning-briefing-email-promo', */ + text: {unregisteredButton: 'Sign Up', + unregisteredPlaceholder: 'Get California Today by email.', + registeredButton: 'Sign Up', + alreadySubscribedMessage: 'You’re already subscribed.', + thanksMessage: 'You’ve signed up as %email%', + emailPreferencesLinkText: 'Update your mail preferences »', + errorMessage: 'Error submitting, please try again.', + registeredWelcome: 'Get California Today by email.'} + }); + + setTimeout(function(){ + var widget = document.getElementById('california-today-widget'); + var container = widget.getElementsByTagName('div')[0]; + var form = widget.getElementsByTagName('form')[0]; + var status = container.getAttribute('data-status'); + var notify = widget.getElementsByClassName('notify-email')[0]; + + if(notify !== undefined){ + + var origtext = notify.getAttribute('placeholder'); + var newtext = 'Please enter your email address'; + var button = container.getElementsByTagName('button')[0]; + + widget.setAttribute('class','clearfix'); + + notify.addEventListener('mouseover',function(){ + notify.setAttribute('placeholder',newtext); + }); + + notify.addEventListener('mouseout',function(){ + notify.setAttribute('placeholder',origtext); + }); + + notify.addEventListener('focus',function(){ + notify.setAttribute('placeholder',''); + }); + + } + + if(form !== undefined){ + notify.addEventListener('keyup',function(){ + form.setAttribute('class','dirtyform'); + }); + container.setAttribute('class','not-signedin'); + } else { + container.setAttribute('class','signedin'); + } + },2000); + + }); + }); + </script> + </article> + + <article class="story theme-summary nythpGeoMBPromo" id="topnews-100000004906098" data-story-id="100000004906098" data-rank="2" data-collection-renderstyle="HpSumMediumMediaHigh" data-start-time="" data-end-time=""> + <figure class="media photo medium-thumb"> + <div class="image"> + <a href="https://www.nytimes.com/newsletters/morning-briefing"><img src="https://static01.nyt.com/images/2017/05/25/us/25usbriefing/25usbriefing-mediumFlexible177-v2.jpg" alt=""></a> + </div> + </figure> + <h2 class="story-heading"><a href="https://www.nytimes.com/newsletters/morning-briefing">Morning Briefing</a></h2> + <p class="summary">The news and stories that matter. Delivered to your inbox Monday through Friday.</p> + + + <div id="g-graphic" class="nythp-morning-briefing-email-promo notification-widget"> + <div id="morning-briefing-widget"></div> + </div> + + <script> + require.config({ + paths: { + 'nytint/email-subscriber' : 'https://int.nyt.com/applications/email-subscriber/client' + } + }); + + require(['foundation/main'], function() { + require(['nytint/email-subscriber'], function(Subscriber) { + Subscriber.setup({ + containerId: 'morning-briefing-widget', + productCode: 'NN', + /* elementToHideOnSubscribe: '.nythp-morning-briefing-email-promo', */ + text: {unregisteredButton: 'Sign Up', + unregisteredPlaceholder: 'Get the Morning Briefing by email.', + registeredButton: 'Sign Up', + alreadySubscribedMessage: 'You’re already subscribed.', + thanksMessage: 'You’ve signed up as %email%', + emailPreferencesLinkText: 'Update your mail preferences »', + errorMessage: 'Error submitting, please try again.', + registeredWelcome: 'Get the Morning Briefing by email.'} + }); + + setTimeout(function(){ + var widget = document.getElementById('morning-briefing-widget'); + var container = widget.getElementsByTagName('div')[0]; + var form = widget.getElementsByTagName('form')[0]; + var status = container.getAttribute('data-status'); + var notify = widget.getElementsByClassName('notify-email')[0]; + + if(notify !== undefined){ + + var origtext = notify.getAttribute('placeholder'); + var newtext = 'Please enter your email address'; + var button = container.getElementsByTagName('button')[0]; + + widget.setAttribute('class','clearfix'); + + notify.addEventListener('mouseover',function(){ + notify.setAttribute('placeholder',newtext); + }); + + notify.addEventListener('mouseout',function(){ + notify.setAttribute('placeholder',origtext); + }); + + notify.addEventListener('focus',function(){ + notify.setAttribute('placeholder',''); + }); + + } + + if(form !== undefined){ + notify.addEventListener('keyup',function(){ + form.setAttribute('class','dirtyform'); + }); + container.setAttribute('class','not-signedin'); + } else { + container.setAttribute('class','signedin'); + } + },2000); + + }); + }); + </script> + </article> + + </div> + + </div><!-- close second-column-region --> + + + </div><!-- close b-column --> + + </div><!-- close wide-b-layout --> + + <div class="bottom-span-promo-region region"> + <div class="collection"> + <style> + /*default display conditions*/ + #span-ab-bottom-au-region { + /*display: none;*/ + display: block; + position: absolute; + visibility: hidden; + } + #span-ab-bottom-region .column.column-au-region { + /*display: none;*/ + display: block; + position: absolute; + visibility: hidden; + } + /*geocoded display conditions*/ + html.geo-country-AU #span-ab-bottom-region .column {display: none;} + html.geo-country-AU #span-ab-bottom-region .column.column-au-region { + display: block; + position: inherit; + visibility: visible; + } + + .span-ab-layout .ab-column .split-3-layout .column:nth-of-type(1), + .span-ab-layout .ab-column .split-3-layout .column:nth-of-type(4) { + padding-left: 0; + } + + .span-ab-layout .ab-column .split-3-layout .column:last-child, + .span-ab-layout .ab-column .split-3-layout .column:nth-of-type(3), + .span-ab-layout .ab-column .split-3-layout .column:nth-of-type(6) { + border-right: none; + padding-right: 0px; + } + + #span-ab-bottom-region .section-heading-au-region { display: none; } + html.geo-country-AU #span-ab-bottom-region .section-heading { display: none; } + html.geo-country-AU #span-ab-bottom-region .section-heading-au-region { + display: block; + text-align: center; + } + html.geo-country-AU #span-ab-bottom-region .section-heading-au-region h2.section-heading { + display: inline-block; + color: #000; + font-family: "nyt-franklin",helvetica,arial,sans-serif; + text-transform: uppercase; + font-size: 12px; + font-weight: 700; + letter-spacing: .5px; + border-bottom: 2px solid #ccc; + line-height: 15px; + } + html.geo-country-AU #span-ab-bottom-region .section-heading-au-region h2.section-heading:hover, + html.geo-country-AU #span-ab-bottom-region .section-heading-au-region h2.section-heading:active { + border-color: #222222; + } + + html.geo-country-AU #span-ab-bottom-region .section-heading a { + text-decoration: none; + color: #000; + } + </style> + + <script> + require(['foundation/main'], function() { + require(['jquery/nyt', 'underscore/nyt'], function($, _) { + $("#span-ab-bottom-region div.split-3-layout").append($("#span-ab-bottom-au-region div.split-3-layout > div.column").addClass("column-au-region").remove()); + $("#span-ab-bottom-region div.split-3-layout").prepend($('<span class="section-heading-au-region"><h2 class="section-heading"><a href="https://www.nytimes.com/section/world/australia">Australia Picks</a></h2></span>')); + var auHeight = _.max($("#span-ab-bottom-region div.split-3-layout .column.column-au-region article").map(function(i, el) { return $(el).height(); })); + $("#span-ab-bottom-region div.split-3-layout .column.column-au-region").css({"min-height": (auHeight+6)+"px"}); + }) }) + </script> + + + <div id="span-ab-bottom-au-region" class="span-ab-bottom-region-au region"><div> + <hr class="scotch-rule"> + <div class="split-3-layout layout theme-base"><div> + + </div> + <h2 class="section-heading"> + </h2> + <div class="column"> + <article class="story theme-summary " id="topnews-100000005399553" data-story-id="100000005399553" data-rank="0" data-collection-renderstyle="HPMediumMediaHedSumDaypart"> + <a href="https://www.nytimes.com/2017/08/30/world/australia/australia-same-sex-marriage-tv-ad.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/world/australia/31oz-marriage/31oz-marriage-mediumThreeByTwo210.jpg" /> + </div> + </a> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/world/australia/australia-same-sex-marriage-tv-ad.html">What’s Going On in an Australian TV Ad Opposing Gay Marriage?</a> + </h2> + <p class="summary"> + The campaign to vote “no” on legalizing same-sex marriage tries to refocus the debate on the welfare of children. </p> + </article> + </div> + <div class="column"> + <article class="story theme-summary " id="topnews-100000005397818" data-story-id="100000005397818" data-rank="1" data-collection-renderstyle="HPMediumMediaHedSumDaypart"> + <a href="https://www.nytimes.com/2017/08/29/world/asia/sea-shepherd-whaling-japan.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/world/29seashepherd/29seashepherd-mediumThreeByTwo210.jpg" /> + </div> + </a> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/world/asia/sea-shepherd-whaling-japan.html">Sea Shepherd Activists Halt Pursuit of Japanese Whalers</a> + </h2> + <p class="summary"> + The group has called off its annual pursuit of Japanese ships in the protected Southern Ocean, saying it can’t compete with the country’s surveillance. </p> + </article> + </div> + <div class="column"> + <article class="story theme-summary " id="topnews-100000005396021" data-story-id="100000005396021" data-rank="2" data-collection-renderstyle="HPMediumMediaHedSumDaypart"> + <a href="https://www.nytimes.com/2017/08/29/science/trigonometry-babylonian-tablet.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/29/science/29TB-BABYLON1/29TB-BABYLON1-mediumThreeByTwo210.jpg" /> + </div> + </a> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/science/trigonometry-babylonian-tablet.html">Hints of Trigonometry on a 3,700-Year-Old Babylonian Tablet</a> + </h2> + <p class="summary"> + Scholars have debated for decades the purpose of 60 numbers written on a small clay tablet. Two Australian mathematicians believe they have figured it out. </p> + </article> + </div> + <div class="collection"> + </div></div></div></div></div> + </div><!-- close bottom-span-promo-region --> + + <div id="span-ab-bottom-region" class="span-ab-bottom-region region"> + <hr class="scotch-rule" /> + <div class="split-3-layout layout theme-base"> + <h2 class="section-heading"> + </h2> + <div class="column"> + <article class="story theme-summary " id="topnews-100000005395156" data-story-id="100000005395156" data-rank="0" data-collection-renderstyle="HPMediumMediaHedSumDaypart"> + <a href="https://www.nytimes.com/2017/08/30/sports/olympics/munich-olympic-massacre-1972-memorial-israeli-athletes.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/multimedia/30MUNIC-alpha/30MUNICweb2-mediumThreeByTwo210.jpg" /> + </div> + </a> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/sports/olympics/munich-olympic-massacre-1972-memorial-israeli-athletes.html">In Munich, a Tribute to Israeli Athletes</a> + </h2> + <p class="summary"> + “There are no happier people, no more satisfied people, than us,” said the wife of a victim who pressed for a worthy memorial. </p> + </article> + </div> + <div class="column"> + <article class="story theme-summary " id="topnews-100000005399019" data-story-id="100000005399019" data-rank="1" data-collection-renderstyle="HPMediumMediaHedSumDaypart"> + <a href="https://www.nytimes.com/interactive/2017/08/31/travel/what-to-do-36-hours-in-glasgow-scotland.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/travel/31HOURS-GLASGOW1/31HOURS-GLASGOW1-mediumThreeByTwo210.jpg" /> + <div class="media-action-overlay"> + <i class="icon sprite-icon icon-media-interactive-16x16-ffffff"></i> + </div> + </div> + </a> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/interactive/2017/08/31/travel/what-to-do-36-hours-in-glasgow-scotland.html">36 Hours in Glasgow</a> + </h2> + <p class="summary"> + This historic city, known for its Art Nouveau flourishes, also has a blossoming modern side, with daring new buildings and bars. </p> + </article> + </div> + <div class="column"> + <article class="story theme-summary " id="topnews-100000005367249" data-story-id="100000005367249" data-rank="2" data-collection-renderstyle="HPMediumMediaHedSumDaypart"> + <a href="https://www.nytimes.com/2017/08/31/books/review/jesmyn-ward-by-the-book.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/09/03/books/review/0903-BKS-ByTheBook/0903-BKS-ByTheBook-mediumThreeByTwo210-v3.jpg" /> + </div> + </a> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/31/books/review/jesmyn-ward-by-the-book.html">Jesmyn Ward: By the Book</a> + </h2> + <p class="summary"> + The author of, most recently, “Sing, Unburied, Sing” is a self-described “reading glutton.” </p> + </article> + </div> + </div> + </div><!-- close span-ab-bottom-region --> + + </section><!-- close top-news --> + + </div><!-- close ab-column --> + + <div class="c-column column"> + + <div id="Middle" class="ad middle-ad hidden nocontent robots-nocontent"></div> + + <div class="region c-column-top-span-region"> + + + </div><!-- close c-column-top-span-region --> + + <section class="opinion"> + + <div class="region opinion-c-col-top-region"> + <div class="collection"> + <section class="opinion"> + <h2 class="section-heading"><a href="http://www.nytimes.com/pages/opinion/index.html">The Opinion Pages</a> + </h2> + </section></div> + </div> <!-- close opinion-c-col-top-region --> + + <div class="layout split-layout"> + + <div class="column"> + <div class="region opinion-c-col-left-region"> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005396602" data-story-id="100000005396602" data-rank="0" data-collection-renderstyle="HpSumXSMedia"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/31/opinion/trump-north-korea.html">What Trump Meant to Say</a></h2> + + <div class="small-thumb"> + <a href="https://www.nytimes.com/2017/08/31/opinion/trump-north-korea.html"><img src="https://static01.nyt.com/images/2017/09/01/world/01blinken-inyt/01blinken-inyt-blogSmallThumb.jpg" alt=""></a> + </div> + + <p class="byline">By ANTONY J. BLINKEN </p> + + <p class="summary"> + The president’s rogue-cop routine has serious foreign policy consequences. </p> + + + </article> + + </div> + <div class="collection headlines"> + <ul class="theme-news-headlines"> + <li> + <article class="story" id="topnews-100000005400536" data-story-id="100000005400536" data-rank="0" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/31/opinion/voting-reform-illinois-texas.html">Editorial: On Voting Reforms, Follow Illinois, Not Texas</a> </h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005401080" data-story-id="100000005401080" data-rank="1" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/31/opinion/trump-harvey-storm-army.html">Blow: Trump Raises an Army</a> <time class="timestamp" datetime="2017-08-31" data-eastern-timestamp="3:21 AM" data-utc-timestamp="1504164084">3:21 AM ET</time></h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005401128" data-story-id="100000005401128" data-rank="2" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/interactive/2017/08/31/opinion/columnists/yemen-famine-cholera.html">Kristof: The Photos the U.S. and Saudi Arabia Don’t Want You to See</a> </h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005400586" data-story-id="100000005400586" data-rank="3" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/31/opinion/hurricanes-climate-capitalists-wealth-.html">Stephens: Hurricanes, Climate and the Capitalist Offset</a> <time class="timestamp" datetime="2017-08-31" data-eastern-timestamp="3:21 AM" data-utc-timestamp="1504164083">3:21 AM ET</time></h2> + </article> + </li> + </ul> + </div> + <div class="collection headlines"> + <ul class="theme-news-headlines"> + <li> + <article class="story" id="topnews-100000003665755" data-story-id="100000003665755" data-rank="0" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.facebook.com/nytopinion">Join us on Facebook »</a> </h2> + </article> + </li> + </ul> + </div> + </div> + </div> + + <div class="column"> + <div class="region opinion-c-col-right-region"> + <div class="collection"> + <article class="story theme-summary" id="topnews-100000005398365" data-story-id="100000005398365" data-rank="0" data-collection-renderstyle="HpSumXSMedia"> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/31/opinion/america-nuclear-buildup.html">Risky Nuclear Buildup</a></h2> + + <div class="small-thumb"> + <a href="https://www.nytimes.com/2017/08/31/opinion/america-nuclear-buildup.html"><img src="https://static01.nyt.com/images/2017/08/31/opinion/31rollo/31rollo-blogSmallThumb.jpg" alt=""></a> + </div> + + <p class="byline">By STUART ROLLO <time class="timestamp" datetime="2017-08-31" data-eastern-timestamp="3:21 AM" data-utc-timestamp="1504164083">3:21 AM ET</time></p> + + <p class="summary"> + It’s not just North Korea. Plans to upgrade America’s nuclear arsenal are also contributing to global instability. </p> + + + </article> + + </div> + <div class="collection headlines"> + <ul class="theme-news-headlines"> + <li> + <article class="story" id="topnews-100000005399880" data-story-id="100000005399880" data-rank="0" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/opinion/texas-farmers-floods-planning.html">A Texas Farmer on Harvey, Bad Planning and Runaway Growth</a> </h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005400373" data-story-id="100000005400373" data-rank="1" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/opinion/google-influence-think-tanks.html">Google’s Disturbing Influence Over Think Tanks</a> </h2> + </article> + </li> + <li> + <article class="story" id="topnews-100000005400487" data-story-id="100000005400487" data-rank="2" data-collection-renderstyle="HpHeadline"> + <h2 class="story-heading"><i class="icon"></i><a href="https://www.nytimes.com/2017/08/30/opinion/trump-osteen-harvey-church.html">The Cheap Prosperity Gospel of Trump and Osteen</a> </h2> + </article> + </li> + </ul> + </div> + </div> + </div> + + </div> <!-- close split-layout --> + + <div class="region opinion-c-col-bottom-region"> + <div class="collection"> + <style> + + + .c-column.column section.opinion div time.timestamp{ + display:none; + } + + + </style><style> + .c-column.column section.opinion div p.theme-comments{ + display:none; + } + + + + </style></div> + </div> <!-- close opinion-c-col-bottom-region --> + + </section> <!-- close opinion --> + + <section class="user-subscriptions"> + + <h2 class="section-heading visually-hidden">User Subscriptions</h2> + + <div class="collection insider-collection"> + <div id="times-insider-subscription" class="times-insider-subscription hidden"> + <ul class="theme-news-headlines"> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/26/insider/syphilis-health-investigators-sisterhood-of-sleuths.html">A Sisterhood of Sleuths</a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/insider/the-sodden-haunted-fields-of-flanders.html">The Sodden, Haunted Fields of Flanders</a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/25/insider/solar-eclipse-carbondale.html">Seeing the Total Eclipse Through 28,000 Eyes</a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/24/insider/dale-chihuly-glass-artist-creativity.html">A Journalist Glimpses the Tools of an Artist’s Creativity</a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/module/insider-events"></a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/07/28/insider/events/cryptoparty-data-security-new-york-times.html">Live Event: Discussing Data Protection at a New York Times ‘CryptoParty’</a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/09/insider/events/live-event-fall-preview-at-joes-pub.html">Live Event: ‘Fall Preview’ at Joe’s Pub</a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/07/14/insider/events/health-care-conference-call-what-does-policy-actually-mean-for-your-health.html">Live Event: What Do Policy Changes Actually Mean for Your Health?</a> + </h2> + </article> + </li> + <li> + <article class="story"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/06/20/insider/events/new-york-times-podcast-club.html">Live Event: The New York Times Podcast Club</a> + </h2> + </article> + </li> + </ul> + <div class="thumb"> + <a href="https://www.nytimes.com/section/insider"> + <svg class="insider-logo" width="65" height="20" role="img" aria-label="Insider"> + <image width="65" height="20" xlink:href="https://a1.nyt.com/assets/homepage/20170810-135137/images/foundation/logos/insider-logo-240x72.svg" src="https://a1.nyt.com/assets/homepage/20170810-135137/images/foundation/logos/insider-logo-240x72.png" alt="Insider" /> + </svg> + </a> + </div> + </div><!--close times-insider-subscription --> + </div><!-- close collection --> + + <div class="collection"> + <div id="times-premier-crossword-subscription" class="times-premier-crossword-subscription hidden"> + <div class="layout split-layout"> + <div class="column"> + <div class="collection insider-collection"> + <article class="story"> + <h3 class="kicker"> + <a href="https://www.nytimes.com/section/insider">Times Insider »</a> + </h3> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/26/insider/syphilis-health-investigators-sisterhood-of-sleuths.html">A Sisterhood of Sleuths</a> + </h2> + </article> + </div> + </div><!-- close column --> + <div class="column"> + <div class="collection crosswords-collection"> + <article class="story"> + <h3 class="kicker"> + <a href="https://www.nytimes.com/crosswords">The Crossword »</a> + </h3> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/crosswords">Play Today’s Puzzle </a> + </h2> + <div class="thumb"> + <a href="https://www.nytimes.com/crosswords"> + <img src="https://static01.nyt.com/images/crosswords/crosswords_30x30.png" alt="" /> + </a> + </div> + </article> + </div> + </div> + </div><!--close TimesPremiercrossword --> + </div><!--close times-premier-crossword-subscription --> + </div><!-- close collection --> + + <div class="collection"> + <div id="crossword-subscription" class="crossword-subscription hidden"> + <div class="layout split-layout"> + <div class="column"> + <div class="collection crosswords-collection"> + <article class="story"> + <h3 class="kicker"> + <a href="https://www.nytimes.com/crosswords">The Crossword »</a> + </h3> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/crosswords">Play Today’s Puzzle </a> + </h2> + <div class="thumb"> + <a href="https://www.nytimes.com/crosswords"> + <img src="https://static01.nyt.com/images/crosswords/crosswords_30x30.png" alt="" /> + </a> + </div> + </article> + </div> + </div> + <div class="column"> + <div class="collection crosswords-collection"> + <article class="story"> + <h3 class="kicker"> + <a href="http://wordplay.blogs.nytimes.com">Wordplay »</a> + </h3> + </article> + </div> + </div><!-- close column --> + </div><!-- close layout --> + </div><!-- close crossword-subscription --> + </div><!--close collection --> + + </section><!-- close user-subscriptions --> + + <div id="HPMiddle" class="ad hpmiddle-ad nocontent robots-nocontent"></div> + + <div class="region c-column-middle-span-region"> + + <div class="collection"> + <link rel="stylesheet" type="text/css" href="https://int.nyt.com/apps/portals/assets/portal-6d57ae10010ddcfe80e975e769c6947e.css"/> + + <style type="text/css"> + /*HIDE WATCHING HEADER*/ + .portal-container>header { display: none } + </style> + + <div id="nytint-hp-watching"> + <div class="portal-container"> + <header class="portal-header"> + <h4>Watching</h4> + </header> + <div class="portal-posts-frame expanded"></div> + <footer class="portal-footer"></footer> + </div> + </div> + + <script type="text/javascript"> + require(['foundation/main'], function() { + require(['homepage/main', 'https://int.nyt.com/apps/portals/assets/portal/app-31573ba689b023d9e52c26c6d6aa32ab.js' + ], function() { + require(['portal/app'], function(Portal) { + + var opts = { + env: 'production_published', + matchHeight: { + match: '.span-ab-layout.layout > .ab-column', + container: '.c-column.column', + maxHeight: 2000 + } + } + + if (window.location.search.indexOf('portal_variant=watchingNoScroll') !== -1) { + opts.variation = 'simple'; + opts.poll = false; + opts.limit = 20; + } + + var watching = Portal.create('#nytint-hp-watching', opts); + }); + }); + }); + </script> + + <!-- HpPrototype: WatchingEnabled: DO NOT REMOVE --> + </div> + + </div><!-- close c-column-middle-span-region --> + + <div class="region c-column-above-moth-fixed-region"> + + + </div><!-- close c-column-above-moth-fixed-region --> + + <div class="region c-column-above-moth-region"> + + + </div><!-- close c-column-above-moth-region --> + + </div><!-- close c-column --> + + </div><!-- close span-ab-layout --> + + <section id="paid-post-five-pack" class="paid-post-five-pack hidden nocontent robots-nocontent"> + <h2 class="section-heading">From Our Advertisers</h2> + <ul class="story-menu"> + <li id="PaidPostFivePack1" class="story-menu-item ad"></li> + <li id="PaidPostFivePack2" class="story-menu-item ad"></li> + <li id="PaidPostFivePack3" class="story-menu-item ad"></li> + <li id="PaidPostFivePack4" class="story-menu-item ad"></li> + <li id="PaidPostFivePack5" class="story-menu-item ad"></li> + </ul> + </section> + <div id="HPBreak" class="ad hpbreak-ad nocontent robots-nocontent hidden"></div> + + <div id="video-player-region" class="video-player-region region"> + <div class="collection"> + <div id="video-module-loader" class="loader-container video-section-loader-container"> + <div class="loader loader-t-logo-32x32-ecedeb-ffffff"><span class="visually-hidden">Loading...</span></div> + </div> + <section id="video-section" + class="video-section invisible" + data-playlist-id="1194811622188" + data-api-token="cE97ArV7TzqBzkmeRVVhJ8O6GWME2iG_bRvjBTlNb4o." + data-player-id="2640832222001" + data-publisher-id="1749339200"> + <header class="section-header"> + <h2 class="section-heading"><a class="times-video-link" href="https://www.nytimes.com/video">times<span>video</span></a></h2> + <a href="https://www.nytimes.com/video?src=vidm" class="user-action explore-all-videos-link"> explore all videos »</a> + </header> + <div class="column a-column"> + <article class="story"> + <figure class="media video video-player" aria-label="media" role="group"> + <span class="visually-hidden">Video Player</span> + <img src="" class="poster" alt="" /> + <div class="video-player-container"></div> + <div class="media-action-overlay"></div> + <div class="sharetools video-sharetools" + data-shares="email|,facebook|,twitter|,embed|,show-all|" + data-url="" + data-title="" + data-description="" + data-content-type="video"> + </div> + <figcaption class="credit"></figcaption> + </figure> + </article> + </div> + <div class="column b-column"> + <div id="video-playlist-container" class="video-playlist-container"> + <ul id="video-playlist" class="video-playlist"></ul> + </div> + </div> <!-- end b-column --> + </section> + </div> + </div><!-- close video-player-region --> + + <section class="inside-nyt"> + <div class="inside-nyt-region region"> + <h2 class="section-heading">Inside Nytimes.com</h2> + <div id="inside-nyt-browser" class="inside-nyt-browser"> + <div class="navigation-control"> + <button class="button previous deactivated"> + <div class="arrow arrow-left"> + <span class="visually-hidden">Go to the previous story</span> + <div class="arrow-conceal"></div> + </div> + </button> + <button class="button next"> + <div class="arrow arrow-right"> + <span class="visually-hidden">Go to the next story</span> + <div class="arrow-conceal"></div> + </div> + </button> + </div> + <div class="carousel"> + <ol class="menu layout-horizontal theme-story"> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/section/theater">Theater</a></h2> + + <article class="story theme-summary" data-story-id="100000005387208" data-rank="0" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/theater/oh-my-sweet-land-amir-nizar-zuabi.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/09/03/arts/27SWEETLAND1/27SWEETLAND1-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">The Kitchen Is Her Stage</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/pages/opinion/index.html">Opinion</a></h2> + + <article class="story theme-summary" data-story-id="100000005396481" data-rank="1" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/29/opinion/transgender-trump-chelsea-manning.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/29/opinion/29kirchickWeb/29kirchickWeb-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">When Transgender Trumps Treachery</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/section/technology">Technology</a></h2> + + <article class="story theme-summary" data-story-id="100000005396461" data-rank="2" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/technology/doxxing-protests.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/business/30DOXXING5/30DOXXING5-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">How ‘Doxxing’ Became a Tool</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/pages/dining/index.html">Food</a></h2> + + <article class="story theme-summary" data-story-id="100000005388364" data-rank="3" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://cooking.nytimes.com/recipes/12965-spaghetti-carbonara"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2013/12/17/dining/recipes-spaghetticarbonara-copy/recipes-spaghetticarbonara-copy-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">How to Make the Best Spaghetti Carbonara</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/pages/opinion/index.html">Opinion</a></h2> + + <article class="story theme-summary" data-story-id="100000005397970" data-rank="4" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/29/opinion/harvey-houston-schools-teachers.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/29/opinion/29danielsSub/29danielsSub-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">I Teach in Houston. I’m Worried for My Students.</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/section/science">Science</a></h2> + + <article class="story theme-summary" data-story-id="100000005398035" data-rank="5" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/science/nova-stars-korea.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/science/31TB-NOVA1/31TB-NOVA1-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">The Mystery of a Vanished Star</h2> + </a> + </article> + + </section> + </li> + + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/section/arts/design">Art & Design</a></h2> + + <article class="story theme-summary" data-story-id="100000005391869" data-rank="0" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/arts/design/berkshires-elizabeth-king-helen-frankenthaler-clark-art-mass-moca.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/09/01/arts/01BERKSHIRETOUR1/01BERKSHIRETOUR1-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">Berkshire Tour of Art</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/pages/opinion/index.html">Opinion</a></h2> + + <article class="story theme-summary" data-story-id="100000005396484" data-rank="1" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/opinion/corporate-tax-cuts-jobs.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/opinion/30anderson/30anderson-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">The Corporate Tax Cut Myth</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/spotlight/times-tips">Smarter Living</a></h2> + + <article class="story theme-summary" data-story-id="100000005390050" data-rank="2" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/smarter-living/how-to-deal-with-all-the-bites-and-stings-of-summer.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/24/smarter-living/24Bites-smarterLiving-slide-21DI/24Bites-smarterLiving-slide-21DI-mediumSquare149-v2.jpg" alt=""> + </div> + <h2 class="story-heading">How to Deal With the Stings of Summer</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/section/fashion">Fashion & Style</a></h2> + + <article class="story theme-summary" data-story-id="100000005396095" data-rank="3" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/fashion/labor-day-weekend-sales-openings.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/fashion/31SCOUTING1combo/31SCOUTING1combo-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">Finding Labor Day Weekend’s Best Sales</h2> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/pages/opinion/index.html">Opinion</a></h2> + + <article class="story theme-summary no-thumb" data-story-id="100000005399960" data-rank="4" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/opinion/washington-remains-united-behind-nato.html"> + <h2 class="story-heading">Washington Remains United Behind NATO</h2> + <p class="summary">There is a strong consensus that a renaissance of NATO offers the best hope to confront our current threats.</p> + </a> + </article> + + </section> + </li> + <li> + <section> + <h2 class="section-heading"><a href="https://www.nytimes.com/section/us">U.S.</a></h2> + + <article class="story theme-summary" data-story-id="100000005399999" data-rank="5" data-collection-renderstyle="Moth"> + <a class="story-link" href="https://www.nytimes.com/2017/08/30/us/fire-ants-harvey-hurricane-storm.html"> + <div class="wide-thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/us/31xp-fireants/merlin-to-scoop-126550571-982068-mediumSquare149.jpg" alt=""> + </div> + <h2 class="story-heading">Hazard in Houston? Fire Ants</h2> + </a> + </article> + + </section> + </li> + + </ol> + </div> + </div> + </div> + </section> + + <div id="HPMidLeader" class="ad hpmidleader-ad nocontent robots-nocontent"></div> + + <div class="span-ab-layout layout"> + + <div class="ab-column column"> + + <hr class="scotch-rule" /> + + <section class="well"> + <div class="region well-region"> + <h2 class="section-heading visually-hidden">Sections</h2> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/world/index.html">World »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005392389" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/world/canada/canada-climate-change-arctic.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/world/americas/31CanadaChurchill1/churchill-slide-GEXA-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Churchill Journal: Canadian Town, Isolated After Losing Rail Link, ‘Feels Held Hostage’ </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005399498" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/world/asia/north-korea-south-korea-missile-pictures-bomb.html"> + After Missile Tests, North and South Korea Wage War of Pictures </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005401178" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/world/americas/brazil-amazon-mining-temer-environmentalists-judge.html"> + Brazilian Judge Stymies Plan to Allow Mining in Amazon Region </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/business/index.html">Business Day »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005399538" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/technology/personaltech/future-smartphone-camera-augmented-reality.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/business/31techfix/31techfix-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Tech Fix: The Smartphone’s Future: It’s All About the Camera </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005400786" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/health/gene-therapy-cancer.html"> + F.D.A. Approves First Gene-Altering Leukemia Treatment, Costing $475,000 </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005396254" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/business/media/nfl-six-second-commercials.html"> + Six-Second Commercials Are Coming to N.F.L. Games on Fox </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/opinion/index.html">Opinion »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005400487" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/opinion/trump-osteen-harvey-church.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/opinion/30butlerWeb/30butlerWeb-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Op-Ed Contributor: The Cheap Prosperity Gospel of Trump and Osteen </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005400536" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/31/opinion/voting-reform-illinois-texas.html"> + Editorial: On Voting Reforms, Follow Illinois, Not Texas </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005401080" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/31/opinion/trump-harvey-storm-army.html"> + Charles M. Blow: Trump Raises an Army </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/us">U.S. »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005401006" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/us/small-towns-harvey.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/us/31towns4/31towns4-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + As Houston Looks to Recover, Small Towns Now Bear the Brunt </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005401457" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/interactive/2017/08/30/us/houston-flood-rescue-cries-for-help.html"> + Thousands Cried for Help as Houston Flooded </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005399973" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/us/port-arthur-flooding.html"> + Port Arthur Faces Harvey Flooding Disaster: ‘Our Whole City Is Underwater’ </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/technology/index.html">Technology »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005399538" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/technology/personaltech/future-smartphone-camera-augmented-reality.html"> + + + <h3 class="story-heading"> + Tech Fix: The Smartphone’s Future: It’s All About the Camera </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005396461" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/technology/doxxing-protests.html"> + How ‘Doxxing’ Became a Mainstream Tool in the Culture Wars </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005393341" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/technology/kalanick-benchmark-uber-delaware.html"> + Kalanick’s Feud With Benchmark Goes to Arbitration for Now, Judge Rules </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/arts/index.html">Arts »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005385152" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/arts/design/maiolino-museum-of-contemporary-art.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/09/01/arts/01MAIOLINO1/01MAIOLINO1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + art review: Weekend in Los Angeles: That Touch of Brazil </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005398883" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/arts/television/uk-gbbo-great-british-bake-off-channel-4.html"> + ‘Great British Bake Off’ Is Still a Treat for Many Viewers </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005399033" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/books/review-cuz-danielle-allen.html"> + Books of The Times: ‘Cuz’ Mourns a Loss and Denounces a System </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/politics/index.html">Politics »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005401238" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/us/politics/us-aid-pakistan-terror.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/us/31dc-diplo/31dc-diplo-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + U.S. Gives Military Assistance to Pakistan, With Strings Attached </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005401018" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/us/politics/trump-obamacare-enrollment-markets-subsidies.html"> + Trump Administration Wants to Stabilize Health Markets but Won’t Say How </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005400924" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/us/politics/hurricane-sandy-relief-fact-check.html"> + Fact Check: Was 2013 Hurricane Sandy Relief Package ‘Full of Pork’? </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/fashion">Fashion & Style »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005398042" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/31/fashion/jean-paul-goude-desigual.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/fashion/31UNBUTTONED-1/31UNBUTTONED-1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Unbuttoned: Desigual Turns to Jean-Paul Goude for a Makeover </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005396488" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/fashion/uncle-brother-catskills-gavin-brown.html"> + A Catskills Art Scene Makes a Splash With Free Curry </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005373132" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/fashion/aura-photography-radiant-human.html"> + Me Time: Aura Photographs: Selfies for the New Age Set </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/movies">Movies »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005389037" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/29/movies/amid-gung-ho-mentality-stunt-deaths-renew-a-debate-over-safety.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/arts/29STUNT3/29STUNT3-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Amid ‘Gung-Ho Mentality,’ Stunt Deaths Renew a Debate Over Safety </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005364809" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/28/movies/venice-film-festival-opening-stars-matt-damon-kristen-wiig.html"> + Venice Film Festival Opening Stars Matt Damon and Kristen Wiig </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005395796" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/28/movies/texas-chain-saw-massacre-tobe-hooper-appraisal.html"> + An Appraisal: In ‘Texas Chain Saw Massacre,’ Sympathy for the Devil </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/nyregion">New York »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005386266" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/31/nyregion/new-york-today-hurricanes-in-nyc-harvey-tropical-storm.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/nyregion/31NYTODAY1/31NYTODAY1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + New York Today: New York Today: Reflecting on Harvey, in the Northeast </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005400160" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/nyregion/ordering-review-of-statues-puts-de-blasio-in-tricky-spot.html"> + Ordering Review of Statues Puts de Blasio in Tricky Spot </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005398633" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/nyregion/instagram-places-new-york-travel.html"> + New York City’s Newest Hot Spot? Check Instagram </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/sports/index.html">Sports »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005399955" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/sports/espn-ed-cunningham-football-concussions.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/sports/31BRAINSweb1/31BRAINSweb1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + ESPN Football Analyst Walks Away, Disturbed by Brain Trauma on Field </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005401613" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/31/sports/tennis/alexander-zverev-borna-coric-us-open.html"> + Two Zverevs Take the Court in Queens, and Only One Advances </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005395156" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/sports/olympics/munich-olympic-massacre-1972-memorial-israeli-athletes.html"> + In Munich, a Tribute to Israeli Athletes and Families’ Persistence </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/theater/index.html">Theater »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005387208" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/theater/oh-my-sweet-land-amir-nizar-zuabi.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/09/03/arts/27SWEETLAND1/27SWEETLAND1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + The Kitchen Is Her Stage. (It Could Actually Be Your Kitchen.) </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005364092" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/theater/eavesdropping-on-warhol-and-capote.html"> + Eavesdropping on Warhol and Capote </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005360538" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/theater/great-comet-broadway-race.html"> + Race, Money and Broadway: How ‘Great Comet’ Burned Out </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/science">Science »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005343497" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/video/science/100000005343497/forty-years-of-voyager.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/29/multimedia/Voyager-Thumb1/Voyager-Thumb1-thumbStandard.png" alt="" /> + </div> + + <h3 class="story-heading"> + Forty Years of Voyager </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005398035" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/science/nova-stars-korea.html"> + Trilobites: Casting Light on Mystery of a Star That Vanished After 14 Days </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005396021" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/science/trigonometry-babylonian-tablet.html"> + Trilobites: Hints of Trigonometry on a 3,700-Year-Old Babylonian Tablet </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/obituaries">Obituaries »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005401130" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/sports/ncaabasketball/villanova-coach-rollie-massimino-dead.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/obituaries/30massimino1/30massimino1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Rollie Massimino, 82, Dies; Rode Dark Horse Villanova to Basketball Glory </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005398288" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/sports/basketball/jud-heathcote-dead-coached-michigan-state-to-basketball-title.html"> + Jud Heathcote, 90, Dies; Coached Michigan State to Basketball Title </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005399785" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/business/david-tang-dead-fashion-retailer.html"> + David Tang, Fashion Retailer and Raconteur, Dies at 63 </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/arts/television">Television »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005398883" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/arts/television/uk-gbbo-great-british-bake-off-channel-4.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/arts/31BAKEOFF-ROUNDUP/31BAKEOFF-ROUNDUP-thumbStandard-v2.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + ‘Great British Bake Off’ Is Still a Treat for Many Viewers </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005367164" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/24/arts/television/the-deuce-hbo-david-simon.html"> + ‘The Deuce’ Recalls Sex and Sleaze in 1970s Times Square </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005396266" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/interactive/2017/08/29/watching/fall-tv-sf-promo.html"> + Watching: Your Catch-Up Guide to the Best Shows Returning This Fall </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/health/index.html">Health »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005400786" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/health/gene-therapy-cancer.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/science/31GENE3/31GENE3-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + F.D.A. Approves First Gene-Altering Leukemia Treatment, Costing $475,000 </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005390415" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/business/economy/home-health-care-work.html"> + Economic Scene: Home Health Care: Shouldn’t It Be Work Worth Doing? </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005395934" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/28/health/fda-stem-cell.html"> + F.D.A. Cracks Down on ‘Unscrupulous’ Stem Cell Clinics </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/travel">Travel »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000004599829" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/travel/peaceful-island-indonesia.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/09/10/travel/10gili1/30gili1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Next Stop: This Indonesian Island Is a Respite From Bali. At Least for Now. </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005388668" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/interactive/2017/08/29/travel/what-to-do-36-hours-in-trieste-italy.html"> + 36 Hours: 36 Hours in Trieste, Italy </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005385852" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/28/travel/kodiak-travel-photography.html"> + Photo Essay: Our Stunning World </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/books">Books »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005399033" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/books/review-cuz-danielle-allen.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/31/books/31bookallen2/31bookallen2-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Books of The Times: ‘Cuz’ Mourns a Loss and Denounces a System </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005396584" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/books/review-my-absolute-darling-gabriel-tallent.html"> + Books of The Times: A Heroine in the Mold of Huck and Scout </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005395901" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/28/books/review-john-le-carre-legacy-of-spies.html"> + Books of The Times: George Smiley and Other Old Friends Return in John le Carré’s ‘A Legacy of Spies’ </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/education">Education »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005337043" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/interactive/2017/08/24/us/affirmative-action.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/03/us/affirmative-action-in-colleges-and-representation-of-blacks-and-hispanics-1503525136789/affirmative-action-in-colleges-and-representation-of-blacks-and-hispanics-1503525136789-thumbStandard-v5.png" alt="" /> + </div> + + <h3 class="story-heading"> + Even With Affirmative Action, Blacks and Hispanics Are More Underrepresented at Top Colleges Than 35 Years Ago </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005348802" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/24/technology/coding-boot-camps-close.html"> + As Coding Boot Camps Close, the Field Faces a Reality Check </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005384528" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/22/opinion/washington-lee-university-trump-nationalism.html"> + On Campus: My University Is Named for Robert E. Lee. What Now? </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/dining/index.html">Food »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005387948" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/29/dining/restaurant-wish-list-pete-wells.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/dining/30WISH3/30WISH3-thumbStandard-v2.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Critic’s Notebook: A Wish List for New Restaurants </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005390036" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/dining/mashed-potato-salad-recipe.html"> + A Good Appetite: An Accidentally Creamier, Fluffier Potato Salad </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005314050" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/dining/opentable-restaurant-reservations.html"> + OpenTable Began a Revolution. Now It’s a Power Under Siege. </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/opinion/index.html#sundayreview">Sunday Review »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005391244" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/interactive/2017/08/25/opinion/sunday/worst-and-best-places-to-be-gay.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/24/opinion/sunday/worst-and-best-places-to-be-gay-1503633763145/worst-and-best-places-to-be-gay-1503633763145-thumbStandard.png" alt="" /> + </div> + + <h3 class="story-heading"> + Op-Ed Columnist: The Worst (and Best) Places to Be Gay in America </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005392272" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/26/opinion/sunday/memorize-poems-poetry-education.html"> + Molly Worthen: Memorize That Poem! </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005388249" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/26/opinion/sunday/obamacare-universal-health-coverage.html"> + Editorial: Looking Beyond the Obamacare Debate to Improve Health Care </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/realestate/index.html">Real Estate »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005386638" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/realestate/weston-conn-quiet-and-wooded-with-top-notch-schools.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/09/03/realestate/03LIVING-WESTON-slide-537E/03LIVING-WESTON-slide-537E-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Living In: Weston, Conn.: Quiet and Wooded, With Top-Notch Schools </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005390514" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/realestate/house-hunting-in-bali.html"> + International Real Estate: House Hunting in ... Bali </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005395929" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/realestate/900000-homes-in-colorado-pennsylvania-and-vermont.html"> + What You Get: $900,000 Homes in Colorado, Pennsylvania and Vermont </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/upshot">The Upshot »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005396126" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/interactive/2017/08/29/upshot/statues-quiz.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/26/upshot/up-statue-Lee/up-statue-Lee-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Which Statues Need to Come Down? You Decide </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005393332" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/interactive/2017/08/29/upshot/harvey-rainfall-where-you-live.html"> + Houston May Get 50 Inches of Rain. How Long Does It Take Your City to Get That Much? </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005395922" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/28/upshot/markets-are-signaling-that-hurricane-harvey-wont-crush-the-economy.html"> + Pricing a Disaster: Markets Are Signaling That Hurricane Harvey Won’t Crush the Economy </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/magazine">Magazine »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005393258" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/magazine/how-to-get-rich-in-trumps-washington.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/09/03/magazine/03lobbyists1/03lobbyists1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Feature: How to Get Rich in Trump’s Washington </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005381661" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/interactive/2017/08/24/magazine/usopen-federer-nadal-backhand-wonder-year.html"> + U.S. Open: How Roger Federer Upgraded His Game </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005389041" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/magazine/my-nanny-has-a-gambling-problem-can-i-fire-her.html"> + The Ethicist: My Nanny Has a Gambling Problem. Can I Fire Her? </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + + <div class="split-3-layout layout theme-base"> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/pages/automobiles/index.html">Automobiles »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005398865" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/29/business/ford-driverless-pizza-delivery-dominos.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/business/30FORD1/30FORD1-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + There’s a Pizza Delivery in Ford’s Future, by Driverless Car </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005385761" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/24/automobiles/wheels/pebble-beach-concours-delegance-car-auction.html"> + Wheels: Bidding Before California Car Show Suggests Collectible Market Is Healthy </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005391881" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/25/business/volkswagen-engineer-prison-diesel-cheating.html"> + Volkswagen Engineer Gets Prison in Diesel Cheating Case </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column "> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/t-magazine">T Magazine »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005365534" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/t-magazine/travel/sullivan-county-narrowsburg-livingston-manor-callicoon-guide.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/t-magazine/sullivan-slide-VBE5-copy/sullivan-slide-VBE5-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Wanderlust: What to Do (and Where to Stay) in the Western Catskills </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005392498" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/t-magazine/charlottesville-art-robert-longo-toyin-ojih-odutola-sanford-biggers.html"> + T Agitprop: 5 Artists Respond to: Charlottesville </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005397209" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/29/t-magazine/fashion/maggie-marilyn-hewitt-clothing-designer.html"> + On the Verge: Person to Know: A Nonconformist New Zealand Designer </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + <div class="column last-column"> + + <section> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/insider">Times Insider »</a> + </h2> + <ul> + <li> + <article class="story theme-summary" data-story-id="100000005400594" data-rank="0" data-collection-renderstyle="HpHedThumbWell"> + + <a class="story-link" href="https://www.nytimes.com/2017/08/30/insider/events/game-of-thrones-conference-call-new-york-times.html"> + + <div class="thumb"> + <img src="https://static01.nyt.com/images/2017/08/30/insider/30insider-event-thrones-image/30insider-event-thrones-image-thumbStandard.jpg" alt="" /> + </div> + + <h3 class="story-heading"> + Conference Call, Sept. 6: Live Event: Discuss ‘Game of Thrones’ With The New York Times </h3> + </a> + </article> + </li> + <li> + <article class="story" data-story-id="100000005399053" data-rank="1" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/insider/the-sodden-haunted-fields-of-flanders.html"> + Picturing the First World War: The Sodden, Haunted Fields of Flanders </a> + </h2> + </article> + </li> + <li> + <article class="story" data-story-id="100000005396519" data-rank="2" data-collection-renderstyle="HpHedThumbWell"> + <h2 class="story-heading"> + <a href="https://www.nytimes.com/2017/08/30/insider/newsbook-column-explainer-book-review.html"> + When the News Begs for a Book: Behind the Newsbook Column </a> + </h2> + </article> + </li> + </ul> + </section> + + </div> <!-- close column --> + + + </div><!-- close split-3-layout --> + + </div> + </section><!-- close well section --> + + </div><!-- close ab-column --> + + <div class="c-column column"> + + + <section class="real-estate"> + <div class="layout split-layout theme-base"> + <div class="column"> + <div class="region real-estate-left-region"> + + <div class="collection"> + <h2 class="section-heading"> + <a href="https://www.nytimes.com/section/realestate">Real Estate »</a> + </h2> + <article class="story theme-summary" id="topnews-100000005395929" data-story-id="100000005395929" data-rank="0" data-collection-renderstyle="HpSectionSumSmallMedia"> + + <h3 class="kicker">What You Get </h3> + + <h2 class="story-heading"><a href="https://www.nytimes.com/2017/08/30/realestate/900000-homes-in-colorado-pennsylvania-and-vermont.html">$900,000 Homes in Colorado, Pennsylvania and Vermont</a></h2> + + <p class="byline">By TIM McKEOUGH </p> + + <div class="thumb"> + <a href="https://www.nytimes.com/2017/08/30/realestate/900000-homes-in-colorado-pennsylvania-and-vermont.html"><img src="https://static01.nyt.com/images/2017/09/03/realestate/03WYG-slide-FF9B/03WYG-slide-FF9B-thumbStandard.jpg" alt=""></a> + </div> + + <p class="summary"> + A renovated midcentury-modern home in Denver, a 1907 stone house in Philadelphia and a lakeside retreat in Ferrisburgh. </p> + + + </article> + + </div> + <div class="collection"> + <ul class="theme-module-headlines"> + <li><article class="story" data-collection-renderstyle="HpHeadline"><h2 class="story-heading"><a href="http://www.nytimes.com/real-estate/find-a-home">Search for Homes for Sale or Rent</a></h2></article></li> + + <li><article class="story" data-collection-renderstyle="HpHeadline"><h2 class="story-heading"><a href="https://www.nytimes.com/real-estate/mortgage-calculator">Mortgage Calculator</a></h2></article></li></ul> + + </div> + + </div><!-- close real-estate-left-region --> + </div> + <div class="column"> + <div class="region real-estate-right-region"> + <div class="collection"> + <div id="HPmodule-RE2-alternate-content"><div></div> + <div class="collection"> + </div></div></div> + <div id="hpmodulere2" class="ad hpmodulere2-ad nocontent robots-nocontent"></div> + </div><!-- close real-estate-right-region --> + </div> + </div> + </section> + + + <section id="recommendations" class="recommendations"> + <div class="tabs-container"> + <ul class="tabs"> + <li data-type="most-emailed" class="most-emailed-tab"><a href="https://www.nytimes.com/trending/">Most Emailed</a></li><li data-type="most-viewed" class="most-viewed-tab"><a href="https://www.nytimes.com/gst/mostpopular.html">Most Viewed</a></li><li data-type="trending" class="trending-tab"><a href="http://www.nytimes.com/trending/">Trending</a></li><li data-type="recommended" class="recommended-tab"><a href="https://www.nytimes.com/recommendations">Recommended for you</a></li> + </ul> + </div><!-- end tabs-container --> + + <div class="tab-content most-emailed"> + <div class="loader"></div> + </div> + <div class="tab-content most-viewed"> + <div class="loader"></div> + </div> + <div class="tab-content trending"> + <div class="loader"></div> + </div> + <div class="tab-content recommended"> + <div class="loader"></div> + </div> + + <div id="recommendations-module-loader" class="loader-container"> + <div class="loader loader-t-logo-32x32-ecedeb-ffffff"><span class="visually-hidden">Loading...</span></div> + </div> + </section> + + <div id="Box1" class="ad box1-ad nocontent robots-nocontent"></div> + <div id="HPBottom1" class="ad hpbottom1-ad nocontent robots-nocontent"></div> + + </div><!-- close c-column --> + + </div><!-- close span-ab-layout --> + + <div id="HPSponLink" class="ad hpsponlink-ad nocontent robots-nocontent"></div> + <div id="Bottom8" class="ad bottom8-ad nocontent robots-nocontent"></div> + <div id="Bottom9" class="ad bottom9-ad nocontent robots-nocontent"></div> + <div class="search-overlay"></div> + </main><!-- close main --> + <section id="site-index" class="site-index"> + <header class="section-header"> + <p class="user-action"><a href="https://www.nytimes.com/">Go to Home Page »</a></p> + <h2 class="section-heading"> + <span class="visually-hidden">Site Index</span> + <a id="site-index-branding-link" href="https://www.nytimes.com/"> + <span class="visually-hidden">The New York Times</span> + </a> + </h2> + <script>window.magnum.writeLogo('small', 'https://a1.nyt.com/assets/homepage/20170810-135137/images/foundation/logos/', '', '', 'standard', 'site-index-branding-link', '');</script> + </header> + + <nav id="site-index-navigation" class="site-index-navigation" role="navigation"> + <h2 class="visually-hidden">Site Index Navigation</h2> + <div class="split-6-layout layout"> + + + <div class="column"> + <h3 class="menu-heading">News</h3> + <ul class="menu"> + + + <li> + <a href="https://www.nytimes.com/pages/world/index.html">World</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/national/index.html">U.S.</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/politics/index.html">Politics</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/nyregion/index.html">N.Y.</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/business/index.html">Business</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/technology/index.html">Tech</a> + </li> + + + <li> + <a href="https://www.nytimes.com/section/science">Science</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/health/index.html">Health</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/sports/index.html">Sports</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/education/index.html">Education</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/obituaries/index.html">Obituaries</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/todayspaper/index.html">Today's Paper</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/corrections/index.html">Corrections</a> + </li> + + + </ul> + </div><!-- close column --> + + + <div class="column"> + <h3 class="menu-heading">Opinion</h3> + <ul class="menu"> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html">Today's Opinion</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#columnists">Op-Ed Columnists</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#editorials">Editorials</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#contributing">Contributing Writers</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#op-ed">Op-Ed Contributors</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#opinionator">Opinionator</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#letters">Letters</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#sundayreview">Sunday Review</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/opinion/index.html#takingNote">Taking Note</a> + </li> + + + <li> + <a href="https://www.nytimes.com/roomfordebate">Room for Debate</a> + </li> + + + <li> + <a href="https://www.nytimes.com/video/opinion">Video: Opinion</a> + </li> + + + </ul> + </div><!-- close column --> + + + <div class="column"> + <h3 class="menu-heading">Arts</h3> + <ul class="menu"> + + + <li> + <a href="https://www.nytimes.com/pages/arts/index.html">Today's Arts</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/arts/design/index.html">Art & Design</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/books/index.html">Books</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/arts/dance/index.html">Dance</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/movies/index.html">Movies</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/arts/music/index.html">Music</a> + </li> + + + <li> + <a href="https://www.nytimes.com/events/">N.Y.C. Events Guide</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/arts/television/index.html">Television</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/theater/index.html">Theater</a> + </li> + + + <li> + <a href="https://www.nytimes.com/video/arts">Video: Arts</a> + </li> + + + </ul> + </div><!-- close column --> + + + <div class="column"> + <h3 class="menu-heading">Living</h3> + <ul class="menu"> + + + <li> + <a href="https://www.nytimes.com/pages/automobiles/index.html">Automobiles</a> + </li> + + + <li> + <a href="https://www.nytimes.com/crosswords/">Crossword</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/dining/index.html">Food</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/education/index.html">Education</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/fashion/index.html">Fashion & Style</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/health/index.html">Health</a> + </li> + + + <li> + <a href="https://www.nytimes.com/section/jobs">Jobs</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/magazine/index.html">Magazine</a> + </li> + + + <li> + <a href="https://www.nytimes.com/events/">N.Y.C. Events Guide</a> + </li> + + + <li> + <a href="https://www.nytimes.com/section/realestate">Real Estate</a> + </li> + + + <li> + <a href="https://www.nytimes.com/section/t-magazine">T Magazine</a> + </li> + + + <li> + <a href="https://www.nytimes.com/section/travel">Travel</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/fashion/weddings/index.html">Weddings & Celebrations</a> + </li> + + + </ul> + </div><!-- close column --> + + + <div class="column"> + <h3 class="menu-heading">Listings & More</h3> + <ul class="menu"> + + + <li> + <a href="https://www.nytimes.com/section/reader-center">Reader Center</a> + </li> + + + <li> + <a href="https://www.nytimes.com/ref/classifieds/">Classifieds</a> + </li> + + + <li> + <a href="https://www.nytimes.com/marketing/tools-and-services/">Tools & Services</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/topics/">Times Topics</a> + </li> + + + <li> + <a href="https://www.nytimes.com/events/">N.Y.C. Events Guide</a> + </li> + + + <li> + <a href="https://www.nytimes.com/interactive/blogs/directory.html">Blogs</a> + </li> + + + <li> + <a href="https://www.nytimes.com/pages/multimedia/index.html">Multimedia</a> + </li> + + + <li> + <a href="https://lens.blogs.nytimes.com/">Photography</a> + </li> + + + <li> + <a href="https://www.nytimes.com/video">Video</a> + </li> + + + <li> + <a href="https://www.nytimes.com/store/?&t=qry542&utm_source=nytimes&utm_medium=HPB&utm_content=hp_browsetree&utm_campaign=NYT-HP&module=SectionsNav&action=click®ion=TopBar&version=BrowseTree&contentCollection=NYT%20Store&contentPlacement=2&pgtype=Homepage">NYT Store</a> + </li> + + + <li> + <a href="https://www.nytimes.com/times-journeys/?utm_source=nytimes&utm_medium=HPLink&utm_content=hp_browsetree&utm_campaign=NYT-HP">Times Journeys</a> + </li> + + + <li> + <a href="https://www.nytimes.com/seeallnav">Subscribe</a> + </li> + + + <li> + <a href="https://www.nytimes.com/membercenter">Manage My Account</a> + </li> + + + <li> + <a href="http://www.nytco.com">NYTCo</a> + </li> + + + </ul> + </div><!-- close column --> + + + <div class="column last-column"> + + <h3 class="menu-heading">Subscribe</h3> + + <ul class="menu primary-menu"> + <li class="menu-label">Subscribe</li> + <li class="home-delivery"> + <i class="icon sprite-icon"></i> + <a class="nyt-home-delivery" href="https://www.nytimes.com/hdleftnav">Home Delivery</a> + </li> + <li class="digital-subscriptions"> + <i class="icon sprite-icon"></i> + <a class="digital-subscription" href="https://www.nytimes.com/digitalleftnav">Digital Subscriptions</a> + </li> + <li class="nyt-crossword last-item"> + <i class="icon sprite-icon"></i> + <a id="nyt-crossword" href="https://www.nytimes.com/crosswords/index.html">Crossword</a> + </li> + </ul> + + <ul class="menu secondary-menu"> + + <li class="email-newsletters"> + <a href="https://www.nytimes.com/marketing/newsletters">Email Newsletters</a> + </li> + <li> + <a href="https://myaccount.nytimes.com/mem/tnt.html">Alerts</a> + </li> + <li class="gift-subscription"> + <a href="https://www.nytimes.com/giftleftnav">Gift Subscriptions</a> + </li> + <li> + <a href="https://www.nytimes.com/corporateleftnav">Corporate Subscriptions</a> + </li> + <li> + <a href="https://www.nytimes.com/educationleftnav">Education Rate</a> + </li> + + </ul> + <ul class="menu secondary-menu"> + <li> + <a href="https://www.nytimes.com/services/mobile/index.html">Mobile Applications</a> + </li> + <li> + <a href="http://eedition.nytimes.com/cgi-bin/signup.cgi?cc=37FYY">Replica Edition</a> + </li> + + </ul> + + </div><!-- close column --> + + </div><!-- close split-6-layout --> + + </nav><!-- close nav --> + + </section><!-- close site-index --> + + <footer id="page-footer" class="page-footer" role="contentinfo"> + <nav> + <h2 class="visually-hidden">Site Information Navigation</h2> + <ul> + <li> + <a href="https://www.nytimes.com/content/help/rights/copyright/copyright-notice.html" itemprop="copyrightNotice"> + © <span itemprop="copyrightYear">2017</span><span itemprop="copyrightHolder provider sourceOrganization" itemscope itemtype="http://schema.org/Organization" itemid="http://www.nytimes.com"><span itemprop="name"> The New York Times Company</span><meta itemprop="tickerSymbol" content="NYSE NYT"/></span> + </a> + </li> + <li class="wide-viewport-item"><a href="https://www.nytimes.com/ref/membercenter/help/infoservdirectory.html">Contact Us</a></li> + <li class="wide-viewport-item"><a href="http://www.nytco.com/careers">Work With Us</a></li> + <li class="wide-viewport-item"><a href="http://nytmediakit.com/">Advertise</a></li> + <li class="wide-viewport-item"><a href="https://www.nytimes.com/content/help/rights/privacy/policy/privacy-policy.html#pp">Your Ad Choices</a></li> + <li><a href="https://www.nytimes.com/privacy">Privacy</a></li> + <li><a href="https://www.nytimes.com/ref/membercenter/help/agree.html" itemprop="usageTerms">Terms of Service</a></li> + <li class="wide-viewport-item last-item"><a href="https://www.nytimes.com/content/help/rights/sale/terms-of-sale.html">Terms of Sale</a></li> + </ul> + </nav> + <nav class="last-nav"> + <h2 class="visually-hidden">Site Information Navigation</h2> + <ul> + <li><a href="http://spiderbites.nytimes.com">Site Map</a></li> + <li><a href="https://www.nytimes.com/membercenter/sitehelp.html">Help</a></li> + <li><a href="https://myaccount.nytimes.com/membercenter/feedback.html">Site Feedback</a></li> + <li class="wide-viewport-item last-item"><a href="https://www.nytimes.com/subscriptions/Multiproduct/lp5558.html?campaignId=37WXW">Subscriptions</a></li> + </ul> + </nav> + + <div id="mobile-banner" class="mobile-banner hidden"> + <a class="banner-message" href="https://mobile.nytimes.com/">View Mobile Version</a> + </div> + + <div id="dfp-perf-test" class="ad hidden"></div> + </footer> +</div><!-- close page --> +</div><!-- close shell --> +<script> + require(['foundation/main'], function () { + require(['homepage/main']); + require(['jquery/nyt', 'foundation/views/page-manager'], function ($, pageManager) { + if (window.location.search.indexOf('disable_tagx') > 0) { + return; + } + $(document).ready(function () { + require(['https://a1.nyt.com/analytics/tagx-simple.min.js'], function () { + pageManager.trackingFireEventQueue(); + }); + }); + }); + }); +</script> +<!--esi +<esi:include src="/appconfig/https/show-modal.js" /> +--> + +<div id="Inv1" class="ad inv1-ad hidden"></div> +<div id="Inv2" class="ad inv2-ad hidden"></div> +<div id="Inv3" class="ad inv3-ad hidden"></div> +<div id="ab1" class="ad ab1-ad hidden"></div> +<div id="ab2" class="ad ab2-ad hidden"></div> +<div id="ab3" class="ad ab3-ad hidden"></div> +<div id="prop1" class="ad prop1-ad hidden"></div> +<div id="prop2" class="ad prop2-ad hidden"></div> +<div id="Anchor" class="ad anchor-ad hidden"></div> +<div id="ADX_CLIENTSIDE" class="ad adx-clientside-ad hidden"></div> +</body> +</html> diff --git a/plugins/af_readability/vendor/masterminds/html5/test/benchmark/run.php b/plugins/af_readability/vendor/masterminds/html5/test/benchmark/run.php new file mode 100644 index 000000000..2ca190783 --- /dev/null +++ b/plugins/af_readability/vendor/masterminds/html5/test/benchmark/run.php @@ -0,0 +1,29 @@ +<?php + +require __DIR__ . '/../../vendor/autoload.php'; + +$iterations = isset($argv[1]) ? $argv[1] : 100; + +$html5 = new Masterminds\HTML5(); +$content = file_get_contents(__DIR__ . '/example.html'); +$dom = $html5->loadHTML($content); + +$samples = array(); +for ($i = 0; $i < $iterations; ++$i) { + $t = microtime(true); + $dom = $html5->loadHTML($content); + $samples[] = microtime(true) - $t; +} +$time = array_sum($samples) / count($samples); +echo 'Loading: ' . ($time * 1000) . "\n"; + +$samples = array(); +for ($i = 0; $i < $iterations; ++$i) { + $t = microtime(true); + $html5->saveHTML($dom); + $samples[] = microtime(true) - $t; +} +$time = array_sum($samples) / count($samples); +echo 'Writing: ' . ($time * 1000) . "\n"; + +exit(0); |