From 9bc854ec4497c2503fdc17412a5cdfd6471401f5 Mon Sep 17 00:00:00 2001
From: Michal
Date: Tue, 25 Aug 2026 00:16:16 +0100
Subject: [PATCH] af_fulltext: rule-driven extraction with a pluggable renderer
Replaces subscribing feeds through a self-hosted Full-Text RSS proxy. Feed URLs
go back to being real feed URLs and extraction happens inside tt-rss, using the
same ftr-site-config rules the proxy used.
The engine in lib/ has no tt-rss dependencies, so rules can be developed and
audited from the command line; init.php is a thin adapter over it.
Two findings from measuring the real subscription first, both of which shaped
the design:
- Firecrawl's own onlyMainContent is far too coarse to extract with (73KB of
chrome on a Cloudflare post), but it is an excellent renderer. So it is used
for rawHtml only and the rule engine does the extraction.
- A body rule that stops matching after a redesign falls through to Readability
and still produces a plausible article, so the breakage is invisible. Every
extraction now records which rule matched and whether it fell back; auditing
the 34 live feeds surfaced five community rules that match nothing.
Custom rules included for the sites that needed them, including three comics
where the article is an image and text-scoring extractors return the wrong thing
or nothing at all.
Co-Authored-By: Claude Opus 5 (1M context)
Claude-Session: https://claude.ai/code/session_011sSJdftQx5bW5HZHgUKF3i
---
.gitignore | 7 +
LICENSE | 674 ++
README.md | 122 +
autoload.php | 16 +
bin/audit.php | 117 +
bin/extract.php | 60 +
bin/php-podman.sh | 5 +
composer.json | 30 +
feeds.example.txt | 6 +
init.js | 48 +
init.php | 475 ++
lib/CurlFetcher.php | 74 +
lib/ExtractResult.php | 57 +
lib/Extractor.php | 361 +
lib/Fetcher.php | 29 +
lib/FirecrawlFetcher.php | 80 +
lib/Html.php | 259 +
lib/Rule.php | 68 +
lib/RuleSet.php | 148 +
lib/TtrssFetcher.php | 48 +
patches/README.md | 12 +
site_config/custom/andrzejrysuje.pl.txt | 10 +
site_config/custom/blog.cloudflare.com.txt | 12 +
site_config/custom/dobreprogramy.pl.txt | 8 +
site_config/custom/ianlewis.org.txt | 4 +
site_config/custom/loadingartist.com.txt | 12 +
site_config/custom/oglaf.com.txt | 7 +
site_config/custom/securelist.com.txt | 16 +
site_config/custom/skeletonclaw.com.txt | 10 +
site_config/custom/tapas.io.txt | 15 +
vendor/autoload.php | 22 +
vendor/composer/ClassLoader.php | 579 ++
vendor/composer/InstalledVersions.php | 396 +
vendor/composer/LICENSE | 21 +
vendor/composer/autoload_classmap.php | 61 +
vendor/composer/autoload_namespaces.php | 9 +
vendor/composer/autoload_psr4.php | 12 +
vendor/composer/autoload_real.php | 38 +
vendor/composer/autoload_static.php | 103 +
vendor/composer/installed.json | 208 +
vendor/composer/installed.php | 54 +
vendor/composer/platform_check.php | 25 +
.../readability.php/.gitattributes | 2 +
.../.github/workflows/main.yml | 42 +
vendor/fivefilters/readability.php/.gitignore | 5 +
vendor/fivefilters/readability.php/AUTHORS.md | 14 +
.../fivefilters/readability.php/CHANGELOG.md | 145 +
.../readability.php/CONTRIBUTING.md | 31 +
vendor/fivefilters/readability.php/LICENSE | 201 +
vendor/fivefilters/readability.php/Makefile | 27 +
vendor/fivefilters/readability.php/README.md | 251 +
.../fivefilters/readability.php/composer.json | 51 +
.../readability.php/docker-compose.yml | 100 +
.../readability.php/docker/php/Dockerfile | 16 +
.../docker/php/build.Dockerfile | 56 +
.../fivefilters/readability.php/phpunit.xml | 16 +
.../readability.php/src/Configuration.php | 448 ++
.../readability.php/src/Nodes/DOM/DOMAttr.php | 10 +
.../src/Nodes/DOM/DOMCdataSection.php | 10 +
.../src/Nodes/DOM/DOMCharacterData.php | 10 +
.../src/Nodes/DOM/DOMComment.php | 10 +
.../src/Nodes/DOM/DOMDocument.php | 30 +
.../src/Nodes/DOM/DOMDocumentFragment.php | 10 +
.../src/Nodes/DOM/DOMDocumentType.php | 10 +
.../src/Nodes/DOM/DOMElement.php | 46 +
.../src/Nodes/DOM/DOMEntity.php | 10 +
.../src/Nodes/DOM/DOMEntityReference.php | 10 +
.../readability.php/src/Nodes/DOM/DOMNode.php | 14 +
.../src/Nodes/DOM/DOMNodeList.php | 82 +
.../src/Nodes/DOM/DOMNotation.php | 10 +
.../Nodes/DOM/DOMProcessingInstruction.php | 10 +
.../readability.php/src/Nodes/DOM/DOMText.php | 10 +
.../readability.php/src/Nodes/NodeTrait.php | 566 ++
.../readability.php/src/Nodes/NodeUtility.php | 192 +
.../readability.php/src/ParseException.php | 7 +
.../readability.php/src/Readability.php | 2484 +++++++
vendor/masterminds/html5/.gitattributes | 8 +
vendor/masterminds/html5/.gitignore | 5 +
vendor/masterminds/html5/.php_cs.dist | 14 +
vendor/masterminds/html5/.scrutinizer.yml | 41 +
vendor/masterminds/html5/.travis.yml | 47 +
vendor/masterminds/html5/CREDITS | 11 +
vendor/masterminds/html5/Jenkinsfile | 19 +
vendor/masterminds/html5/LICENSE.txt | 66 +
vendor/masterminds/html5/README.md | 254 +
vendor/masterminds/html5/RELEASE.md | 153 +
vendor/masterminds/html5/UPGRADING.md | 21 +
vendor/masterminds/html5/bin/entities.php | 26 +
vendor/masterminds/html5/composer.json | 42 +
vendor/masterminds/html5/example.php | 32 +
vendor/masterminds/html5/phpunit.xml.dist | 8 +
vendor/masterminds/html5/src/HTML5.php | 246 +
.../masterminds/html5/src/HTML5/Elements.php | 619 ++
.../masterminds/html5/src/HTML5/Entities.php | 2236 ++++++
.../masterminds/html5/src/HTML5/Exception.php | 10 +
.../html5/src/HTML5/InstructionProcessor.php | 41 +
.../src/HTML5/Parser/CharacterReference.php | 61 +
.../html5/src/HTML5/Parser/DOMTreeBuilder.php | 705 ++
.../html5/src/HTML5/Parser/EventHandler.php | 114 +
.../src/HTML5/Parser/FileInputStream.php | 33 +
.../html5/src/HTML5/Parser/InputStream.php | 87 +
.../html5/src/HTML5/Parser/ParseError.php | 10 +
.../html5/src/HTML5/Parser/README.md | 53 +
.../html5/src/HTML5/Parser/Scanner.php | 416 ++
.../src/HTML5/Parser/StringInputStream.php | 336 +
.../html5/src/HTML5/Parser/Tokenizer.php | 1191 +++
.../src/HTML5/Parser/TreeBuildingRules.php | 127 +
.../html5/src/HTML5/Parser/UTF8Utils.php | 183 +
.../src/HTML5/Serializer/HTML5Entities.php | 1533 ++++
.../src/HTML5/Serializer/OutputRules.php | 553 ++
.../html5/src/HTML5/Serializer/README.md | 33 +
.../src/HTML5/Serializer/RulesInterface.php | 99 +
.../html5/src/HTML5/Serializer/Traverser.php | 142 +
.../html5/test/HTML5/ElementsTest.php | 485 ++
.../test/HTML5/Fixtures/encoding/utf-8.html | 9 +
.../HTML5/Fixtures/encoding/windows-1252.html | 9 +
.../html5/test/HTML5/Html5Test.html | 10 +
.../html5/test/HTML5/Html5Test.php | 492 ++
.../HTML5/Parser/CharacterReferenceTest.php | 44 +
.../test/HTML5/Parser/DOMTreeBuilderTest.php | 743 ++
.../html5/test/HTML5/Parser/EventStack.php | 116 +
.../test/HTML5/Parser/EventStackError.php | 7 +
.../HTML5/Parser/InstructionProcessorMock.php | 26 +
.../html5/test/HTML5/Parser/ScannerTest.php | 184 +
.../html5/test/HTML5/Parser/TokenizerTest.php | 978 +++
.../HTML5/Parser/TreeBuildingRulesTest.php | 118 +
.../html5/test/HTML5/Parser/UTF8UtilsTest.php | 28 +
.../test/HTML5/Serializer/OutputRulesTest.php | 652 ++
.../test/HTML5/Serializer/TraverserTest.php | 136 +
.../masterminds/html5/test/HTML5/TestCase.php | 23 +
.../html5/test/benchmark/example.html | 6403 +++++++++++++++++
.../masterminds/html5/test/benchmark/run.php | 29 +
vendor/psr/log/LICENSE | 19 +
vendor/psr/log/Psr/Log/AbstractLogger.php | 128 +
.../log/Psr/Log/InvalidArgumentException.php | 7 +
vendor/psr/log/Psr/Log/LogLevel.php | 18 +
.../psr/log/Psr/Log/LoggerAwareInterface.php | 18 +
vendor/psr/log/Psr/Log/LoggerAwareTrait.php | 26 +
vendor/psr/log/Psr/Log/LoggerInterface.php | 125 +
vendor/psr/log/Psr/Log/LoggerTrait.php | 142 +
vendor/psr/log/Psr/Log/NullLogger.php | 30 +
vendor/psr/log/Psr/Log/Test/DummyTest.php | 18 +
.../log/Psr/Log/Test/LoggerInterfaceTest.php | 138 +
vendor/psr/log/Psr/Log/Test/TestLogger.php | 147 +
vendor/psr/log/README.md | 58 +
vendor/psr/log/composer.json | 26 +
146 files changed, 30221 insertions(+)
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 autoload.php
create mode 100755 bin/audit.php
create mode 100755 bin/extract.php
create mode 100755 bin/php-podman.sh
create mode 100644 composer.json
create mode 100644 feeds.example.txt
create mode 100644 init.js
create mode 100644 init.php
create mode 100644 lib/CurlFetcher.php
create mode 100644 lib/ExtractResult.php
create mode 100644 lib/Extractor.php
create mode 100644 lib/Fetcher.php
create mode 100644 lib/FirecrawlFetcher.php
create mode 100644 lib/Html.php
create mode 100644 lib/Rule.php
create mode 100644 lib/RuleSet.php
create mode 100644 lib/TtrssFetcher.php
create mode 100644 patches/README.md
create mode 100644 site_config/custom/andrzejrysuje.pl.txt
create mode 100644 site_config/custom/blog.cloudflare.com.txt
create mode 100644 site_config/custom/dobreprogramy.pl.txt
create mode 100644 site_config/custom/ianlewis.org.txt
create mode 100644 site_config/custom/loadingartist.com.txt
create mode 100644 site_config/custom/oglaf.com.txt
create mode 100644 site_config/custom/securelist.com.txt
create mode 100644 site_config/custom/skeletonclaw.com.txt
create mode 100644 site_config/custom/tapas.io.txt
create mode 100644 vendor/autoload.php
create mode 100644 vendor/composer/ClassLoader.php
create mode 100644 vendor/composer/InstalledVersions.php
create mode 100644 vendor/composer/LICENSE
create mode 100644 vendor/composer/autoload_classmap.php
create mode 100644 vendor/composer/autoload_namespaces.php
create mode 100644 vendor/composer/autoload_psr4.php
create mode 100644 vendor/composer/autoload_real.php
create mode 100644 vendor/composer/autoload_static.php
create mode 100644 vendor/composer/installed.json
create mode 100644 vendor/composer/installed.php
create mode 100644 vendor/composer/platform_check.php
create mode 100644 vendor/fivefilters/readability.php/.gitattributes
create mode 100644 vendor/fivefilters/readability.php/.github/workflows/main.yml
create mode 100644 vendor/fivefilters/readability.php/.gitignore
create mode 100644 vendor/fivefilters/readability.php/AUTHORS.md
create mode 100644 vendor/fivefilters/readability.php/CHANGELOG.md
create mode 100644 vendor/fivefilters/readability.php/CONTRIBUTING.md
create mode 100644 vendor/fivefilters/readability.php/LICENSE
create mode 100644 vendor/fivefilters/readability.php/Makefile
create mode 100644 vendor/fivefilters/readability.php/README.md
create mode 100644 vendor/fivefilters/readability.php/composer.json
create mode 100644 vendor/fivefilters/readability.php/docker-compose.yml
create mode 100644 vendor/fivefilters/readability.php/docker/php/Dockerfile
create mode 100644 vendor/fivefilters/readability.php/docker/php/build.Dockerfile
create mode 100644 vendor/fivefilters/readability.php/phpunit.xml
create mode 100644 vendor/fivefilters/readability.php/src/Configuration.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMAttr.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCdataSection.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCharacterData.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMComment.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocument.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentFragment.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentType.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntity.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntityReference.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNode.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNodeList.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNotation.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMProcessingInstruction.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/DOM/DOMText.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/NodeTrait.php
create mode 100644 vendor/fivefilters/readability.php/src/Nodes/NodeUtility.php
create mode 100644 vendor/fivefilters/readability.php/src/ParseException.php
create mode 100644 vendor/fivefilters/readability.php/src/Readability.php
create mode 100644 vendor/masterminds/html5/.gitattributes
create mode 100644 vendor/masterminds/html5/.gitignore
create mode 100644 vendor/masterminds/html5/.php_cs.dist
create mode 100644 vendor/masterminds/html5/.scrutinizer.yml
create mode 100644 vendor/masterminds/html5/.travis.yml
create mode 100644 vendor/masterminds/html5/CREDITS
create mode 100644 vendor/masterminds/html5/Jenkinsfile
create mode 100644 vendor/masterminds/html5/LICENSE.txt
create mode 100644 vendor/masterminds/html5/README.md
create mode 100644 vendor/masterminds/html5/RELEASE.md
create mode 100644 vendor/masterminds/html5/UPGRADING.md
create mode 100644 vendor/masterminds/html5/bin/entities.php
create mode 100644 vendor/masterminds/html5/composer.json
create mode 100644 vendor/masterminds/html5/example.php
create mode 100644 vendor/masterminds/html5/phpunit.xml.dist
create mode 100644 vendor/masterminds/html5/src/HTML5.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Elements.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Entities.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Exception.php
create mode 100644 vendor/masterminds/html5/src/HTML5/InstructionProcessor.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/InputStream.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/ParseError.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/README.md
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Serializer/README.md
create mode 100644 vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php
create mode 100644 vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php
create mode 100644 vendor/masterminds/html5/test/HTML5/ElementsTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html
create mode 100644 vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html
create mode 100644 vendor/masterminds/html5/test/HTML5/Html5Test.html
create mode 100644 vendor/masterminds/html5/test/HTML5/Html5Test.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/EventStack.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php
create mode 100644 vendor/masterminds/html5/test/HTML5/TestCase.php
create mode 100644 vendor/masterminds/html5/test/benchmark/example.html
create mode 100644 vendor/masterminds/html5/test/benchmark/run.php
create mode 100644 vendor/psr/log/LICENSE
create mode 100644 vendor/psr/log/Psr/Log/AbstractLogger.php
create mode 100644 vendor/psr/log/Psr/Log/InvalidArgumentException.php
create mode 100644 vendor/psr/log/Psr/Log/LogLevel.php
create mode 100644 vendor/psr/log/Psr/Log/LoggerAwareInterface.php
create mode 100644 vendor/psr/log/Psr/Log/LoggerAwareTrait.php
create mode 100644 vendor/psr/log/Psr/Log/LoggerInterface.php
create mode 100644 vendor/psr/log/Psr/Log/LoggerTrait.php
create mode 100644 vendor/psr/log/Psr/Log/NullLogger.php
create mode 100644 vendor/psr/log/Psr/Log/Test/DummyTest.php
create mode 100644 vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
create mode 100644 vendor/psr/log/Psr/Log/Test/TestLogger.php
create mode 100644 vendor/psr/log/README.md
create mode 100644 vendor/psr/log/composer.json
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..507157f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+# Community rules are a separate upstream checkout: the init container clones them
+# and the plugin keeps them fast-forwarded (HOOK_HOUSE_KEEPING). Vendoring 2000
+# files that someone else maintains would only make them stale.
+/site_config/standard/
+
+# Local feed lists used with bin/audit.php.
+/feeds.txt
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e3ce508
--- /dev/null
+++ b/README.md
@@ -0,0 +1,122 @@
+# af_fulltext
+
+Full-text extraction for [Tiny Tiny RSS](https://github.com/tt-rss/tt-rss), driven
+by [fivefilters/ftr-site-config](https://github.com/fivefilters/ftr-site-config)
+rules, with an optional [Firecrawl](https://github.com/firecrawl/firecrawl) renderer
+for pages that only assemble themselves under JavaScript.
+
+It replaces the older arrangement of subscribing to feed URLs that point at a
+self-hosted Full-Text RSS proxy. Feeds go back to being their real URLs, and
+extraction happens inside tt-rss where you can see and fix it.
+
+## Why not just Readability, or just Firecrawl
+
+Both were measured against a real 34-feed subscription before this was written.
+
+- **Readability alone** is good on prose and useless on image-only pages. A
+ webcomic has no text to score, so it returns the blog note under the strip and
+ drops the strip.
+- **Firecrawl alone** is a superb fetcher and a weak extractor. Asked for a
+ Cloudflare blog post with `onlyMainContent: true` it returned 73KB still
+ containing skip-links, analytics markup and the language-picker footer.
+
+So this plugin uses Firecrawl (when you select it) purely as a *renderer*, asks it
+for `rawHtml`, and does the extraction itself with the community rule set —
+roughly 2000 site configs that encode where the article actually is.
+
+## Rules
+
+Standard ftr-site-config syntax. Supported directives:
+
+`title` `body` `author` `date` `strip` `strip_id_or_class` `strip_image_src`
+`dissolve` `single_page_link` `next_page_link` `find_string` `replace_string`
+`http_header(...)` `wrap_in(...)` `autodetect_on_failure` `test_url`
+
+Resolution order for a host, nearest match first:
+
+```
+site_config/custom/.txt your rules, edited locally
+site_config/custom/..txt
+site_config/standard/.txt the community set
+ ... then without a leading "www."
+ ... then wildcard parents, .example.com.txt
+site_config/standard/global.txt merged underneath whatever matched
+```
+
+`prune` and `tidy` are parsed but not applied. A `body:` rule is already an explicit
+selection, and running a second heuristic pass over it caused more surprises than it
+solved. This is reported in the extraction summary rather than being silent.
+
+## Stale rules are reported, not hidden
+
+This is the reason the plugin exists in this shape. A site redesign turns a `body:`
+rule into a no-op; extraction then falls through to Readability and the article
+still looks plausible, so nothing appears broken. A rule for one of these comics had
+been dead long enough that nobody could say when it broke.
+
+So: every extraction records which rule file matched, whether it selected anything,
+and whether it fell back. The settings pane says how many feeds are currently
+degraded, and each article carries an HTML comment naming its rule.
+
+The first run of `bin/audit.php` over that subscription found **five** community
+rules that no longer matched anything, including the one for this project's own
+test target.
+
+## Command line
+
+The engine in `lib/` has no tt-rss dependencies, so rules can be written and
+checked without a running instance.
+
+```sh
+# Extract one URL and print the text
+php bin/extract.php https://example.com/article
+
+# ... as HTML, through Firecrawl, against a draft rule file
+FIRECRAWL_URL=http://127.0.0.1:3002 \
+ php bin/extract.php https://example.com/article --backend=firecrawl --rule=draft.txt --html
+
+# Extraction health across a whole subscription list
+php bin/audit.php feeds.txt
+```
+
+`bin/php-podman.sh` runs any of these in a pinned PHP container if you have no PHP
+on the machine.
+
+## Install
+
+```sh
+cd /var/www/html/tt-rss/plugins.local
+git clone af_fulltext
+git clone https://github.com/fivefilters/ftr-site-config.git af_fulltext/site_config/standard
+```
+
+Then add `af_fulltext` to `TTRSS_PLUGINS` and enable it per feed in the feed editor.
+tt-rss's own startup script keeps git-backed plugins in `plugins.local` up to date,
+so redeploying is a pull and a restart.
+
+### Settings
+
+| env var | default | meaning |
+|---|---|---|
+| `TTRSS_AF_FULLTEXT_FIRECRAWL_URL` | *(unset)* | Firecrawl base URL; the Firecrawl backend is unavailable without it |
+| `TTRSS_AF_FULLTEXT_FIRECRAWL_KEY` | *(unset)* | bearer token, if your Firecrawl requires one |
+| `TTRSS_AF_FULLTEXT_TIMEOUT` | `20` | per-fetch timeout in seconds |
+| `TTRSS_AF_FULLTEXT_RULES_REPO` | ftr-site-config | git remote the community rules come from |
+| `TTRSS_AF_FULLTEXT_RULES_REFRESH_HOURS` | `24` | how often to fast-forward them; `0` disables |
+
+Rules refresh from the update daemon (`HOOK_HOUSE_KEEPING`), so there is no cron
+entry or sidecar to remember. The refresh is fast-forward only — a divergent
+checkout is left alone and reported.
+
+## Security
+
+Article fetches go through tt-rss's `UrlHelper`, keeping its SSRF protection: feeds
+are attacker-influenced input, and a plugin that fetches whatever a feed points at
+must not be the hole in that. The Firecrawl backend is the deliberate exception,
+since it talks to one operator-configured endpoint that `UrlHelper` would refuse
+precisely for being private.
+
+## Licence
+
+GPL-3.0-or-later, as required for tt-rss plugins. Vendored dependencies keep their
+own licences; local patches to them are recorded in `patches/`.
diff --git a/autoload.php b/autoload.php
new file mode 100644
index 0000000..8ec18f1
--- /dev/null
+++ b/autoload.php
@@ -0,0 +1,16 @@
+xpath('//item') ?: [] as $item) {
+ $link = trim((string) $item->link);
+ if ($link !== '') $out[] = $link;
+ if (count($out) >= $limit) return $out;
+ }
+
+ // Atom
+ $doc->registerXPathNamespace('a', 'http://www.w3.org/2005/Atom');
+ foreach ($doc->xpath('//a:entry') ?: [] as $entry) {
+ $entry->registerXPathNamespace('a', 'http://www.w3.org/2005/Atom');
+ foreach ($entry->xpath('a:link[not(@rel) or @rel="alternate"]') ?: [] as $link) {
+ $href = trim((string) $link['href']);
+ if ($href !== '') { $out[] = $href; break; }
+ }
+ if (count($out) >= $limit) break;
+ }
+
+ return array_slice($out, 0, $limit);
+}
+
+$lines = array_filter(array_map('trim', file($file) ?: []), fn($l) => $l !== '' && !str_starts_with($l, '#'));
+
+printf("%-34s %-9s %-30s %7s %5s %s\n", 'FEED HOST', 'BACKEND', 'HOW', 'BYTES', 'IMGS', 'NOTES');
+printf("%s\n", str_repeat('-', 130));
+
+$totals = ['ok' => 0, 'stale' => 0, 'readability' => 0, 'failed' => 0];
+
+foreach ($lines as $feed_url) {
+ $host = (string) parse_url($feed_url, PHP_URL_HOST);
+
+ $feed = $feed_fetcher->fetch($feed_url);
+ if (!$feed->ok()) {
+ printf("%-34s %-9s %-30s %7s %5s %s\n", substr($host, 0, 34), '-', 'FEED FETCH FAILED', '-', '-', $feed->error);
+ $totals['failed']++;
+ continue;
+ }
+
+ $links = item_links($feed->html, $items);
+ if (!$links) {
+ printf("%-34s %-9s %-30s %7s %5s %s\n", substr($host, 0, 34), '-', 'NO ITEMS', '-', '-', '');
+ $totals['failed']++;
+ continue;
+ }
+
+ foreach ($links as $link) {
+ $r = $extractor->extract($link, $fetcher);
+
+ $how = match (true) {
+ $r->rule_matched => 'rule: ' . basename($r->rule_sources[0] ?? '?'),
+ $r->rule_stale => 'STALE: ' . basename($r->rule_sources[0] ?? '?'),
+ $r->ok() => 'readability',
+ default => 'FAILED',
+ };
+
+ if ($r->rule_matched) $totals['ok']++;
+ elseif ($r->rule_stale) $totals['stale']++;
+ elseif ($r->ok()) $totals['readability']++;
+ else $totals['failed']++;
+
+ printf("%-34s %-9s %-30s %7d %5d %s\n",
+ substr((string) parse_url($link, PHP_URL_HOST), 0, 34),
+ $r->backend, substr($how, 0, 30), strlen($r->html),
+ substr_count($r->html, ' errors, 0, 1)));
+ }
+}
+
+printf("\n%d rule-matched, %d STALE rules, %d readability-only, %d failed\n",
+ $totals['ok'], $totals['stale'], $totals['readability'], $totals['failed']);
diff --git a/bin/extract.php b/bin/extract.php
new file mode 100755
index 0000000..75227b5
--- /dev/null
+++ b/bin/extract.php
@@ -0,0 +1,60 @@
+#!/usr/bin/env php
+ [--backend=direct|firecrawl] [--rule=FILE] [--html] [--quiet]
+ */
+require_once __DIR__ . '/../autoload.php';
+
+use AfFulltext\{CurlFetcher, Extractor, FirecrawlFetcher, RuleSet};
+
+$args = array_slice($argv, 1);
+$opts = ['backend' => 'direct', 'rule' => null, 'html' => false, 'quiet' => false];
+$url = null;
+
+foreach ($args as $arg) {
+ if (str_starts_with($arg, '--backend=')) $opts['backend'] = substr($arg, 10);
+ elseif (str_starts_with($arg, '--rule=')) $opts['rule'] = substr($arg, 7);
+ elseif ($arg === '--html') $opts['html'] = true;
+ elseif ($arg === '--quiet') $opts['quiet'] = true;
+ elseif (!str_starts_with($arg, '--')) $url = $arg;
+}
+
+if (!$url) {
+ fwrite(STDERR, "usage: extract.php [--backend=direct|firecrawl] [--rule=FILE] [--html] [--quiet]\n");
+ exit(2);
+}
+
+$base = dirname(__DIR__);
+$dirs = [$base . '/site_config/custom', $base . '/site_config/standard'];
+
+// --rule points at a single file to try, overriding whatever the site config says.
+if ($opts['rule']) {
+ $tmp = sys_get_temp_dir() . '/af_fulltext_rule_' . getmypid();
+ @mkdir($tmp, 0700, true);
+ $host = strtolower((string) parse_url($url, PHP_URL_HOST));
+ copy($opts['rule'], "$tmp/$host.txt");
+ array_unshift($dirs, $tmp);
+}
+
+$fetcher = $opts['backend'] === 'firecrawl'
+ ? new FirecrawlFetcher(getenv('FIRECRAWL_URL') ?: 'http://127.0.0.1:13002')
+ : new CurlFetcher();
+
+$result = (new Extractor(new RuleSet($dirs)))->extract($url, $fetcher);
+
+if (!$opts['quiet']) {
+ fwrite(STDERR, $result->summary() . "\n");
+ foreach ($result->rule_sources as $s) fwrite(STDERR, " rule: $s\n");
+ foreach ($result->errors as $e) fwrite(STDERR, " error: $e\n");
+ if ($result->title) fwrite(STDERR, " title: {$result->title}\n");
+}
+
+if ($opts['html']) echo $result->html, "\n";
+else echo trim(preg_replace('/\s+/u', ' ', strip_tags($result->html)) ?? ''), "\n";
+
+exit($result->ok() ? 0 : 1);
diff --git a/bin/php-podman.sh b/bin/php-podman.sh
new file mode 100755
index 0000000..d93de52
--- /dev/null
+++ b/bin/php-podman.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+# Run the harness inside a pinned PHP image so results do not depend on whatever
+# PHP happens to be on the host (there is none on this workstation).
+exec podman run --rm --network=host -v "$(cd "$(dirname "$0")/.." && pwd)":/plugin:z -w /plugin \
+ docker.io/library/php:8.4-cli php "$@"
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..ad9280d
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,30 @@
+{
+ "name": "michal/ttrss-plugin-af-fulltext",
+ "description": "Full-text extraction for Tiny Tiny RSS using ftr-site-config rules, with an optional Firecrawl renderer",
+ "license": "GPL-3.0-or-later",
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "repositories": [
+ {
+ "name": "fivefilters/readability.php",
+ "type": "vcs",
+ "url": "https://github.com/tt-rss/tt-rss-readability-php.git"
+ },
+ {
+ "name": "masterminds/html5",
+ "type": "vcs",
+ "url": "https://github.com/tt-rss/tt-rss-html5-php.git"
+ }
+ ],
+ "require": {
+ "php": ">=8.2",
+ "ext-dom": "*",
+ "ext-libxml": "*",
+ "ext-mbstring": "*",
+ "ext-curl": "*",
+ "fivefilters/readability.php": "dev-main"
+ },
+ "autoload": {
+ "psr-4": { "AfFulltext\\": "lib/" }
+ }
+}
diff --git a/feeds.example.txt b/feeds.example.txt
new file mode 100644
index 0000000..07e485f
--- /dev/null
+++ b/feeds.example.txt
@@ -0,0 +1,6 @@
+# One feed URL per line; blank lines and # comments are ignored.
+# Used by bin/audit.php to report extraction health across a subscription list.
+https://blog.cloudflare.com/rss/
+https://www.oglaf.com/feeds/rss/
+https://loadingartist.com/index.xml
+https://xkcd.com/atom.xml
diff --git a/init.js b/init.js
new file mode 100644
index 0000000..5872f1c
--- /dev/null
+++ b/init.js
@@ -0,0 +1,48 @@
+/* global xhr, App, Plugins, Article, Notify */
+
+Plugins.Af_Fulltext = {
+ orig_attr_name: 'data-af-fulltext-orig-content',
+
+ /**
+ * Toggle extracted content in place for one article.
+ *
+ * Doubles as the rule-debugging loop: edit a rule, hit the button, see the
+ * result immediately -- and the notification names the rule that produced it,
+ * so a rule that quietly stopped matching is visible rather than merely
+ * disappointing.
+ */
+ embed: function(id) {
+ const content = document.querySelector(App.isCombinedMode() ?
+ `.cdm[data-article-id="${id}"] .content-inner` :
+ `.post[data-article-id="${id}"] .content`);
+
+ if (!content) return;
+
+ if (content.hasAttribute(this.orig_attr_name)) {
+ content.innerHTML = content.getAttribute(this.orig_attr_name);
+ content.removeAttribute(this.orig_attr_name);
+
+ if (App.isCombinedMode()) Article.cdmMoveToId(id);
+
+ return;
+ }
+
+ Notify.progress("Extracting, please wait...");
+
+ xhr.json("backend.php", App.getPhArgs("af_fulltext", "embed", {id: id}), (reply) => {
+ if (reply && reply.content) {
+ content.setAttribute(this.orig_attr_name, content.innerHTML);
+ content.innerHTML = reply.content;
+
+ Notify.info(reply.summary || "Extracted");
+
+ if (App.isCombinedMode()) Article.cdmMoveToId(id);
+ } else {
+ const why = reply && reply.errors && reply.errors.length ?
+ reply.errors[0] : "no content extracted";
+
+ Notify.error("af_fulltext: " + why);
+ }
+ });
+ }
+};
diff --git a/init.php b/init.php
new file mode 100644
index 0000000..8a30d9f
--- /dev/null
+++ b/init.php
@@ -0,0 +1,475 @@
+ true);
+ }
+
+ function api_version() {
+ return 2;
+ }
+
+ function init($host) {
+ $this->host = $host;
+
+ Config::add(self::CONF_FIRECRAWL_URL, '', Config::T_STRING);
+ Config::add(self::CONF_FIRECRAWL_KEY, '', Config::T_STRING);
+ Config::add(self::CONF_TIMEOUT, '20', Config::T_INT);
+ Config::add(self::CONF_RULES_REPO, 'https://github.com/fivefilters/ftr-site-config.git', Config::T_STRING);
+ Config::add(self::CONF_RULES_REFRESH_HOURS, '24', Config::T_INT);
+
+ $host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
+ $host->add_hook($host::HOOK_PREFS_TAB, $this);
+ $host->add_hook($host::HOOK_PREFS_EDIT_FEED, $this);
+ $host->add_hook($host::HOOK_PREFS_SAVE_FEED, $this);
+ $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
+ $host->add_hook($host::HOOK_HOUSE_KEEPING, $this);
+
+ // Installed unconditionally: init() runs before plugin storage is loaded,
+ // so the enable flag cannot be consulted here.
+ $host->add_hook($host::HOOK_GET_FULL_TEXT, $this);
+
+ $host->add_filter_action($this, 'action_inline', __('Extract full text'));
+ $host->add_filter_action($this, 'action_inline_append', __('Append full text'));
+ }
+
+ function get_js() {
+ return file_get_contents(__DIR__ . '/init.js');
+ }
+
+ // ---------------------------------------------------------------- extraction
+
+ private function rules_dirs(): array {
+ return [__DIR__ . '/site_config/custom', __DIR__ . '/site_config/standard'];
+ }
+
+ private function extractor(): Extractor {
+ return new Extractor(new RuleSet($this->rules_dirs()));
+ }
+
+ private function fetcher(string $backend): Fetcher {
+ $timeout = (int) Config::get(self::CONF_TIMEOUT);
+
+ if ($backend === self::BACKEND_FIRECRAWL) {
+ $endpoint = (string) Config::get(self::CONF_FIRECRAWL_URL);
+
+ if ($endpoint !== '')
+ return new FirecrawlFetcher($endpoint, max($timeout, 60),
+ ((string) Config::get(self::CONF_FIRECRAWL_KEY)) ?: null);
+
+ // Configured per feed but unavailable globally: fall back rather than
+ // silently producing nothing.
+ user_error('af_fulltext: firecrawl requested but ' . self::CONF_FIRECRAWL_URL . ' is unset', E_USER_WARNING);
+ }
+
+ return new TtrssFetcher($timeout);
+ }
+
+ /** Backend selected for a feed, defaulting to direct. */
+ private function backend_for(int $feed_id): string {
+ $map = $this->host->get_array($this, 'backend_feeds');
+
+ return ($map[$feed_id] ?? self::BACKEND_DIRECT) === self::BACKEND_FIRECRAWL
+ ? self::BACKEND_FIRECRAWL
+ : self::BACKEND_DIRECT;
+ }
+
+ private function extract(string $url, string $backend): ExtractResult {
+ return $this->extractor()->extract($url, $this->fetcher($backend));
+ }
+
+ /**
+ * Record what happened for a feed.
+ *
+ * A `body:` rule that stops matching after a site redesign still yields a
+ * plausible-looking article via the Readability fallback, so the degradation is
+ * invisible in the reader. Keeping the last outcome per feed is what lets the
+ * settings pane say so out loud.
+ *
+ * @return void
+ */
+ private function record_health(int $feed_id, ExtractResult $result) {
+ $health = $this->host->get_array($this, 'health');
+
+ $health[$feed_id] = [
+ 'when' => time(),
+ 'summary' => $result->summary(),
+ 'stale' => $result->rule_stale,
+ 'fell_back' => $result->fell_back,
+ 'bytes' => strlen($result->html),
+ 'error' => $result->errors[0] ?? null,
+ ];
+
+ $this->host->set($this, 'health', $health);
+ }
+
+ /**
+ * @param array $article
+ * @return array
+ */
+ function process_article(array $article, bool $append_mode, ?string $backend = null): array {
+ $link = $article['link'] ?? '';
+ if (!$link) return $article;
+
+ $feed_id = (int) ($article['feed']['id'] ?? 0);
+ $backend ??= $this->backend_for($feed_id);
+
+ $result = $this->extract($link, $backend);
+
+ if ($feed_id) $this->record_health($feed_id, $result);
+
+ // Only replace the feed's own summary if we actually got something.
+ if (!$this->has_content($result->html)) return $article;
+
+ $content = $result->html . $this->provenance_comment($result);
+
+ if ($append_mode) $article['content'] .= ' ' . $content;
+ else $article['content'] = $content;
+
+ return $article;
+ }
+
+ /**
+ * An HTML comment naming the rule that produced the article.
+ *
+ * Invisible while reading, and the first thing worth looking at when an
+ * article comes out wrong.
+ */
+ private function provenance_comment(ExtractResult $result): string {
+ return "\n";
+ }
+
+ function hook_article_filter($article) {
+ $enabled = $this->host->get_array($this, 'enabled_feeds');
+ $append = $this->host->get_array($this, 'append_feeds');
+
+ $feed_id = $article['feed']['id'] ?? null;
+
+ if ($feed_id === null || !in_array($feed_id, $enabled)) return $article;
+
+ return $this->process_article($article, in_array($feed_id, $append));
+ }
+
+ function hook_article_filter_action($article, $action) {
+ return match ($action) {
+ 'action_inline' => $this->process_article($article, false),
+ 'action_inline_append' => $this->process_article($article, true),
+ default => $article,
+ };
+ }
+
+ function hook_get_full_text($link) {
+ if (!$this->host->get($this, 'enable_share_anything')) return false;
+
+ $result = $this->extract($link, self::BACKEND_DIRECT);
+
+ return $this->has_content($result->html) ? $result->html : false;
+ }
+
+ /**
+ * Does this survive sanitising as something worth showing?
+ *
+ * Sanitizer::sanitize returns false on failure, so its result cannot be passed
+ * straight to strip_tags. An image-only article has no text at all and must
+ * still count -- for a webcomic the picture IS the content.
+ */
+ private function has_content(string $html): bool {
+ if ($html === '') return false;
+
+ $clean = Sanitizer::sanitize($html);
+ if (!is_string($clean)) return false;
+
+ if (trim(strip_tags($clean)) !== '') return true;
+
+ return (bool) preg_match('/<(img|video|audio|iframe|picture|source|svg|embed)\b/i', $clean);
+ }
+
+ // ------------------------------------------------------------- rule refresh
+
+ /**
+ * Keep the community rules current.
+ *
+ * Runs from the update daemon rather than a separate scheduled job, so the
+ * rules travel with the plugin instead of being someone else's cron entry to
+ * remember. Refreshing is a fast-forward pull only: a conflict means someone
+ * edited the checkout by hand, and overwriting it silently would be worse than
+ * leaving it stale and saying so.
+ *
+ * @return void
+ */
+ function hook_house_keeping() {
+ $hours = (int) Config::get(self::CONF_RULES_REFRESH_HOURS);
+ if ($hours <= 0) return;
+
+ $last = (int) $this->host->get($this, 'rules_refreshed_at');
+ if ($last && time() - $last < $hours * 3600) return;
+
+ $dir = __DIR__ . '/site_config/standard';
+ $repo = (string) Config::get(self::CONF_RULES_REPO);
+
+ if (!is_dir("$dir/.git")) {
+ Debug::log("af_fulltext: $dir is not a git checkout, skipping rule refresh", Debug::LOG_VERBOSE);
+ return;
+ }
+
+ $cmd = sprintf('cd %s && git fetch --quiet --depth 1 origin 2>&1 && git reset --quiet --hard FETCH_HEAD 2>&1',
+ escapeshellarg($dir));
+
+ $output = [];
+ $rc = 0;
+ exec($cmd, $output, $rc);
+
+ // Stamp the attempt either way, so a persistently unreachable remote does
+ // not retry on every single housekeeping pass.
+ $this->host->set($this, 'rules_refreshed_at', time());
+
+ if ($rc !== 0) {
+ $this->host->set($this, 'rules_refresh_error', implode(' ', array_slice($output, 0, 3)));
+ Debug::log('af_fulltext: rule refresh failed: ' . implode(' ', $output), Debug::LOG_VERBOSE);
+ return;
+ }
+
+ $this->host->set($this, 'rules_refresh_error', '');
+ Debug::log("af_fulltext: refreshed site rules from $repo", Debug::LOG_VERBOSE);
+ }
+
+ // --------------------------------------------------------------------- UI
+
+ function hook_article_button($line) {
+ return "article ";
+ }
+
+ function embed(): void {
+ $article_id = (int) $_REQUEST['id'];
+
+ $sth = $this->pdo->prepare('SELECT link, feed_id FROM ttrss_entries e, ttrss_user_entries ue
+ WHERE e.id = ? AND ue.ref_id = e.id AND ue.owner_uid = ?');
+ $sth->execute([$article_id, $_SESSION['uid']]);
+
+ $ret = [];
+
+ if ($row = $sth->fetch()) {
+ $result = $this->extract($row['link'], $this->backend_for((int) $row['feed_id']));
+
+ $ret['content'] = (string) Sanitizer::sanitize($result->html);
+ $ret['summary'] = $result->summary();
+ $ret['errors'] = $result->errors;
+ }
+
+ print json_encode($ret);
+ }
+
+ /** @return void */
+ function save() {
+ $this->host->set($this, 'enable_share_anything',
+ checkbox_to_sql_bool($_POST['enable_share_anything'] ?? ''));
+
+ echo __('Data saved.');
+ }
+
+ function hook_prefs_edit_feed($feed_id) {
+ $enabled = $this->host->get_array($this, 'enabled_feeds');
+ $append = $this->host->get_array($this, 'append_feeds');
+ $backend = $this->backend_for((int) $feed_id);
+ ?>
+
+ = __('Full-text extraction') ?>
+
+
+
+ = \Controls\checkbox_tag('af_fulltext_enabled', in_array($feed_id, $enabled)) ?>
+ = __('Extract full article content') ?>
+
+
+
+
+ = \Controls\checkbox_tag('af_fulltext_append', in_array($feed_id, $append)) ?>
+ = __('Append to the summary instead of replacing it') ?>
+
+
+
+ = __('Fetch using') ?>
+ = \Controls\select_hash('af_fulltext_backend', $backend, [
+ self::BACKEND_DIRECT => __('Direct (fast)'),
+ self::BACKEND_FIRECRAWL => __('Firecrawl (renders JavaScript)'),
+ ]) ?>
+
+
+ toggle($this->host->get_array($this, 'enabled_feeds'), $feed_id,
+ (bool) checkbox_to_sql_bool($_POST['af_fulltext_enabled'] ?? ''));
+
+ $append = $this->toggle($this->host->get_array($this, 'append_feeds'), $feed_id,
+ (bool) checkbox_to_sql_bool($_POST['af_fulltext_append'] ?? ''));
+
+ $backends = $this->host->get_array($this, 'backend_feeds');
+ $chosen = $_POST['af_fulltext_backend'] ?? self::BACKEND_DIRECT;
+
+ if ($chosen === self::BACKEND_FIRECRAWL) $backends[$feed_id] = self::BACKEND_FIRECRAWL;
+ else unset($backends[$feed_id]);
+
+ $this->host->set($this, 'enabled_feeds', $enabled);
+ $this->host->set($this, 'append_feeds', $append);
+ $this->host->set($this, 'backend_feeds', $backends);
+ }
+
+ /**
+ * @param array $list
+ * @return array
+ */
+ private function toggle(array $list, $feed_id, bool $on): array {
+ $key = array_search($feed_id, $list);
+
+ if ($on && $key === false) $list[] = $feed_id;
+ elseif (!$on && $key !== false) unset($list[$key]);
+
+ return array_values($list);
+ }
+
+ function hook_prefs_tab($args) {
+ if ($args != 'prefFeeds') return;
+
+ $enable_share_anything = sql_bool_to_bool($this->host->get($this, 'enable_share_anything'));
+
+ $enabled = $this->filter_unknown_feeds($this->host->get_array($this, 'enabled_feeds'));
+ $this->host->set($this, 'enabled_feeds', $enabled);
+
+ $append = $this->host->get_array($this, 'append_feeds');
+ $health = $this->host->get_array($this, 'health');
+ $refreshed = (int) $this->host->get($this, 'rules_refreshed_at');
+ $refresh_error = (string) $this->host->get($this, 'rules_refresh_error');
+
+ $rule_count = count(glob(__DIR__ . '/site_config/standard/*.txt') ?: [])
+ + count(glob(__DIR__ . '/site_config/custom/*.txt') ?: []);
+
+ $degraded = array_filter($health, fn($h) => !empty($h['stale']));
+ ?>
+
+
+ = format_notice('Enable per feed in the feed editor. ' . $rule_count . ' site rules loaded'
+ . ($refreshed ? ', refreshed ' . date('Y-m-d H:i', $refreshed) : ', never refreshed') . '.') ?>
+
+
+ = format_warning('Rule refresh failed: ' . htmlspecialchars($refresh_error)) ?>
+
+
+
+ = format_warning(sprintf(
+ '%d feed(s) have a site rule that no longer matches anything and are falling back to Readability. '
+ . 'That usually means the site was redesigned and the rule needs updating.',
+ count($degraded))) ?>
+
+
+
+
+ 0) { ?>
+
+
= __('Currently enabled for (click to edit):') ?>
+
+
+
+
+ $feeds
+ * @return array
+ */
+ private function filter_unknown_feeds(array $feeds): array {
+ $out = [];
+
+ foreach ($feeds as $feed) {
+ $sth = $this->pdo->prepare('SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?');
+ $sth->execute([$feed, $_SESSION['uid']]);
+
+ if ($sth->fetch()) $out[] = $feed;
+ }
+
+ return $out;
+ }
+}
diff --git a/lib/CurlFetcher.php b/lib/CurlFetcher.php
new file mode 100644
index 0000000..0a72fd9
--- /dev/null
+++ b/lib/CurlFetcher.php
@@ -0,0 +1,74 @@
+ $v) $hdr[] = "$k: $v";
+
+ curl_setopt_array($ch, [
+ CURLOPT_URL => $url,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_MAXREDIRS => 8,
+ CURLOPT_TIMEOUT => $this->timeout,
+ CURLOPT_CONNECTTIMEOUT => 10,
+ CURLOPT_ENCODING => '',
+ CURLOPT_USERAGENT => $headers['user-agent'] ?? $this->user_agent,
+ CURLOPT_HTTPHEADER => $hdr,
+ ]);
+
+ $body = curl_exec($ch);
+ $err = curl_error($ch);
+ $status = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
+ $effective = (string) curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+ $content_type = (string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
+ curl_close($ch);
+
+ if ($err !== '' || !is_string($body))
+ return new FetchResult(error: $err !== '' ? $err : 'empty response', status: $status, effective_url: $effective ?: $url);
+
+ if ($status >= 400)
+ return new FetchResult(error: "HTTP $status", status: $status, effective_url: $effective ?: $url);
+
+ return new FetchResult(
+ html: self::to_utf8($body, $content_type),
+ effective_url: $effective ?: $url,
+ status: $status,
+ );
+ }
+
+ /**
+ * Normalise to UTF-8. Several of these feeds are Polish, and a page served as
+ * ISO-8859-2 that is treated as UTF-8 loses every accented character.
+ */
+ public static function to_utf8(string $body, string $content_type): string {
+ $charset = '';
+
+ if (preg_match('/charset=["\']?([\w-]+)/i', $content_type, $m)) $charset = $m[1];
+
+ if ($charset === '' && preg_match('/ ]+charset=["\']?([\w-]+)/i', substr($body, 0, 4096), $m))
+ $charset = $m[1];
+
+ if ($charset === '' || preg_match('/^utf-?8$/i', $charset)) return $body;
+
+ $converted = @mb_convert_encoding($body, 'UTF-8', $charset);
+
+ return is_string($converted) && $converted !== '' ? $converted : $body;
+ }
+}
diff --git a/lib/ExtractResult.php b/lib/ExtractResult.php
new file mode 100644
index 0000000..a880774
--- /dev/null
+++ b/lib/ExtractResult.php
@@ -0,0 +1,57 @@
+html !== '';
+ }
+
+ /** One-line summary for logs and the prefs UI. */
+ public function summary(): string {
+ $rule = $this->rule_sources ? basename($this->rule_sources[0]) : 'none';
+
+ $how = match (true) {
+ $this->rule_matched => "rule=$rule",
+ $this->rule_stale => "rule=$rule STALE->readability",
+ default => 'readability',
+ };
+
+ return sprintf('%s %s %db %dms%s', $this->backend, $how, strlen($this->html),
+ $this->timing_ms, $this->pages > 1 ? " pages={$this->pages}" : '');
+ }
+}
diff --git a/lib/Extractor.php b/lib/Extractor.php
new file mode 100644
index 0000000..29013c7
--- /dev/null
+++ b/lib/Extractor.php
@@ -0,0 +1,361 @@
+backend = $fetcher->name();
+ $result->effective_url = $url;
+
+ $host = strtolower((string) parse_url($url, PHP_URL_HOST));
+ $rule = $this->rules->find($host);
+
+ if ($rule) $result->rule_sources = $rule->sources;
+
+ $fetched = $fetcher->fetch($url, $rule?->http_headers ?? []);
+
+ if (!$fetched->ok()) {
+ $result->errors[] = $fetched->error ?? 'fetch failed';
+ $result->timing_ms = (int) round((microtime(true) - $started) * 1000);
+ return $result;
+ }
+
+ if (strlen($fetched->html) > $this->max_bytes)
+ $result->errors[] = sprintf('page is %dKB, truncating parse', strlen($fetched->html) / 1024);
+
+ $result->effective_url = $fetched->effective_url ?: $url;
+
+ $doc = Html::parse(substr($fetched->html, 0, $this->max_bytes));
+ $base = Html::base_url($doc, $result->effective_url);
+
+ // A print/single-page view, where one exists, is both cleaner and cheaper
+ // to extract than following next_page_link through N requests.
+ if ($rule && $rule->single_page_links) {
+ $single = $this->first_url($doc, $rule->single_page_links, $base);
+
+ if ($single && $single !== $result->effective_url) {
+ $again = $fetcher->fetch($single, $rule->http_headers);
+
+ if ($again->ok()) {
+ $doc = Html::parse(substr($again->html, 0, $this->max_bytes));
+ $result->effective_url = $again->effective_url ?: $single;
+ $base = Html::base_url($doc, $result->effective_url);
+ } else {
+ $result->errors[] = 'single_page_link: ' . ($again->error ?? 'failed');
+ }
+ }
+ }
+
+ $html = $this->extract_from_doc($doc, $base, $rule, $result);
+
+ // Multi-page articles: keep appending until the chain ends or we hit the cap.
+ if ($rule && $rule->next_page_links) {
+ $seen = [$result->effective_url => true];
+ $current = $doc;
+ $current_base = $base;
+
+ while ($result->pages < self::MAX_PAGES) {
+ $next = $this->first_url($current, $rule->next_page_links, $current_base);
+ if (!$next || isset($seen[$next])) break;
+
+ $seen[$next] = true;
+ $page = $fetcher->fetch($next, $rule->http_headers);
+
+ if (!$page->ok()) { $result->errors[] = 'next_page_link: ' . ($page->error ?? 'failed'); break; }
+
+ $current = Html::parse(substr($page->html, 0, $this->max_bytes));
+ $current_base = Html::base_url($current, $page->effective_url ?: $next);
+
+ $more = $this->extract_from_doc($current, $current_base, $rule, new ExtractResult());
+ if ($more === '') break;
+
+ $html .= "\n" . $more;
+ $result->pages++;
+ }
+ }
+
+ if ($rule) {
+ $html = $this->apply_replacements($html, $rule);
+ $html = $this->apply_wrap_in($html, $rule);
+ }
+
+ $result->html = trim($html);
+ $result->timing_ms = (int) round((microtime(true) - $started) * 1000);
+
+ return $result;
+ }
+
+ /**
+ * Run the rule pipeline over one parsed document.
+ *
+ * Order matters: lazy images are resolved and URLs made absolute before
+ * anything is removed or selected, so every later step sees the same, final
+ * attribute values.
+ */
+ private function extract_from_doc(\DOMDocument $doc, string $base, ?Rule $rule, ExtractResult $result): string {
+ Html::unlazy($doc);
+ Html::absolutize($doc, $base);
+
+ $xpath = new \DOMXPath($doc);
+
+ if ($rule) {
+ $this->apply_removals($doc, $xpath, $rule);
+ $this->apply_dissolve($xpath, $rule);
+
+ $result->title ??= $this->first_string($xpath, $rule->titles);
+ $result->author ??= $this->first_string($xpath, $rule->authors);
+ $result->date ??= $this->first_string($xpath, $rule->dates);
+ }
+
+ if ($rule && $rule->bodies) {
+ $nodes = $this->select_body($xpath, $rule->bodies);
+
+ if ($nodes) {
+ $result->rule_matched = true;
+
+ $out = '';
+ foreach ($nodes as $node) {
+ Html::sanitize($node);
+ $out .= Html::outer_html($node) . "\n";
+ }
+
+ return trim($out);
+ }
+
+ // A rule exists and selected nothing. Almost always a site redesign.
+ $result->rule_stale = true;
+ $result->errors[] = 'body rule matched no nodes (' . implode(', ', $rule->bodies) . ')';
+
+ if (!$rule->autodetect_on_failure) return '';
+ }
+
+ $result->fell_back = true;
+
+ return $this->readability($doc, $base, $result);
+ }
+
+ /** @return \DOMNode[] */
+ private function select_body(\DOMXPath $xpath, array $expressions): array {
+ $nodes = [];
+
+ foreach ($expressions as $expr) {
+ $found = @$xpath->query($expr);
+ if ($found === false) continue;
+
+ foreach ($found as $node) {
+ if (Html::text_length($node) > 0 || $this->has_media($node)) $nodes[] = $node;
+ }
+ }
+
+ return $nodes;
+ }
+
+ /**
+ * A node with no text is not necessarily empty -- on a webcomic the entire
+ * article is a single , and discarding it for having no words is exactly
+ * the bug this plugin exists to fix.
+ */
+ private const MEDIA_TAGS = ['img', 'video', 'audio', 'iframe', 'picture', 'source', 'svg', 'embed', 'object'];
+
+ private function has_media(\DOMNode $node): bool {
+ if (!$node instanceof \DOMElement && !$node instanceof \DOMDocument) return false;
+
+ // The node may BE the media. `body: //img[@id='strip']` is a perfectly
+ // ordinary rule for an image-only comic, and only looking at descendants
+ // throws that selection away.
+ if ($node instanceof \DOMElement && in_array(strtolower($node->tagName), self::MEDIA_TAGS, true))
+ return true;
+
+ $doc = $node instanceof \DOMDocument ? $node : $node->ownerDocument;
+ if (!$doc) return false;
+
+ $query = implode(' | ', array_map(fn(string $t) => ".//$t", self::MEDIA_TAGS));
+ $found = @(new \DOMXPath($doc))->query($query, $node);
+
+ return $found !== false && $found->length > 0;
+ }
+
+ private function apply_removals(\DOMDocument $doc, \DOMXPath $xpath, Rule $rule): void {
+ foreach ($rule->strips as $expr) {
+ $found = @$xpath->query($expr);
+ if ($found === false) continue;
+ foreach (iterator_to_array($found) as $node) $node->parentNode?->removeChild($node);
+ }
+
+ foreach ($rule->strip_id_or_class as $needle) {
+ $q = $this->contains_lower('@id', $needle) . ' or ' . $this->contains_lower('@class', $needle);
+ $found = @$xpath->query("//*[$q]");
+ if ($found === false) continue;
+ foreach (iterator_to_array($found) as $node) $node->parentNode?->removeChild($node);
+ }
+
+ foreach ($rule->strip_image_src as $needle) {
+ $found = @$xpath->query('//img[' . $this->contains_lower('@src', $needle) . ']');
+ if ($found === false) continue;
+ foreach (iterator_to_array($found) as $node) $node->parentNode?->removeChild($node);
+ }
+ }
+
+ /** Case-insensitive substring test, spelled out because XPath 1.0 has no lower-case(). */
+ private function contains_lower(string $attr, string $needle): string {
+ $upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $lower = 'abcdefghijklmnopqrstuvwxyz';
+ $q = $this->xpath_literal(strtolower($needle));
+
+ return "contains(translate($attr, '$upper', '$lower'), $q)";
+ }
+
+ /** Quote a string for XPath 1.0, which has no escape syntax. */
+ private function xpath_literal(string $s): string {
+ if (!str_contains($s, "'")) return "'$s'";
+ if (!str_contains($s, '"')) return "\"$s\"";
+
+ return 'concat(' . implode(", \"'\", ", array_map(fn($p) => "'$p'", explode("'", $s))) . ')';
+ }
+
+ /** Replace matched elements with their own children. */
+ private function apply_dissolve(\DOMXPath $xpath, Rule $rule): void {
+ foreach ($rule->dissolve as $expr) {
+ $found = @$xpath->query($expr);
+ if ($found === false) continue;
+
+ foreach (iterator_to_array($found) as $node) {
+ $parent = $node->parentNode;
+ if (!$parent) continue;
+
+ while ($node->firstChild) $parent->insertBefore($node->firstChild, $node);
+ $parent->removeChild($node);
+ }
+ }
+ }
+
+ /**
+ * Readability fallback.
+ *
+ * The engine emits notices on malformed pages (null property reads on
+ * documents with no discernible body). Those must not reach output: inside
+ * tt-rss this runs mid-request and a stray warning corrupts the response. So
+ * diagnostics are captured into the result instead of being printed, and the
+ * previous handler is always restored.
+ */
+ private function readability(\DOMDocument $doc, string $base, ExtractResult $result): string {
+ $config = new Configuration();
+ $config->setOriginalURL($base);
+ $config->setFixRelativeURLs(true);
+ $config->setParser('html5');
+ // Class names carry meaning for downstream styling and for anyone writing
+ // a rule off the extracted output.
+ $config->setKeepClasses(true);
+
+ $notices = [];
+
+ set_error_handler(function (int $no, string $msg) use (&$notices): bool {
+ $notices[] = $msg;
+ return true;
+ });
+
+ try {
+ $readability = new Readability($config);
+ $readability->parse((string) $doc->saveHTML());
+
+ $result->title ??= $readability->getTitle();
+ $result->author ??= $readability->getAuthor();
+
+ $content = (string) $readability->getContent();
+ } catch (\Throwable $e) {
+ $result->errors[] = 'readability: ' . $e->getMessage();
+ $content = '';
+ } finally {
+ restore_error_handler();
+ }
+
+ if ($notices)
+ $result->errors[] = sprintf('readability emitted %d notice(s): %s',
+ count($notices), $notices[0]);
+
+ return $content;
+ }
+
+ private function apply_replacements(string $html, Rule $rule): string {
+ foreach ($rule->find_strings as $i => $find) {
+ $replace = $rule->replace_strings[$i] ?? '';
+ if ($find !== '') $html = str_replace($find, $replace, $html);
+ }
+
+ return $html;
+ }
+
+ private function apply_wrap_in(string $html, Rule $rule): string {
+ // wrap_in targets nodes in the source document; applying it to the
+ // already-serialized result would need a reparse for little gain, so v1
+ // only honours a document-wide wrapper.
+ foreach ($rule->wrap_in as $expr => $spec) {
+ if ($expr !== '//*' && $expr !== '/') continue;
+
+ [$tag, $class] = array_pad(explode('.', $spec, 2), 2, null);
+ $tag = $tag ?: 'div';
+ $attr = $class ? ' class="' . htmlspecialchars($class, ENT_QUOTES) . '"' : '';
+ $html = "<$tag$attr>$html$tag>";
+ }
+
+ return $html;
+ }
+
+ /** First non-empty string value produced by any of the expressions. */
+ private function first_string(\DOMXPath $xpath, array $expressions): ?string {
+ foreach ($expressions as $expr) {
+ $value = @$xpath->evaluate($expr);
+
+ if (is_string($value) && trim($value) !== '') return trim($value);
+
+ if ($value instanceof \DOMNodeList && $value->length > 0) {
+ $text = trim((string) $value->item(0)?->textContent);
+ if ($text !== '') return $text;
+ }
+ }
+
+ return null;
+ }
+
+ /** First absolute URL produced by any of the expressions. */
+ private function first_url(\DOMDocument $doc, array $expressions, string $base): ?string {
+ $xpath = new \DOMXPath($doc);
+
+ foreach ($expressions as $expr) {
+ $value = @$xpath->evaluate($expr);
+ $raw = null;
+
+ if (is_string($value) && trim($value) !== '') {
+ $raw = trim($value);
+ } elseif ($value instanceof \DOMNodeList && $value->length > 0) {
+ $node = $value->item(0);
+ $raw = $node instanceof \DOMElement ? ($node->getAttribute('href') ?: trim($node->textContent))
+ : trim((string) $node?->nodeValue);
+ }
+
+ if ($raw) return Html::resolve($raw, $base);
+ }
+
+ return null;
+ }
+}
diff --git a/lib/Fetcher.php b/lib/Fetcher.php
new file mode 100644
index 0000000..0ac413e
--- /dev/null
+++ b/lib/Fetcher.php
@@ -0,0 +1,29 @@
+error === null && $this->html !== '';
+ }
+}
+
+/**
+ * How a page's HTML is obtained. Kept behind an interface so the extraction
+ * pipeline is identical whether the markup came from a plain HTTP GET or from a
+ * headless browser -- and so the engine can be exercised from the CLI without
+ * tt-rss present.
+ */
+interface Fetcher {
+ /** @param array $headers extra request headers (lowercased names) */
+ public function fetch(string $url, array $headers = []): FetchResult;
+
+ /** Short identifier used in logs and the prefs UI. */
+ public function name(): string;
+}
diff --git a/lib/FirecrawlFetcher.php b/lib/FirecrawlFetcher.php
new file mode 100644
index 0000000..bfb2b16
--- /dev/null
+++ b/lib/FirecrawlFetcher.php
@@ -0,0 +1,80 @@
+ $url,
+ 'formats' => ['rawHtml'],
+ // Firecrawl's own boilerplate stripping is deliberately off; see above.
+ 'onlyMainContent' => false,
+ 'timeout' => $this->timeout * 1000,
+ ];
+
+ if ($headers) $payload['headers'] = $headers;
+
+ $request_headers = ['Content-Type: application/json'];
+ if ($this->api_key) $request_headers[] = 'Authorization: Bearer ' . $this->api_key;
+
+ $ch = curl_init();
+ curl_setopt_array($ch, [
+ CURLOPT_URL => rtrim($this->endpoint, '/') . '/v1/scrape',
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_SLASHES),
+ CURLOPT_HTTPHEADER => $request_headers,
+ CURLOPT_RETURNTRANSFER => true,
+ // The browser render dominates; allow slack over the scrape timeout.
+ CURLOPT_TIMEOUT => $this->timeout + 15,
+ CURLOPT_CONNECTTIMEOUT => 10,
+ ]);
+
+ $body = curl_exec($ch);
+ $err = curl_error($ch);
+ $status = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
+ curl_close($ch);
+
+ if ($err !== '' || !is_string($body))
+ return new FetchResult(error: 'firecrawl: ' . ($err !== '' ? $err : 'empty response'), status: $status);
+
+ $json = json_decode($body, true);
+ if (!is_array($json))
+ return new FetchResult(error: 'firecrawl: unparseable response', status: $status);
+
+ if (empty($json['success'])) {
+ $msg = is_string($json['error'] ?? null) ? $json['error'] : "HTTP $status";
+ return new FetchResult(error: "firecrawl: $msg", status: $status);
+ }
+
+ $data = $json['data'] ?? [];
+ $html = $data['rawHtml'] ?? $data['html'] ?? '';
+
+ if (!is_string($html) || $html === '')
+ return new FetchResult(error: 'firecrawl: no html in response', status: $status);
+
+ $effective = $data['metadata']['sourceURL'] ?? $data['metadata']['url'] ?? $url;
+
+ return new FetchResult(
+ html: $html,
+ effective_url: is_string($effective) ? $effective : $url,
+ status: $status,
+ );
+ }
+}
diff --git a/lib/Html.php b/lib/Html.php
new file mode 100644
index 0000000..4c7978e
--- /dev/null
+++ b/lib/Html.php
@@ -0,0 +1,259 @@
+, custom elements); libxml is
+ * the fallback because it copes with badly broken pages that make the HTML5
+ * parser give up.
+ */
+ public static function parse(string $html): \DOMDocument {
+ $html = self::strip_bom($html);
+
+ try {
+ $doc = (new HTML5(['disable_html_ns' => true]))->loadHTML($html);
+ if ($doc->documentElement !== null) return $doc;
+ } catch (\Throwable) {
+ // fall through
+ }
+
+ $doc = new \DOMDocument();
+ $prev = libxml_use_internal_errors(true);
+ // Force UTF-8: libxml assumes ISO-8859-1 without a meta charset, which
+ // silently mojibakes every non-ASCII article (most of these feeds are Polish).
+ $doc->loadHTML('' . $html, LIBXML_NOWARNING | LIBXML_NOERROR);
+ libxml_clear_errors();
+ libxml_use_internal_errors($prev);
+
+ return $doc;
+ }
+
+ private static function strip_bom(string $s): string {
+ return str_starts_with($s, "\xEF\xBB\xBF") ? substr($s, 3) : $s;
+ }
+
+ /** Effective base URL for a document: its if present, else $url. */
+ public static function base_url(\DOMDocument $doc, string $url): string {
+ $base = (new \DOMXPath($doc))->query('//base[@href]');
+ if ($base && $base->length > 0) {
+ $href = trim(($base->item(0) instanceof \DOMElement) ? $base->item(0)->getAttribute('href') : '');
+ if ($href !== '') return self::resolve($href, $url);
+ }
+ return $url;
+ }
+
+ /** Resolve a possibly-relative URL against a base. */
+ public static function resolve(string $href, string $base): string {
+ $href = trim($href);
+ if ($href === '') return $base;
+ if (preg_match('#^[a-z][a-z0-9+.-]*:#i', $href) || str_starts_with($href, '#')) return $href;
+
+ $b = parse_url($base);
+ if (!$b || empty($b['scheme']) || empty($b['host'])) return $href;
+
+ $origin = $b['scheme'] . '://' . $b['host'] . (isset($b['port']) ? ':' . $b['port'] : '');
+
+ if (str_starts_with($href, '//')) return $b['scheme'] . ':' . $href;
+ if (str_starts_with($href, '/')) return $origin . self::normalize_path($href);
+
+ $dir = isset($b['path']) ? preg_replace('#/[^/]*$#', '/', $b['path']) : '/';
+ return $origin . self::normalize_path(($dir ?: '/') . $href);
+ }
+
+ /** Collapse ./ and ../ segments. */
+ private static function normalize_path(string $path): string {
+ [$path, $tail] = array_pad(explode('?', $path, 2), 2, null);
+ $out = [];
+
+ foreach (explode('/', $path) as $seg) {
+ if ($seg === '.' || $seg === '') continue;
+ if ($seg === '..') { array_pop($out); continue; }
+ $out[] = $seg;
+ }
+
+ $result = '/' . implode('/', $out);
+ if (str_ends_with($path, '/') && !str_ends_with($result, '/')) $result .= '/';
+
+ return $tail !== null ? $result . '?' . $tail : $result;
+ }
+
+ /** Rewrite every relative URL in the tree to an absolute one. */
+ public static function absolutize(\DOMNode $ctx, string $base): void {
+ $xpath = new \DOMXPath(self::owner($ctx));
+
+ foreach (['href', 'src', 'poster', 'data-src', 'longdesc'] as $attr) {
+ foreach ($xpath->query(".//*[@$attr]", $ctx) ?: [] as $el) {
+ if (!$el instanceof \DOMElement) continue;
+ $v = $el->getAttribute($attr);
+ if ($v !== '' && !str_starts_with($v, 'data:'))
+ $el->setAttribute($attr, self::resolve($v, $base));
+ }
+ }
+
+ foreach ($xpath->query('.//*[@srcset]', $ctx) ?: [] as $el) {
+ if (!$el instanceof \DOMElement) continue;
+ $el->setAttribute('srcset', self::absolutize_srcset($el->getAttribute('srcset'), $base));
+ }
+ }
+
+ private static function absolutize_srcset(string $srcset, string $base): string {
+ $out = [];
+
+ foreach (explode(',', $srcset) as $part) {
+ $part = trim($part);
+ if ($part === '') continue;
+ $bits = preg_split('/\s+/', $part, 2);
+ $url = self::resolve($bits[0], $base);
+ $out[] = isset($bits[1]) ? "$url {$bits[1]}" : $url;
+ }
+
+ return implode(', ', $out);
+ }
+
+ /**
+ * Promote lazy-loading placeholders to a real src.
+ *
+ * This is what makes webcomics work: the panel is routinely a 1x1 gif or a
+ * data: URI until the site's JS swaps in data-src, so an extractor that only
+ * reads @src produces an article with no picture in it.
+ */
+ public static function unlazy(\DOMNode $ctx): void {
+ $xpath = new \DOMXPath(self::owner($ctx));
+
+ foreach ($xpath->query('.//img', $ctx) ?: [] as $img) {
+ if (!$img instanceof \DOMElement) continue;
+
+ $src = trim($img->getAttribute('src'));
+
+ if (!self::is_placeholder($src)) {
+ // A real src, but a srcset may still offer a larger rendition.
+ if ($src === '' && ($best = self::best_from_srcset($img->getAttribute('srcset'))))
+ $img->setAttribute('src', $best);
+ continue;
+ }
+
+ $replacement = '';
+
+ foreach (['data-src', 'data-original', 'data-lazy-src', 'data-url', 'data-full-src'] as $attr) {
+ $v = trim($img->getAttribute($attr));
+ if ($v !== '' && !self::is_placeholder($v)) { $replacement = $v; break; }
+ }
+
+ if ($replacement === '')
+ foreach (['data-srcset', 'srcset', 'data-lazy-srcset'] as $attr)
+ if ($best = self::best_from_srcset($img->getAttribute($attr))) { $replacement = $best; break; }
+
+ if ($replacement !== '') $img->setAttribute('src', $replacement);
+
+ self::drop_lazy_attrs($img);
+ }
+
+ // with no usable underneath.
+ foreach ($xpath->query('.//picture', $ctx) ?: [] as $pic) {
+ if (!$pic instanceof \DOMElement) continue;
+
+ $imgs = (new \DOMXPath(self::owner($ctx)))->query('.//img', $pic);
+ $img = ($imgs && $imgs->length) ? $imgs->item(0) : null;
+ if (!$img instanceof \DOMElement || !self::is_placeholder(trim($img->getAttribute('src')))) continue;
+
+ foreach ((new \DOMXPath(self::owner($ctx)))->query('.//source[@srcset]', $pic) ?: [] as $source) {
+ if (!$source instanceof \DOMElement) continue;
+ if ($best = self::best_from_srcset($source->getAttribute('srcset'))) {
+ $img->setAttribute('src', $best);
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Drop the lazy-loading attributes once their value has been promoted.
+ *
+ * Left in place they roughly double the stored article -- tapas.io signs every
+ * panel URL, so each image carries its full token twice.
+ */
+ private static function drop_lazy_attrs(\DOMElement $img): void {
+ foreach (['data-src', 'data-original', 'data-lazy-src', 'data-url',
+ 'data-full-src', 'data-srcset', 'data-lazy-srcset'] as $attr)
+ if ($img->hasAttribute($attr)) $img->removeAttribute($attr);
+ }
+
+ private static function is_placeholder(string $src): bool {
+ if ($src === '') return true;
+ if (str_starts_with($src, 'data:')) return true;
+
+ return (bool) preg_match('#(^|/)(blank|spacer|placeholder|transparent|lazy|1x1|pixel)[^/]*\.(gif|png|svg|webp)$#i', $src);
+ }
+
+ /** Largest candidate in a srcset, by width or pixel density. */
+ private static function best_from_srcset(string $srcset): ?string {
+ $best = null;
+ $best_score = -1.0;
+
+ foreach (explode(',', $srcset) as $part) {
+ $part = trim($part);
+ if ($part === '') continue;
+
+ $bits = preg_split('/\s+/', $part, 2);
+ $url = $bits[0] ?? '';
+ if ($url === '' || self::is_placeholder($url)) continue;
+
+ $score = 1.0;
+ if (isset($bits[1]) && preg_match('/^([\d.]+)([wx])$/', trim($bits[1]), $m))
+ $score = $m[2] === 'w' ? (float) $m[1] : (float) $m[1] * 1000;
+
+ if ($score > $best_score) { $best_score = $score; $best = $url; }
+ }
+
+ return $best;
+ }
+
+ /** Remove scripts, styles, inline event handlers and other non-content noise. */
+ public static function sanitize(\DOMNode $ctx): void {
+ $xpath = new \DOMXPath(self::owner($ctx));
+
+ foreach ($xpath->query('.//script | .//style | .//noscript | .//template | .//link | .//meta', $ctx) ?: [] as $el)
+ $el->parentNode?->removeChild($el);
+
+ foreach ($xpath->query('.//@*', $ctx) ?: [] as $attr) {
+ if (!$attr instanceof \DOMAttr) continue;
+
+ $name = strtolower($attr->name);
+ $owner = $attr->ownerElement;
+ if (!$owner) continue;
+
+ if (str_starts_with($name, 'on') || $name === 'style')
+ $owner->removeAttribute($attr->name);
+
+ if (in_array($name, ['href', 'src', 'action'], true) && preg_match('/^\s*javascript:/i', $attr->value))
+ $owner->removeAttribute($attr->name);
+ }
+ }
+
+ /** Serialize a node's children (its inner HTML). */
+ public static function inner_html(\DOMNode $node): string {
+ $doc = self::owner($node);
+ $out = '';
+
+ foreach ($node->childNodes as $child)
+ $out .= $doc->saveHTML($child);
+
+ return trim($out);
+ }
+
+ public static function outer_html(\DOMNode $node): string {
+ return trim((string) self::owner($node)->saveHTML($node));
+ }
+
+ public static function text_length(\DOMNode $node): int {
+ return mb_strlen(trim(preg_replace('/\s+/u', ' ', $node->textContent) ?? ''));
+ }
+
+ private static function owner(\DOMNode $node): \DOMDocument {
+ return $node instanceof \DOMDocument ? $node : ($node->ownerDocument ?? new \DOMDocument());
+ }
+}
diff --git a/lib/Rule.php b/lib/Rule.php
new file mode 100644
index 0000000..4278d4a
--- /dev/null
+++ b/lib/Rule.php
@@ -0,0 +1,68 @@
+ */ public array $http_headers = [];
+ /** @var array map of xpath => wrapper spec e.g. "div.foo" */
+ public array $wrap_in = [];
+
+ public bool $prune = true;
+ public bool $tidy = true;
+ public bool $autodetect_on_failure = true;
+
+ /**
+ * Files this rule was assembled from, nearest-match first. Surfaced in the
+ * UI so a stale rule is visible rather than silently falling through to
+ * Readability -- the exact failure mode that hid a broken comic rule for
+ * years.
+ *
+ * @var string[]
+ */
+ public array $sources = [];
+
+ public function is_empty(): bool {
+ return !$this->bodies && !$this->strips && !$this->strip_id_or_class
+ && !$this->strip_image_src && !$this->titles && !$this->dissolve;
+ }
+
+ /** Merge $other UNDER $this: existing scalars win, list directives concatenate. */
+ public function merge_under(self $other): self {
+ $m = clone $this;
+
+ foreach (['titles', 'bodies', 'authors', 'dates', 'single_page_links', 'next_page_links'] as $f)
+ if (!$m->$f) $m->$f = $other->$f;
+
+ foreach (['strips', 'strip_id_or_class', 'strip_image_src', 'dissolve', 'test_urls'] as $f)
+ $m->$f = array_values(array_unique([...$m->$f, ...$other->$f]));
+
+ // find/replace are positional pairs -- appending keeps them aligned.
+ $m->find_strings = [...$m->find_strings, ...$other->find_strings];
+ $m->replace_strings = [...$m->replace_strings, ...$other->replace_strings];
+
+ $m->http_headers = $m->http_headers + $other->http_headers;
+ $m->wrap_in = $m->wrap_in + $other->wrap_in;
+ $m->sources = [...$m->sources, ...$other->sources];
+
+ return $m;
+ }
+}
diff --git a/lib/RuleSet.php b/lib/RuleSet.php
new file mode 100644
index 0000000..6d94aac
--- /dev/null
+++ b/lib/RuleSet.php
@@ -0,0 +1,148 @@
+ */
+ private array $cache = [];
+
+ /** @param string[] $dirs */
+ public function __construct(array $dirs) {
+ $this->dirs = array_values(array_filter($dirs, 'is_dir'));
+ }
+
+ /**
+ * Resolve the rule for a hostname, or null if nothing matches.
+ *
+ * Order follows Full-Text RSS: exact host, then the same host without a
+ * leading "www.", then a wildcard file (".example.com.txt") for each parent
+ * domain. global.txt is merged underneath whatever matched, so its shared
+ * strip rules apply everywhere.
+ */
+ public function find(string $host): ?Rule {
+ $host = strtolower(trim($host));
+ if ($host === '') return null;
+
+ if (array_key_exists($host, $this->cache))
+ return $this->cache[$host];
+
+ $rule = null;
+
+ foreach ($this->candidates($host) as $name) {
+ if ($found = $this->load($name)) { $rule = $found; break; }
+ }
+
+ if ($global = $this->load('global')) {
+ $rule = $rule ? $rule->merge_under($global) : $global;
+ }
+
+ return $this->cache[$host] = $rule;
+ }
+
+ /** Filenames to try, nearest match first. @return string[] */
+ public function candidates(string $host): array {
+ $out = [$host];
+
+ if (str_starts_with($host, 'www.'))
+ $out[] = substr($host, 4);
+
+ // .example.com.txt applies to every subdomain of example.com.
+ $parts = explode('.', $out[count($out) - 1]);
+ while (count($parts) > 1) {
+ $out[] = '.' . implode('.', $parts);
+ array_shift($parts);
+ }
+
+ return array_values(array_unique($out));
+ }
+
+ /** Load one rule by bare name (no .txt), searching custom then standard. */
+ public function load(string $name): ?Rule {
+ // Rule names come from feed hostnames; keep them off the filesystem.
+ if ($name === '' || str_contains($name, '/') || str_contains($name, "\0") || str_contains($name, '..'))
+ return null;
+
+ foreach ($this->dirs as $dir) {
+ $path = $dir . '/' . $name . '.txt';
+ if (is_readable($path)) {
+ $rule = self::parse((string) file_get_contents($path));
+ $rule->sources[] = $path;
+ return $rule;
+ }
+ }
+
+ return null;
+ }
+
+ /** Parse ftr-site-config text into a Rule. */
+ public static function parse(string $text): Rule {
+ $rule = new Rule();
+
+ foreach (preg_split('/\R/', $text) ?: [] as $line) {
+ $line = trim($line);
+ if ($line === '' || $line[0] === '#') continue;
+
+ $pos = strpos($line, ':');
+ if ($pos === false) continue;
+
+ $key = strtolower(trim(substr($line, 0, $pos)));
+ $val = trim(substr($line, $pos + 1));
+ if ($val === '') continue;
+
+ // http_header(user-agent) / wrap_in(div.foo) carry an argument.
+ $arg = null;
+ if (preg_match('/^([a-z_]+)\((.*)\)$/', $key, $m)) {
+ $key = $m[1];
+ $arg = trim($m[2]);
+ }
+
+ switch ($key) {
+ case 'title': $rule->titles[] = $val; break;
+ case 'body': $rule->bodies[] = $val; break;
+ case 'author': $rule->authors[] = $val; break;
+ case 'date': $rule->dates[] = $val; break;
+ case 'strip': $rule->strips[] = $val; break;
+ case 'strip_id_or_class': $rule->strip_id_or_class[] = $val; break;
+ case 'strip_image_src': $rule->strip_image_src[] = $val; break;
+ case 'dissolve': $rule->dissolve[] = $val; break;
+ case 'single_page_link': $rule->single_page_links[] = $val; break;
+ case 'next_page_link': $rule->next_page_links[] = $val; break;
+ case 'find_string': $rule->find_strings[] = $val; break;
+ case 'replace_string': $rule->replace_strings[] = $val; break;
+ case 'test_url': $rule->test_urls[] = $val; break;
+
+ case 'prune': $rule->prune = self::truthy($val); break;
+ case 'tidy': $rule->tidy = self::truthy($val); break;
+ case 'autodetect_on_failure': $rule->autodetect_on_failure = self::truthy($val); break;
+
+ case 'http_header':
+ if ($arg !== null && $arg !== '') $rule->http_headers[strtolower($arg)] = $val;
+ break;
+
+ case 'wrap_in':
+ if ($arg !== null && $arg !== '') $rule->wrap_in[$val] = $arg;
+ break;
+
+ // Deliberately ignored in v1: if_page_contains, replace_string
+ // variants with regex, convert_to_format, parser, src_lazy_load_attr
+ // (we resolve lazy images unconditionally -- see Html::unlazy).
+ default: break;
+ }
+ }
+
+ return $rule;
+ }
+
+ private static function truthy(string $v): bool {
+ return in_array(strtolower($v), ['yes', 'true', '1', 'on'], true);
+ }
+}
diff --git a/lib/TtrssFetcher.php b/lib/TtrssFetcher.php
new file mode 100644
index 0000000..82e6224
--- /dev/null
+++ b/lib/TtrssFetcher.php
@@ -0,0 +1,48 @@
+ $url,
+ 'http_accept' => 'text/*',
+ 'type' => 'text/html',
+ 'timeout' => $this->timeout,
+ ];
+
+ // Site configs routinely set a user-agent to get the article rather than a
+ // consent wall; UrlHelper takes it as a first-class option.
+ if (isset($headers['user-agent'])) $options['useragent'] = $headers['user-agent'];
+
+ $body = \UrlHelper::fetch($options);
+
+ if (!is_string($body) || $body === '') {
+ $error = \UrlHelper::$fetch_last_error ?: 'fetch returned nothing';
+ return new FetchResult(error: $error, status: (int) \UrlHelper::$fetch_last_error_code);
+ }
+
+ return new FetchResult(
+ html: $body,
+ effective_url: \UrlHelper::$fetch_effective_url ?: $url,
+ status: 200,
+ );
+ }
+}
diff --git a/patches/README.md b/patches/README.md
new file mode 100644
index 0000000..145f02e
--- /dev/null
+++ b/patches/README.md
@@ -0,0 +1,12 @@
+# Local patches to the vendored dependencies
+
+`vendor/` is committed (tt-rss plugins ship their dependencies; there is no
+composer in the app container), so upstream fixes we cannot wait for are applied
+here and recorded below.
+
+## fivefilters/readability.php
+
+- `src/Nodes/NodeTrait.php:371` — `callable $filterFn = null` → `?callable
+ $filterFn = null`. Implicitly nullable parameters are deprecated as of PHP 8.4,
+ and the tt-rss app image is on PHP 8.5, so without this every extraction emits a
+ deprecation notice.
diff --git a/site_config/custom/andrzejrysuje.pl.txt b/site_config/custom/andrzejrysuje.pl.txt
new file mode 100644
index 0000000..4eb0574
--- /dev/null
+++ b/site_config/custom/andrzejrysuje.pl.txt
@@ -0,0 +1,10 @@
+# Multi-panel strips are laid out as a Bootstrap carousel; taking carousel-inner
+# keeps every panel in order. The alone would give only the first one.
+body: //div[contains(concat(' ', normalize-space(@class), ' '), ' carousel-inner ')]
+
+strip_id_or_class: carousel-control
+strip_id_or_class: carousel-indicators
+
+autodetect_on_failure: no
+
+test_url: https://andrzejrysuje.pl/tradycja/
diff --git a/site_config/custom/blog.cloudflare.com.txt b/site_config/custom/blog.cloudflare.com.txt
new file mode 100644
index 0000000..f4ab7b9
--- /dev/null
+++ b/site_config/custom/blog.cloudflare.com.txt
@@ -0,0 +1,12 @@
+# The community rule still says //div[@class='post-content']. That class survives
+# the site's redesign but is now one token among many Tailwind classes, so an
+# exact-equality match never fires. article-content is the tighter target anyway.
+body: //div[contains(concat(' ', normalize-space(@class), ' '), ' article-content ')]
+
+title: //h1
+author: //a[contains(@href, '/author/')]
+
+strip_id_or_class: post-email
+strip_id_or_class: image-lightbox
+
+test_url: https://blog.cloudflare.com/bot-preference-sync/
diff --git a/site_config/custom/dobreprogramy.pl.txt b/site_config/custom/dobreprogramy.pl.txt
new file mode 100644
index 0000000..cdc9b10
--- /dev/null
+++ b/site_config/custom/dobreprogramy.pl.txt
@@ -0,0 +1,8 @@
+# The old #phContent_divMetaBody id predates at least two rewrites of this site.
+body: //div[contains(concat(' ', normalize-space(@class), ' '), ' article-body-grid ')]
+
+strip_id_or_class: article-bottom
+strip_id_or_class: article-img-placeholder
+strip_id_or_class: adunit
+
+test_url: https://www.dobreprogramy.pl/windows-11-26h2-coraz-blizej-mala-aktualizacja-z-szybka-instalacja,7321906159909056a
diff --git a/site_config/custom/ianlewis.org.txt b/site_config/custom/ianlewis.org.txt
new file mode 100644
index 0000000..9d69a24
--- /dev/null
+++ b/site_config/custom/ianlewis.org.txt
@@ -0,0 +1,4 @@
+# Now an h-entry microformat: "post e-content" rather than the old post-content.
+body: //div[contains(concat(' ', normalize-space(@class), ' '), ' e-content ')]
+
+test_url: https://www.ianlewis.org/en/2026-new-year-reflections
diff --git a/site_config/custom/loadingartist.com.txt b/site_config/custom/loadingartist.com.txt
new file mode 100644
index 0000000..f479f1a
--- /dev/null
+++ b/site_config/custom/loadingartist.com.txt
@@ -0,0 +1,12 @@
+# The site was redesigned: the old rule (body: //div[@class='comic']) selects
+# nothing, so extraction silently fell through to Readability and dropped the
+# comic entirely -- the panel is the article, and Readability keeps text.
+body: //div[contains(@class, 'main-image-container')]
+body: //div[@class='post-content']
+
+strip: //nav
+strip_id_or_class: pagination
+
+autodetect_on_failure: no
+
+test_url: https://loadingartist.com/comic/be-write-back/
diff --git a/site_config/custom/oglaf.com.txt b/site_config/custom/oglaf.com.txt
new file mode 100644
index 0000000..157bfe9
--- /dev/null
+++ b/site_config/custom/oglaf.com.txt
@@ -0,0 +1,7 @@
+# Image-only page: the strip is the article. Readability returns nothing at all
+# here because there is no prose to score, which is why this needs a rule.
+body: //img[@id='strip']
+
+autodetect_on_failure: no
+
+test_url: https://www.oglaf.com/
diff --git a/site_config/custom/securelist.com.txt b/site_config/custom/securelist.com.txt
new file mode 100644
index 0000000..d2d93b7
--- /dev/null
+++ b/site_config/custom/securelist.com.txt
@@ -0,0 +1,16 @@
+# Redesigned onto a "c-" component prefix; the community rule's #primary wrapper
+# is long gone.
+body: //article[contains(concat(' ', normalize-space(@class), ' '), ' c-article ')]
+
+# Sidebar widgets ("From the same authors", "In the same category", webinar
+# promos) and the collapsible table of contents all live inside c-article.
+strip_id_or_class: c-widget
+strip_id_or_class: js-sticky-widget
+strip_id_or_class: c-highlight
+strip_id_or_class: c-article__authors
+strip_id_or_class: c-card
+strip_id_or_class: c-share
+strip_id_or_class: comment
+strip_id_or_class: akismet
+
+test_url: https://securelist.com/android-head-unit-malware/121106/
diff --git a/site_config/custom/skeletonclaw.com.txt b/site_config/custom/skeletonclaw.com.txt
new file mode 100644
index 0000000..6905080
--- /dev/null
+++ b/site_config/custom/skeletonclaw.com.txt
@@ -0,0 +1,10 @@
+# Tumblr: the strip sits in the post body; everything else on the page is site
+# furniture (logo, banner, Patreon button) that Readability happily keeps.
+body: //div[contains(concat(' ', normalize-space(@class), ' '), ' post-content ')]
+
+strip_id_or_class: post-notes
+strip_id_or_class: tumblr_controls
+
+autodetect_on_failure: no
+
+test_url: https://www.skeletonclaw.com/post/768403912930836480
diff --git a/site_config/custom/tapas.io.txt b/site_config/custom/tapas.io.txt
new file mode 100644
index 0000000..63cf586
--- /dev/null
+++ b/site_config/custom/tapas.io.txt
@@ -0,0 +1,15 @@
+# Panels are lazy-loaded: @src is a base64 placeholder gif and the real image is
+# in @data-src, which the extractor promotes. Without that the episode extracts
+# as a column of blank pixels.
+#
+# Note: tapas signs image URLs with an expiry, so a cached article's panels stop
+# resolving after a few weeks. Nothing to be done about that from this end.
+body: //div[contains(concat(' ', normalize-space(@class), ' '), ' js-episode-viewer ')]
+
+strip_id_or_class: loading-indicator
+strip_id_or_class: episode-info
+strip_id_or_class: js-message-body
+
+autodetect_on_failure: no
+
+test_url: https://tapas.io/episode/2549532
diff --git a/vendor/autoload.php b/vendor/autoload.php
new file mode 100644
index 0000000..d10009f
--- /dev/null
+++ b/vendor/autoload.php
@@ -0,0 +1,22 @@
+
+ * Jordi Boggiano
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Composer\Autoload;
+
+/**
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
+ *
+ * $loader = new \Composer\Autoload\ClassLoader();
+ *
+ * // register classes with namespaces
+ * $loader->add('Symfony\Component', __DIR__.'/component');
+ * $loader->add('Symfony', __DIR__.'/framework');
+ *
+ * // activate the autoloader
+ * $loader->register();
+ *
+ * // to enable searching the include path (eg. for PEAR packages)
+ * $loader->setUseIncludePath(true);
+ *
+ * In this example, if you try to use a class in the Symfony\Component
+ * namespace or one of its children (Symfony\Component\Console for instance),
+ * the autoloader will first look for the class under the component/
+ * directory, and it will then fallback to the framework/ directory if not
+ * found before giving up.
+ *
+ * This class is loosely based on the Symfony UniversalClassLoader.
+ *
+ * @author Fabien Potencier
+ * @author Jordi Boggiano
+ * @see https://www.php-fig.org/psr/psr-0/
+ * @see https://www.php-fig.org/psr/psr-4/
+ */
+class ClassLoader
+{
+ /** @var \Closure(string):void */
+ private static $includeFile;
+
+ /** @var string|null */
+ private $vendorDir;
+
+ // PSR-4
+ /**
+ * @var array>
+ */
+ private $prefixLengthsPsr4 = array();
+ /**
+ * @var array>
+ */
+ private $prefixDirsPsr4 = array();
+ /**
+ * @var list
+ */
+ private $fallbackDirsPsr4 = array();
+
+ // PSR-0
+ /**
+ * List of PSR-0 prefixes
+ *
+ * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
+ *
+ * @var array>>
+ */
+ private $prefixesPsr0 = array();
+ /**
+ * @var list
+ */
+ private $fallbackDirsPsr0 = array();
+
+ /** @var bool */
+ private $useIncludePath = false;
+
+ /**
+ * @var array
+ */
+ private $classMap = array();
+
+ /** @var bool */
+ private $classMapAuthoritative = false;
+
+ /**
+ * @var array
+ */
+ private $missingClasses = array();
+
+ /** @var string|null */
+ private $apcuPrefix;
+
+ /**
+ * @var array
+ */
+ private static $registeredLoaders = array();
+
+ /**
+ * @param string|null $vendorDir
+ */
+ public function __construct($vendorDir = null)
+ {
+ $this->vendorDir = $vendorDir;
+ self::initializeIncludeClosure();
+ }
+
+ /**
+ * @return array>
+ */
+ public function getPrefixes()
+ {
+ if (!empty($this->prefixesPsr0)) {
+ return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
+ }
+
+ return array();
+ }
+
+ /**
+ * @return array>
+ */
+ public function getPrefixesPsr4()
+ {
+ return $this->prefixDirsPsr4;
+ }
+
+ /**
+ * @return list
+ */
+ public function getFallbackDirs()
+ {
+ return $this->fallbackDirsPsr0;
+ }
+
+ /**
+ * @return list
+ */
+ public function getFallbackDirsPsr4()
+ {
+ return $this->fallbackDirsPsr4;
+ }
+
+ /**
+ * @return array Array of classname => path
+ */
+ public function getClassMap()
+ {
+ return $this->classMap;
+ }
+
+ /**
+ * @param array $classMap Class to filename map
+ *
+ * @return void
+ */
+ public function addClassMap(array $classMap)
+ {
+ if ($this->classMap) {
+ $this->classMap = array_merge($this->classMap, $classMap);
+ } else {
+ $this->classMap = $classMap;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix, either
+ * appending or prepending to the ones previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param list|string $paths The PSR-0 root directories
+ * @param bool $prepend Whether to prepend the directories
+ *
+ * @return void
+ */
+ public function add($prefix, $paths, $prepend = false)
+ {
+ $paths = (array) $paths;
+ if (!$prefix) {
+ if ($prepend) {
+ $this->fallbackDirsPsr0 = array_merge(
+ $paths,
+ $this->fallbackDirsPsr0
+ );
+ } else {
+ $this->fallbackDirsPsr0 = array_merge(
+ $this->fallbackDirsPsr0,
+ $paths
+ );
+ }
+
+ return;
+ }
+
+ $first = $prefix[0];
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
+ $this->prefixesPsr0[$first][$prefix] = $paths;
+
+ return;
+ }
+ if ($prepend) {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ $paths,
+ $this->prefixesPsr0[$first][$prefix]
+ );
+ } else {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ $this->prefixesPsr0[$first][$prefix],
+ $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace, either
+ * appending or prepending to the ones previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param list|string $paths The PSR-4 base directories
+ * @param bool $prepend Whether to prepend the directories
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return void
+ */
+ public function addPsr4($prefix, $paths, $prepend = false)
+ {
+ $paths = (array) $paths;
+ if (!$prefix) {
+ // Register directories for the root namespace.
+ if ($prepend) {
+ $this->fallbackDirsPsr4 = array_merge(
+ $paths,
+ $this->fallbackDirsPsr4
+ );
+ } else {
+ $this->fallbackDirsPsr4 = array_merge(
+ $this->fallbackDirsPsr4,
+ $paths
+ );
+ }
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
+ // Register directories for a new namespace.
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = $paths;
+ } elseif ($prepend) {
+ // Prepend directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ $paths,
+ $this->prefixDirsPsr4[$prefix]
+ );
+ } else {
+ // Append directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ $this->prefixDirsPsr4[$prefix],
+ $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix,
+ * replacing any others previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param list|string $paths The PSR-0 base directories
+ *
+ * @return void
+ */
+ public function set($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr0 = (array) $paths;
+ } else {
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace,
+ * replacing any others previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param list|string $paths The PSR-4 base directories
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return void
+ */
+ public function setPsr4($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr4 = (array) $paths;
+ } else {
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Turns on searching the include path for class files.
+ *
+ * @param bool $useIncludePath
+ *
+ * @return void
+ */
+ public function setUseIncludePath($useIncludePath)
+ {
+ $this->useIncludePath = $useIncludePath;
+ }
+
+ /**
+ * Can be used to check if the autoloader uses the include path to check
+ * for classes.
+ *
+ * @return bool
+ */
+ public function getUseIncludePath()
+ {
+ return $this->useIncludePath;
+ }
+
+ /**
+ * Turns off searching the prefix and fallback directories for classes
+ * that have not been registered with the class map.
+ *
+ * @param bool $classMapAuthoritative
+ *
+ * @return void
+ */
+ public function setClassMapAuthoritative($classMapAuthoritative)
+ {
+ $this->classMapAuthoritative = $classMapAuthoritative;
+ }
+
+ /**
+ * Should class lookup fail if not found in the current class map?
+ *
+ * @return bool
+ */
+ public function isClassMapAuthoritative()
+ {
+ return $this->classMapAuthoritative;
+ }
+
+ /**
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
+ *
+ * @param string|null $apcuPrefix
+ *
+ * @return void
+ */
+ public function setApcuPrefix($apcuPrefix)
+ {
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
+ }
+
+ /**
+ * The APCu prefix in use, or null if APCu caching is not enabled.
+ *
+ * @return string|null
+ */
+ public function getApcuPrefix()
+ {
+ return $this->apcuPrefix;
+ }
+
+ /**
+ * Registers this instance as an autoloader.
+ *
+ * @param bool $prepend Whether to prepend the autoloader or not
+ *
+ * @return void
+ */
+ public function register($prepend = false)
+ {
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+
+ if (null === $this->vendorDir) {
+ return;
+ }
+
+ if ($prepend) {
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
+ } else {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ self::$registeredLoaders[$this->vendorDir] = $this;
+ }
+ }
+
+ /**
+ * Unregisters this instance as an autoloader.
+ *
+ * @return void
+ */
+ public function unregister()
+ {
+ spl_autoload_unregister(array($this, 'loadClass'));
+
+ if (null !== $this->vendorDir) {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ }
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $class The name of the class
+ * @return true|null True if loaded, null otherwise
+ */
+ public function loadClass($class)
+ {
+ if ($file = $this->findFile($class)) {
+ $includeFile = self::$includeFile;
+ $includeFile($file);
+
+ return true;
+ }
+
+ return null;
+ }
+
+ /**
+ * Finds the path to the file where the class is defined.
+ *
+ * @param string $class The name of the class
+ *
+ * @return string|false The path if found, false otherwise
+ */
+ public function findFile($class)
+ {
+ // class map lookup
+ if (isset($this->classMap[$class])) {
+ return $this->classMap[$class];
+ }
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
+ return false;
+ }
+ if (null !== $this->apcuPrefix) {
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
+ if ($hit) {
+ return $file;
+ }
+ }
+
+ $file = $this->findFileWithExtension($class, '.php');
+
+ // Search for Hack files if we are running on HHVM
+ if (false === $file && defined('HHVM_VERSION')) {
+ $file = $this->findFileWithExtension($class, '.hh');
+ }
+
+ if (null !== $this->apcuPrefix) {
+ apcu_add($this->apcuPrefix.$class, $file);
+ }
+
+ if (false === $file) {
+ // Remember that this class does not exist.
+ $this->missingClasses[$class] = true;
+ }
+
+ return $file;
+ }
+
+ /**
+ * Returns the currently registered loaders keyed by their corresponding vendor directories.
+ *
+ * @return array
+ */
+ public static function getRegisteredLoaders()
+ {
+ return self::$registeredLoaders;
+ }
+
+ /**
+ * @param string $class
+ * @param string $ext
+ * @return string|false
+ */
+ private function findFileWithExtension($class, $ext)
+ {
+ // PSR-4 lookup
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
+
+ $first = $class[0];
+ if (isset($this->prefixLengthsPsr4[$first])) {
+ $subPath = $class;
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
+ $subPath = substr($subPath, 0, $lastPos);
+ $search = $subPath . '\\';
+ if (isset($this->prefixDirsPsr4[$search])) {
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
+ if (file_exists($file = $dir . $pathEnd)) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-4 fallback dirs
+ foreach ($this->fallbackDirsPsr4 as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 lookup
+ if (false !== $pos = strrpos($class, '\\')) {
+ // namespaced class name
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
+ } else {
+ // PEAR-like class name
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
+ }
+
+ if (isset($this->prefixesPsr0[$first])) {
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
+ if (0 === strpos($class, $prefix)) {
+ foreach ($dirs as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-0 fallback dirs
+ foreach ($this->fallbackDirsPsr0 as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 include paths.
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
+ return $file;
+ }
+
+ return false;
+ }
+
+ /**
+ * @return void
+ */
+ private static function initializeIncludeClosure()
+ {
+ if (self::$includeFile !== null) {
+ return;
+ }
+
+ /**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ *
+ * @param string $file
+ * @return void
+ */
+ self::$includeFile = \Closure::bind(static function($file) {
+ include $file;
+ }, null, null);
+ }
+}
diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php
new file mode 100644
index 0000000..2052022
--- /dev/null
+++ b/vendor/composer/InstalledVersions.php
@@ -0,0 +1,396 @@
+
+ * Jordi Boggiano
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Composer;
+
+use Composer\Autoload\ClassLoader;
+use Composer\Semver\VersionParser;
+
+/**
+ * This class is copied in every Composer installed project and available to all
+ *
+ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
+ *
+ * To require its presence, you can require `composer-runtime-api ^2.0`
+ *
+ * @final
+ */
+class InstalledVersions
+{
+ /**
+ * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
+ * @internal
+ */
+ private static $selfDir = null;
+
+ /**
+ * @var mixed[]|null
+ * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null
+ */
+ private static $installed;
+
+ /**
+ * @var bool
+ */
+ private static $installedIsLocalDir;
+
+ /**
+ * @var bool|null
+ */
+ private static $canGetVendors;
+
+ /**
+ * @var array[]
+ * @psalm-var array}>
+ */
+ private static $installedByVendor = array();
+
+ /**
+ * Returns a list of all package names which are present, either by being installed, replaced or provided
+ *
+ * @return string[]
+ * @psalm-return list
+ */
+ public static function getInstalledPackages()
+ {
+ $packages = array();
+ foreach (self::getInstalled() as $installed) {
+ $packages[] = array_keys($installed['versions']);
+ }
+
+ if (1 === \count($packages)) {
+ return $packages[0];
+ }
+
+ return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
+ }
+
+ /**
+ * Returns a list of all package names with a specific type e.g. 'library'
+ *
+ * @param string $type
+ * @return string[]
+ * @psalm-return list
+ */
+ public static function getInstalledPackagesByType($type)
+ {
+ $packagesByType = array();
+
+ foreach (self::getInstalled() as $installed) {
+ foreach ($installed['versions'] as $name => $package) {
+ if (isset($package['type']) && $package['type'] === $type) {
+ $packagesByType[] = $name;
+ }
+ }
+ }
+
+ return $packagesByType;
+ }
+
+ /**
+ * Checks whether the given package is installed
+ *
+ * This also returns true if the package name is provided or replaced by another package
+ *
+ * @param string $packageName
+ * @param bool $includeDevRequirements
+ * @return bool
+ */
+ public static function isInstalled($packageName, $includeDevRequirements = true)
+ {
+ foreach (self::getInstalled() as $installed) {
+ if (isset($installed['versions'][$packageName])) {
+ return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks whether the given package satisfies a version constraint
+ *
+ * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
+ *
+ * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
+ *
+ * @param VersionParser $parser Install composer/semver to have access to this class and functionality
+ * @param string $packageName
+ * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
+ * @return bool
+ */
+ public static function satisfies(VersionParser $parser, $packageName, $constraint)
+ {
+ $constraint = $parser->parseConstraints((string) $constraint);
+ $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
+
+ return $provided->matches($constraint);
+ }
+
+ /**
+ * Returns a version constraint representing all the range(s) which are installed for a given package
+ *
+ * It is easier to use this via isInstalled() with the $constraint argument if you need to check
+ * whether a given version of a package is installed, and not just whether it exists
+ *
+ * @param string $packageName
+ * @return string Version constraint usable with composer/semver
+ */
+ public static function getVersionRanges($packageName)
+ {
+ foreach (self::getInstalled() as $installed) {
+ if (!isset($installed['versions'][$packageName])) {
+ continue;
+ }
+
+ $ranges = array();
+ if (isset($installed['versions'][$packageName]['pretty_version'])) {
+ $ranges[] = $installed['versions'][$packageName]['pretty_version'];
+ }
+ if (array_key_exists('aliases', $installed['versions'][$packageName])) {
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
+ }
+ if (array_key_exists('replaced', $installed['versions'][$packageName])) {
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
+ }
+ if (array_key_exists('provided', $installed['versions'][$packageName])) {
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
+ }
+
+ return implode(' || ', $ranges);
+ }
+
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+ }
+
+ /**
+ * @param string $packageName
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
+ */
+ public static function getVersion($packageName)
+ {
+ foreach (self::getInstalled() as $installed) {
+ if (!isset($installed['versions'][$packageName])) {
+ continue;
+ }
+
+ if (!isset($installed['versions'][$packageName]['version'])) {
+ return null;
+ }
+
+ return $installed['versions'][$packageName]['version'];
+ }
+
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+ }
+
+ /**
+ * @param string $packageName
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
+ */
+ public static function getPrettyVersion($packageName)
+ {
+ foreach (self::getInstalled() as $installed) {
+ if (!isset($installed['versions'][$packageName])) {
+ continue;
+ }
+
+ if (!isset($installed['versions'][$packageName]['pretty_version'])) {
+ return null;
+ }
+
+ return $installed['versions'][$packageName]['pretty_version'];
+ }
+
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+ }
+
+ /**
+ * @param string $packageName
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
+ */
+ public static function getReference($packageName)
+ {
+ foreach (self::getInstalled() as $installed) {
+ if (!isset($installed['versions'][$packageName])) {
+ continue;
+ }
+
+ if (!isset($installed['versions'][$packageName]['reference'])) {
+ return null;
+ }
+
+ return $installed['versions'][$packageName]['reference'];
+ }
+
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+ }
+
+ /**
+ * @param string $packageName
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
+ */
+ public static function getInstallPath($packageName)
+ {
+ foreach (self::getInstalled() as $installed) {
+ if (!isset($installed['versions'][$packageName])) {
+ continue;
+ }
+
+ return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
+ }
+
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+ }
+
+ /**
+ * @return array
+ * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
+ */
+ public static function getRootPackage()
+ {
+ $installed = self::getInstalled();
+
+ return $installed[0]['root'];
+ }
+
+ /**
+ * Returns the raw installed.php data for custom implementations
+ *
+ * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
+ * @return array[]
+ * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}
+ */
+ public static function getRawData()
+ {
+ @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
+
+ if (null === self::$installed) {
+ // only require the installed.php file if this file is loaded from its dumped location,
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
+ if (substr(__DIR__, -8, 1) !== 'C') {
+ self::$installed = include __DIR__ . '/installed.php';
+ } else {
+ self::$installed = array();
+ }
+ }
+
+ return self::$installed;
+ }
+
+ /**
+ * Returns the raw data of all installed.php which are currently loaded for custom implementations
+ *
+ * @return array[]
+ * @psalm-return list}>
+ */
+ public static function getAllRawData()
+ {
+ return self::getInstalled();
+ }
+
+ /**
+ * Lets you reload the static array from another file
+ *
+ * This is only useful for complex integrations in which a project needs to use
+ * this class but then also needs to execute another project's autoloader in process,
+ * and wants to ensure both projects have access to their version of installed.php.
+ *
+ * A typical case would be PHPUnit, where it would need to make sure it reads all
+ * the data it needs from this class, then call reload() with
+ * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
+ * the project in which it runs can then also use this class safely, without
+ * interference between PHPUnit's dependencies and the project's dependencies.
+ *
+ * @param array[] $data A vendor/composer/installed.php data set
+ * @return void
+ *
+ * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data
+ */
+ public static function reload($data)
+ {
+ self::$installed = $data;
+ self::$installedByVendor = array();
+
+ // when using reload, we disable the duplicate protection to ensure that self::$installed data is
+ // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
+ // so we have to assume it does not, and that may result in duplicate data being returned when listing
+ // all installed packages for example
+ self::$installedIsLocalDir = false;
+ }
+
+ /**
+ * @return string
+ */
+ private static function getSelfDir()
+ {
+ if (self::$selfDir === null) {
+ self::$selfDir = strtr(__DIR__, '\\', '/');
+ }
+
+ return self::$selfDir;
+ }
+
+ /**
+ * @return array[]
+ * @psalm-return list}>
+ */
+ private static function getInstalled()
+ {
+ if (null === self::$canGetVendors) {
+ self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
+ }
+
+ $installed = array();
+ $copiedLocalDir = false;
+
+ if (self::$canGetVendors) {
+ $selfDir = self::getSelfDir();
+ foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
+ $vendorDir = strtr($vendorDir, '\\', '/');
+ if (isset(self::$installedByVendor[$vendorDir])) {
+ $installed[] = self::$installedByVendor[$vendorDir];
+ } elseif (is_file($vendorDir.'/composer/installed.php')) {
+ /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
+ $required = require $vendorDir.'/composer/installed.php';
+ self::$installedByVendor[$vendorDir] = $required;
+ $installed[] = $required;
+ if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
+ self::$installed = $required;
+ self::$installedIsLocalDir = true;
+ }
+ }
+ if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
+ $copiedLocalDir = true;
+ }
+ }
+ }
+
+ if (null === self::$installed) {
+ // only require the installed.php file if this file is loaded from its dumped location,
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
+ if (substr(__DIR__, -8, 1) !== 'C') {
+ /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
+ $required = require __DIR__ . '/installed.php';
+ self::$installed = $required;
+ } else {
+ self::$installed = array();
+ }
+ }
+
+ if (self::$installed !== array() && !$copiedLocalDir) {
+ $installed[] = self::$installed;
+ }
+
+ return $installed;
+ }
+}
diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE
new file mode 100644
index 0000000..f27399a
--- /dev/null
+++ b/vendor/composer/LICENSE
@@ -0,0 +1,21 @@
+
+Copyright (c) Nils Adermann, Jordi Boggiano
+
+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/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
new file mode 100644
index 0000000..b3c35f9
--- /dev/null
+++ b/vendor/composer/autoload_classmap.php
@@ -0,0 +1,61 @@
+ $vendorDir . '/composer/InstalledVersions.php',
+ 'Masterminds\\HTML5' => $vendorDir . '/masterminds/html5/src/HTML5.php',
+ 'Masterminds\\HTML5\\Elements' => $vendorDir . '/masterminds/html5/src/HTML5/Elements.php',
+ 'Masterminds\\HTML5\\Entities' => $vendorDir . '/masterminds/html5/src/HTML5/Entities.php',
+ 'Masterminds\\HTML5\\Exception' => $vendorDir . '/masterminds/html5/src/HTML5/Exception.php',
+ 'Masterminds\\HTML5\\InstructionProcessor' => $vendorDir . '/masterminds/html5/src/HTML5/InstructionProcessor.php',
+ 'Masterminds\\HTML5\\Parser\\CharacterReference' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/CharacterReference.php',
+ 'Masterminds\\HTML5\\Parser\\DOMTreeBuilder' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php',
+ 'Masterminds\\HTML5\\Parser\\EventHandler' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/EventHandler.php',
+ 'Masterminds\\HTML5\\Parser\\FileInputStream' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/FileInputStream.php',
+ 'Masterminds\\HTML5\\Parser\\InputStream' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/InputStream.php',
+ 'Masterminds\\HTML5\\Parser\\ParseError' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/ParseError.php',
+ 'Masterminds\\HTML5\\Parser\\Scanner' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/Scanner.php',
+ 'Masterminds\\HTML5\\Parser\\StringInputStream' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/StringInputStream.php',
+ 'Masterminds\\HTML5\\Parser\\Tokenizer' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/Tokenizer.php',
+ 'Masterminds\\HTML5\\Parser\\TreeBuildingRules' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php',
+ 'Masterminds\\HTML5\\Parser\\UTF8Utils' => $vendorDir . '/masterminds/html5/src/HTML5/Parser/UTF8Utils.php',
+ 'Masterminds\\HTML5\\Serializer\\HTML5Entities' => $vendorDir . '/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php',
+ 'Masterminds\\HTML5\\Serializer\\OutputRules' => $vendorDir . '/masterminds/html5/src/HTML5/Serializer/OutputRules.php',
+ 'Masterminds\\HTML5\\Serializer\\RulesInterface' => $vendorDir . '/masterminds/html5/src/HTML5/Serializer/RulesInterface.php',
+ 'Masterminds\\HTML5\\Serializer\\Traverser' => $vendorDir . '/masterminds/html5/src/HTML5/Serializer/Traverser.php',
+ 'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
+ 'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php',
+ 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
+ 'Psr\\Log\\LoggerAwareInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareInterface.php',
+ 'Psr\\Log\\LoggerAwareTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareTrait.php',
+ 'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php',
+ 'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
+ 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
+ 'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/DummyTest.php',
+ 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
+ 'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php',
+ 'fivefilters\\Readability\\Configuration' => $vendorDir . '/fivefilters/readability.php/src/Configuration.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMAttr' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMAttr.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMCdataSection' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMCdataSection.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMCharacterData' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMCharacterData.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMComment' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMComment.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMDocument' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMDocument.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMDocumentFragment' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentFragment.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMDocumentType' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentType.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMElement' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMEntity' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMEntity.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMEntityReference' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMEntityReference.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMNode' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMNode.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMNodeList' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMNodeList.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMNotation' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMNotation.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMProcessingInstruction' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMProcessingInstruction.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMText' => $vendorDir . '/fivefilters/readability.php/src/Nodes/DOM/DOMText.php',
+ 'fivefilters\\Readability\\Nodes\\NodeTrait' => $vendorDir . '/fivefilters/readability.php/src/Nodes/NodeTrait.php',
+ 'fivefilters\\Readability\\Nodes\\NodeUtility' => $vendorDir . '/fivefilters/readability.php/src/Nodes/NodeUtility.php',
+ 'fivefilters\\Readability\\ParseException' => $vendorDir . '/fivefilters/readability.php/src/ParseException.php',
+ 'fivefilters\\Readability\\Readability' => $vendorDir . '/fivefilters/readability.php/src/Readability.php',
+);
diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php
new file mode 100644
index 0000000..15a2ff3
--- /dev/null
+++ b/vendor/composer/autoload_namespaces.php
@@ -0,0 +1,9 @@
+ array($vendorDir . '/fivefilters/readability.php/src'),
+ 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
+ 'Masterminds\\' => array($vendorDir . '/masterminds/html5/src'),
+);
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
new file mode 100644
index 0000000..0ab935b
--- /dev/null
+++ b/vendor/composer/autoload_real.php
@@ -0,0 +1,38 @@
+register(true);
+
+ return $loader;
+ }
+}
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
new file mode 100644
index 0000000..ab5a356
--- /dev/null
+++ b/vendor/composer/autoload_static.php
@@ -0,0 +1,103 @@
+
+ array (
+ 'fivefilters\\Readability\\' => 24,
+ ),
+ 'P' =>
+ array (
+ 'Psr\\Log\\' => 8,
+ ),
+ 'M' =>
+ array (
+ 'Masterminds\\' => 12,
+ ),
+ );
+
+ public static $prefixDirsPsr4 = array (
+ 'fivefilters\\Readability\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/fivefilters/readability.php/src',
+ ),
+ 'Psr\\Log\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
+ ),
+ 'Masterminds\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/masterminds/html5/src',
+ ),
+ );
+
+ public static $classMap = array (
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
+ 'Masterminds\\HTML5' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5.php',
+ 'Masterminds\\HTML5\\Elements' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Elements.php',
+ 'Masterminds\\HTML5\\Entities' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Entities.php',
+ 'Masterminds\\HTML5\\Exception' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Exception.php',
+ 'Masterminds\\HTML5\\InstructionProcessor' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/InstructionProcessor.php',
+ 'Masterminds\\HTML5\\Parser\\CharacterReference' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/CharacterReference.php',
+ 'Masterminds\\HTML5\\Parser\\DOMTreeBuilder' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php',
+ 'Masterminds\\HTML5\\Parser\\EventHandler' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/EventHandler.php',
+ 'Masterminds\\HTML5\\Parser\\FileInputStream' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/FileInputStream.php',
+ 'Masterminds\\HTML5\\Parser\\InputStream' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/InputStream.php',
+ 'Masterminds\\HTML5\\Parser\\ParseError' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/ParseError.php',
+ 'Masterminds\\HTML5\\Parser\\Scanner' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/Scanner.php',
+ 'Masterminds\\HTML5\\Parser\\StringInputStream' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/StringInputStream.php',
+ 'Masterminds\\HTML5\\Parser\\Tokenizer' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/Tokenizer.php',
+ 'Masterminds\\HTML5\\Parser\\TreeBuildingRules' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php',
+ 'Masterminds\\HTML5\\Parser\\UTF8Utils' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Parser/UTF8Utils.php',
+ 'Masterminds\\HTML5\\Serializer\\HTML5Entities' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php',
+ 'Masterminds\\HTML5\\Serializer\\OutputRules' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Serializer/OutputRules.php',
+ 'Masterminds\\HTML5\\Serializer\\RulesInterface' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Serializer/RulesInterface.php',
+ 'Masterminds\\HTML5\\Serializer\\Traverser' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Serializer/Traverser.php',
+ 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
+ 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php',
+ 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php',
+ 'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php',
+ 'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php',
+ 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php',
+ 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php',
+ 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php',
+ 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php',
+ 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
+ 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php',
+ 'fivefilters\\Readability\\Configuration' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Configuration.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMAttr' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMAttr.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMCdataSection' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMCdataSection.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMCharacterData' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMCharacterData.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMComment' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMComment.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMDocument' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMDocument.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMDocumentFragment' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentFragment.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMDocumentType' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentType.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMElement' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMEntity' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMEntity.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMEntityReference' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMEntityReference.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMNode' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMNode.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMNodeList' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMNodeList.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMNotation' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMNotation.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMProcessingInstruction' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMProcessingInstruction.php',
+ 'fivefilters\\Readability\\Nodes\\DOM\\DOMText' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/DOM/DOMText.php',
+ 'fivefilters\\Readability\\Nodes\\NodeTrait' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/NodeTrait.php',
+ 'fivefilters\\Readability\\Nodes\\NodeUtility' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Nodes/NodeUtility.php',
+ 'fivefilters\\Readability\\ParseException' => __DIR__ . '/..' . '/fivefilters/readability.php/src/ParseException.php',
+ 'fivefilters\\Readability\\Readability' => __DIR__ . '/..' . '/fivefilters/readability.php/src/Readability.php',
+ );
+
+ public static function getInitializer(ClassLoader $loader)
+ {
+ return \Closure::bind(function () use ($loader) {
+ $loader->prefixLengthsPsr4 = ComposerStaticInitb44cc79a0eaef9cd9c2f2ac697cbe9c0::$prefixLengthsPsr4;
+ $loader->prefixDirsPsr4 = ComposerStaticInitb44cc79a0eaef9cd9c2f2ac697cbe9c0::$prefixDirsPsr4;
+ $loader->classMap = ComposerStaticInitb44cc79a0eaef9cd9c2f2ac697cbe9c0::$classMap;
+
+ }, null, ClassLoader::class);
+ }
+}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
new file mode 100644
index 0000000..e5ad671
--- /dev/null
+++ b/vendor/composer/installed.json
@@ -0,0 +1,208 @@
+{
+ "packages": [
+ {
+ "name": "fivefilters/readability.php",
+ "version": "dev-main",
+ "version_normalized": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/tt-rss/tt-rss-readability-php.git",
+ "reference": "3bc7e81ae758642292ce20df08c56cd42cefd9d8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/tt-rss/tt-rss-readability-php/zipball/3bc7e81ae758642292ce20df08c56cd42cefd9d8",
+ "reference": "3bc7e81ae758642292ce20df08c56cd42cefd9d8",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-mbstring": "*",
+ "ext-xml": "*",
+ "masterminds/html5": "dev-main",
+ "php": ">=7.3.0",
+ "psr/log": "^1.0"
+ },
+ "require-dev": {
+ "monolog/monolog": "^2.3",
+ "phpunit/phpunit": "^9"
+ },
+ "suggest": {
+ "monolog/monolog": "Allow logging debug information"
+ },
+ "time": "2026-08-04T01:49:31+00:00",
+ "default-branch": true,
+ "type": "library",
+ "installation-source": "source",
+ "autoload": {
+ "psr-4": {
+ "fivefilters\\Readability\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "fivefilters\\Readability\\Test\\": "test"
+ }
+ },
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Andres Rey",
+ "email": "andreskrey@gmail.com",
+ "role": "Original Developer"
+ },
+ {
+ "name": "Keyvan Minoukadeh",
+ "email": "keyvan@fivefilters.org",
+ "homepage": "https://www.fivefilters.org",
+ "role": "Developer/Maintainer"
+ }
+ ],
+ "description": "A PHP port of Readability.js",
+ "homepage": "https://github.com/fivefilters/readability.php",
+ "keywords": [
+ "html",
+ "readability"
+ ],
+ "support": {
+ "source": "https://github.com/tt-rss/tt-rss-readability-php/tree/main",
+ "issues": "https://github.com/tt-rss/tt-rss-readability-php/issues"
+ },
+ "install-path": "../fivefilters/readability.php"
+ },
+ {
+ "name": "masterminds/html5",
+ "version": "dev-main",
+ "version_normalized": "dev-main",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/tt-rss/tt-rss-html5-php.git",
+ "reference": "d2c79ada2a87bb7eaafe1a39e4e3bb37853099aa"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/tt-rss/tt-rss-html5-php/zipball/d2c79ada2a87bb7eaafe1a39e4e3bb37853099aa",
+ "reference": "d2c79ada2a87bb7eaafe1a39e4e3bb37853099aa",
+ "shasum": ""
+ },
+ "require": {
+ "ext-ctype": "*",
+ "ext-dom": "*",
+ "ext-libxml": "*",
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7"
+ },
+ "time": "2022-12-11T19:41:09+00:00",
+ "default-branch": true,
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "installation-source": "source",
+ "autoload": {
+ "psr-4": {
+ "Masterminds\\": "src"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Masterminds\\HTML5\\Tests\\": "test/HTML5"
+ }
+ },
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Matt Butcher",
+ "email": "technosophos@gmail.com"
+ },
+ {
+ "name": "Matt Farina",
+ "email": "matt@mattfarina.com"
+ },
+ {
+ "name": "Asmir Mustafic",
+ "email": "goetas@gmail.com"
+ }
+ ],
+ "description": "An HTML5 parser and serializer.",
+ "homepage": "http://masterminds.github.io/html5-php",
+ "keywords": [
+ "dom",
+ "html",
+ "html5",
+ "parser",
+ "querypath",
+ "serializer",
+ "xml"
+ ],
+ "support": {
+ "source": "https://github.com/tt-rss/tt-rss-html5-php/tree/main",
+ "issues": "https://github.com/tt-rss/tt-rss-html5-php/issues"
+ },
+ "install-path": "../masterminds/html5"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.1.4",
+ "version_normalized": "1.1.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
+ "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "time": "2021-05-03T11:20:27+00:00",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/1.1.4"
+ },
+ "install-path": "../psr/log"
+ }
+ ],
+ "dev": true,
+ "dev-package-names": []
+}
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
new file mode 100644
index 0000000..117db3d
--- /dev/null
+++ b/vendor/composer/installed.php
@@ -0,0 +1,54 @@
+ array(
+ 'name' => '__root__',
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => 'fce528aa69c2a7193fb7eb3a3cd9dd17885d6ab6',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../../',
+ 'aliases' => array(),
+ 'dev' => true,
+ ),
+ 'versions' => array(
+ '__root__' => array(
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => 'fce528aa69c2a7193fb7eb3a3cd9dd17885d6ab6',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../../',
+ 'aliases' => array(),
+ 'dev_requirement' => false,
+ ),
+ 'fivefilters/readability.php' => array(
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => '3bc7e81ae758642292ce20df08c56cd42cefd9d8',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../fivefilters/readability.php',
+ 'aliases' => array(
+ 0 => '9999999-dev',
+ ),
+ 'dev_requirement' => false,
+ ),
+ 'masterminds/html5' => array(
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => 'd2c79ada2a87bb7eaafe1a39e4e3bb37853099aa',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../masterminds/html5',
+ 'aliases' => array(
+ 0 => '9999999-dev',
+ ),
+ 'dev_requirement' => false,
+ ),
+ 'psr/log' => array(
+ 'pretty_version' => '1.1.4',
+ 'version' => '1.1.4.0',
+ 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../psr/log',
+ 'aliases' => array(),
+ 'dev_requirement' => false,
+ ),
+ ),
+);
diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php
new file mode 100644
index 0000000..d826bd1
--- /dev/null
+++ b/vendor/composer/platform_check.php
@@ -0,0 +1,25 @@
+= 70300)) {
+ $issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
+}
+
+if ($issues) {
+ if (!headers_sent()) {
+ header('HTTP/1.1 500 Internal Server Error');
+ }
+ if (!ini_get('display_errors')) {
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
+ fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
+ } elseif (!headers_sent()) {
+ echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
+ }
+ }
+ throw new \RuntimeException(
+ 'Composer detected issues in your platform: ' . implode(' ', $issues)
+ );
+}
diff --git a/vendor/fivefilters/readability.php/.gitattributes b/vendor/fivefilters/readability.php/.gitattributes
new file mode 100644
index 0000000..c08d816
--- /dev/null
+++ b/vendor/fivefilters/readability.php/.gitattributes
@@ -0,0 +1,2 @@
+test/* linguist-language=PHP
+* text=auto eol=lf
\ No newline at end of file
diff --git a/vendor/fivefilters/readability.php/.github/workflows/main.yml b/vendor/fivefilters/readability.php/.github/workflows/main.yml
new file mode 100644
index 0000000..3682e64
--- /dev/null
+++ b/vendor/fivefilters/readability.php/.github/workflows/main.yml
@@ -0,0 +1,42 @@
+# This is a basic workflow to help you get started with Actions
+
+name: CI
+
+# Controls when the workflow will run
+on:
+ # Triggers the workflow on push or pull request events but only for the master branch
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
+jobs:
+ # This workflow contains a single job called "build"
+ build:
+ # The type of runner that the job will run on
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ php: ['7.3', '7.4', '8']
+ libxml: ['2.9.4', '2.9.5', '2.9.10', '2.9.12']
+
+ # Steps represent a sequence of tasks that will be executed as part of the job
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: actions/checkout@v2
+
+ # Runs a single command using the runners shell
+ #- name: Run a one-line script
+ # run: echo Hello, world!
+
+ # Runs a set of commands using the runners shell
+ - name: Run a multi-line script
+ run: |
+ composer install
+ docker build --build-arg PHP_VERSION=${{matrix.php}} --build-arg LIBXML_VERSION=${{matrix.libxml}} -t gh-action - < ./docker/php/Dockerfile
+ docker run --volume $PWD:/app --workdir="/app" --env XDEBUG_MODE=coverage gh-action php ./vendor/bin/phpunit --coverage-clover /app/test/clover.xml
diff --git a/vendor/fivefilters/readability.php/.gitignore b/vendor/fivefilters/readability.php/.gitignore
new file mode 100644
index 0000000..52b9f38
--- /dev/null
+++ b/vendor/fivefilters/readability.php/.gitignore
@@ -0,0 +1,5 @@
+.idea/
+vendor
+composer.lock
+/test.*
+/test/changed/
\ No newline at end of file
diff --git a/vendor/fivefilters/readability.php/AUTHORS.md b/vendor/fivefilters/readability.php/AUTHORS.md
new file mode 100644
index 0000000..fabdb5a
--- /dev/null
+++ b/vendor/fivefilters/readability.php/AUTHORS.md
@@ -0,0 +1,14 @@
+# Authors
+
+Readability.php developed by **Andres Rey**.
+
+Based on Arc90's readability.js (1.7.1) script available at: http://code.google.com/p/arc90labs-readability.
+Copyright (c) 2010 Arc90 Inc
+
+The AUTHORS/Contributors are (and/or have been):
+
+* Andres Rey
+* Sergiy Lavryk
+* Pedro Amorim
+* Malu Decks
+* Keyvan Minoukadeh
diff --git a/vendor/fivefilters/readability.php/CHANGELOG.md b/vendor/fivefilters/readability.php/CHANGELOG.md
new file mode 100644
index 0000000..20aef9e
--- /dev/null
+++ b/vendor/fivefilters/readability.php/CHANGELOG.md
@@ -0,0 +1,145 @@
+# Change Log
+All notable changes to this project will be documented in this file.
+
+## Unreleased
+
+## [v2.1.0](https://github.com/andreskrey/readability.php/releases/tag/v2.1.0)
+- Avoid overwriting extracted metadata with similarly named keys (like `og:image` and `og:image:width`)
+- Imported new `getSiteName()` feature from JS version as of [21 Dec 2018](https://github.com/mozilla/readability/pull/504)
+- Added getFirstElementChild function to NodeTrait + test case (Issue #83)
+- Reworked the test suit to use TestPage objects and give more hints about what failed
+- Removed getWordThreshold and setWordThreshold configuration functions
+- Added NodeUtility::filterTextNodes and deprecated NodeTrait getChildren()
+- Added new DOMNodeList fake class that mimics the original DOMNodeList class but allows to add new nodes to the list
+- Added new Dockerfiles that pulls different versions of PHP and libxml. Now we are supporting 4 versions of PHP and 6 versions of libxml!
+
+## [v2.0.1](https://github.com/andreskrey/readability.php/releases/tag/v2.0.1)
+- Fixed small issue that prevented the main image from showing up in the results
+
+## [v2.0.0](https://github.com/andreskrey/readability.php/releases/tag/v2.0.0)
+
+- [BREAKING CHANGE] Bumped the minimum supported version of PHP to 7.0
+- Clean `
', $html);
+
+ if ($this->configuration->getParser() === 'html5') {
+ $this->logger->debug('[Loading] Using HTML5 parser...');
+ $html5 = new HTML5(['disable_html_ns' => true, 'target_document' => new DOMDocument('1.0', 'utf-8')]);
+ $dom = $html5->loadHTML($html);
+ //TODO: Improve this so it looks inside
, not just any
+ $base = $dom->getElementsByTagName('base');
+ if ($base->length > 0) {
+ $base = $base->item(0);
+ $base = $base->getAttribute('href');
+ if ($base != '') {
+ $this->baseURI = $base;
+ }
+ }
+ } else {
+ $this->logger->debug('[Loading] Using libxml parser...');
+ $dom = new DOMDocument('1.0', 'utf-8');
+ if ($this->configuration->getNormalizeEntities()) {
+ $this->logger->debug('[Loading] Normalized entities via mb_convert_encoding.');
+ // Replace UTF-8 characters with the HTML Entity equivalent. Useful to fix html with mixed content
+ $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
+ }
+ }
+
+ if (!$this->configuration->getSubstituteEntities()) {
+ // Keep the original HTML entities
+ $dom->substituteEntities = false;
+ }
+
+ if ($this->configuration->getSummonCthulhu()) {
+ $this->logger->debug('[Loading] Removed script tags via regex H̶͈̩̟̬̱͠E̡̨̬͔̳̜͢͠ ̡̧̯͉̩͙̩̹̞̠͎͈̹̥̠͞ͅͅC̶͉̞̘̖̝̗͓̬̯͍͉̤̬͢͢͞Ò̟̘͉͖͎͉̱̭̣̕M̴̯͈̻̱̱̣̗͈̠̙̲̥͘͞E̷̛͙̼̲͍͕̹͍͇̗̻̬̮̭̱̥͢Ş̛̟͔̙̜̤͇̮͍̙̝̀͘');
+ $html = preg_replace('/
+
+
+
+
+ Hello World This is a test of the HTML5 parser.
+
+ & Nobody nowhere.
+
+ TEST
+
+ ©
+
+HERE;
+
+$html5 = new HTML5();
+$dom = $html5->loadHTML($html);
+
+echo "Converting to HTML 5\n";
+
+$html5->save($dom, fopen('php://stdin', 'w'));
diff --git a/vendor/masterminds/html5/phpunit.xml.dist b/vendor/masterminds/html5/phpunit.xml.dist
new file mode 100644
index 0000000..8e7750d
--- /dev/null
+++ b/vendor/masterminds/html5/phpunit.xml.dist
@@ -0,0 +1,8 @@
+
+
+
+
+ test/HTML5/
+
+
+
diff --git a/vendor/masterminds/html5/src/HTML5.php b/vendor/masterminds/html5/src/HTML5.php
new file mode 100644
index 0000000..c857145
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5.php
@@ -0,0 +1,246 @@
+ 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/vendor/masterminds/html5/src/HTML5/Elements.php b/vendor/masterminds/html5/src/HTML5/Elements.php
new file mode 100644
index 0000000..8fe7987
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Elements.php
@@ -0,0 +1,619 @@
+ 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/vendor/masterminds/html5/src/HTML5/Entities.php b/vendor/masterminds/html5/src/HTML5/Entities.php
new file mode 100644
index 0000000..0e7227d
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Entities.php
@@ -0,0 +1,2236 @@
+ 'Á',
+ '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/vendor/masterminds/html5/src/HTML5/Exception.php b/vendor/masterminds/html5/src/HTML5/Exception.php
new file mode 100644
index 0000000..64e97e6
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Exception.php
@@ -0,0 +1,10 @@
+ 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 .");
+ $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/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php b/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php
new file mode 100644
index 0000000..9893a71
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php
@@ -0,0 +1,114 @@
+).
+ *
+ * @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/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php b/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php
new file mode 100644
index 0000000..b081ed9
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php
@@ -0,0 +1,33 @@
+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('') will
+ * see if the input stream is at the start of a
+ * '' 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/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php b/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php
new file mode 100644
index 0000000..75b0886
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php
@@ -0,0 +1,336 @@
+
+
+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.
+ */
+ #[\ReturnTypeWillChange]
+ 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;
+ }
+
+ #[\ReturnTypeWillChange]
+ public function key()
+ {
+ return $this->char;
+ }
+}
diff --git a/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php b/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
new file mode 100644
index 0000000..300a446
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
@@ -0,0 +1,1191 @@
+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 . 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('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
+ 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 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('scanner->next();
+ do {
+ if (false === $tok) {
+ $this->parseError('Unexpected EOF inside CDATA.');
+ $this->bogusComment('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('') will
+ * see if the input stream is at the start of a
+ * '' 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 HEX;, got %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/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php b/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php
new file mode 100644
index 0000000..00d3951
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php
@@ -0,0 +1,127 @@
+ 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/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php b/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php
new file mode 100644
index 0000000..f6a70bf
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php
@@ -0,0 +1,183 @@
+
+
+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/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php b/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php
new file mode 100644
index 0000000..e9421a1
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php
@@ -0,0 +1,1533 @@
+ '	',
+ "\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/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php b/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php
new file mode 100644
index 0000000..ec467f2
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php
@@ -0,0 +1,553 @@
+'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 = '';
+
+ 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('');
+ $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/vendor/masterminds/html5/src/HTML5/Serializer/README.md b/vendor/masterminds/html5/src/HTML5/Serializer/README.md
new file mode 100644
index 0000000..849a47f
--- /dev/null
+++ b/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/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php b/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php
new file mode 100644
index 0000000..69a6ecd
--- /dev/null
+++ b/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php
@@ -0,0 +1,99 @@
+ '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 '';
+ 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/vendor/masterminds/html5/test/HTML5/ElementsTest.php b/vendor/masterminds/html5/test/HTML5/ElementsTest.php
new file mode 100644
index 0000000..08b5ee4
--- /dev/null
+++ b/vendor/masterminds/html5/test/HTML5/ElementsTest.php
@@ -0,0 +1,485 @@
+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/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html
new file mode 100644
index 0000000..fa5a029
--- /dev/null
+++ b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+ Žťčýů
+
+
diff --git a/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html
new file mode 100644
index 0000000..f0132da
--- /dev/null
+++ b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/vendor/masterminds/html5/test/HTML5/Html5Test.html b/vendor/masterminds/html5/test/HTML5/Html5Test.html
new file mode 100644
index 0000000..a976e8b
--- /dev/null
+++ b/vendor/masterminds/html5/test/HTML5/Html5Test.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test
+
+
+ This is a test.
+
+
\ No newline at end of file
diff --git a/vendor/masterminds/html5/test/HTML5/Html5Test.php b/vendor/masterminds/html5/test/HTML5/Html5Test.php
new file mode 100644
index 0000000..ed66d8a
--- /dev/null
+++ b/vendor/masterminds/html5/test/HTML5/Html5Test.php
@@ -0,0 +1,492 @@
+html5 = $this->getInstance();
+ }
+
+ /**
+ * Parse and serialize a string.
+ */
+ protected function cycle($html)
+ {
+ $dom = $this->html5->loadHTML('' . $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 = '
+
+
+ foo
+
+
+
+
+
+
+ ';
+ $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(' '), 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(' ', 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('');
+ $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 = '
+
+';
+
+ $dom = $this->html5->loadHTML($contents);
+ $this->assertInstanceOf('\DOMDocument', $dom);
+
+ $expected = '
+
+';
+ $this->assertEquals($expected, $this->html5->saveHTML($dom));
+ }
+
+ public function testLoadHTMLFragment()
+ {
+ $fragment = '';
+ $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('|This is a test.
|', $saved);
+ }
+
+ public function testSaveHTMLFragment()
+ {
+ $fragment = '';
+ $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('|This is a test.
|', $content);
+
+ // Test file
+ $tmpfname = tempnam(sys_get_temp_dir(), 'html5-php');
+ $this->html5->save($dom, $tmpfname);
+ $content = file_get_contents($tmpfname);
+ $this->assertRegExp('|This is a test.
|', $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(
+ '
+
+
+ foo bar baz
+
+
+
+
+
+
+ Test Text.
+
+
+
+
+ ');
+
+ $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('||', $html);
+ $this->assertRegExp('| |', $html);
+ }
+
+ public function testMathMl()
+ {
+ $dom = $this->html5->loadHTML(
+ '
+
+
+ foo bar baz
+
+ x
+
+ ±
+
+ y
+
+
+ ');
+
+ $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('||', $html);
+ $this->assertRegExp('|y |', $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(
+ '
+ Big rectangle thing
+ 40
+ 80
+
+ um, yeah ');
+
+ $this->assertEmpty($this->html5->getErrors());
+ $markup = $this->html5->saveHTML($dom);
+ $this->assertRegExp('|Big rectangle thing |', $markup);
+ $this->assertRegExp('|um, yeah |', $markup);
+ }
+
+ public function testElements()
+ {
+ // Should have content.
+ $res = $this->cycle('FOO
');
+ $this->assertRegExp('|FOO
|', $res);
+
+ // Should be empty
+ $res = $this->cycle(' ');
+ $this->assertRegExp('| |', $res);
+
+ // Should have content.
+ $res = $this->cycleFragment('FOO
');
+ $this->assertRegExp('|FOO
|', $res);
+
+ // Should be empty
+ $res = $this->cycleFragment(' ');
+ $this->assertRegExp('| |', $res);
+
+ // Elements with dashes and underscores
+ $res = $this->cycleFragment(' ');
+ $this->assertRegExp('| |', $res);
+ $res = $this->cycleFragment(' ');
+ $this->assertRegExp('| |', $res);
+
+ // Should have no closing tag.
+ $res = $this->cycle(' ');
+ $this->assertRegExp('| Error