HTML-Scrubber-0.17/000755 000765 000024 00000000000 13124453667 014226 5ustar00nigelstaff000000 000000 HTML-Scrubber-0.17/Changes000644 000765 000024 00000007101 13124453667 015520 0ustar00nigelstaff000000 000000 Revision history for Perl extension HTML::Scrubber. 0.17 2017-06-27 14:03:47+01:00 Europe/London 0.16 2017-06-25 20:30:15+01:00 Europe/London (TRIAL RELEASE) - Add missing testing prereqs (github pr#9 paultcochrane) - Extend list of Perls in Travis config (github pr#10 paultcochrane) - Avoid pod-spell test failure from ABSTRACT text (github pr#11 paultcochrane) - Minor documentation fixes (github pr#12 paultcochrane) - Purge trailing whitespace in Travis config (github pr#13 paultcochrane) - Fix perlcritic issues (github pr#14 paultcochrane) - Fix stale URLs (github pr#15 paultcochrane) - Remove invalid end tags for empty elements (RT120384) (github pr#16 paultcochrane) - Rework Dist::Zilla config to be more portable 0.15 2015-10-10 15:01:31+01:00 Europe/London - Minor spelling check avoidance tweaks - Enforce comments to be well formed, to resolve potential security issue described in JVN53973084 0.14 2015-04-02 17:20:41+01:00 Europe/London - Travis integration (thanks to mrcaron) - Fix some packaging/dist-zilla issues (thanks to mrcaron) - check for definedness before calling ->parse (github #3 leejo) - Removed the link to HTML::Sanitizer (github #4 avereha) - Removed circular reference (github #5 avereha) - Fixed up dependancies from dzil bundles - Enforced minimum perl version of 5.8 0.11 2013-10-11 15:11:59 Europe/London - Build/release changes only 0.10 2013-09-27 15:05:03 Europe/London - RT3008 Changed examples to be XSS free - RT19063, RT25477 fixed handling of self closing tags, for example '
' - * attribute rule can be a regexp - callbacks in rules to check or adjust attributes with custom code (RT15747) 0.09 2011-04-01 16:35:50 Europe/London - Basic conversion to Dist::Zilla/git - Tidies to keep Perl::Critic happier - Removed use of naked filehandles - Reworked tests to not use predicable temp file name - Collapsed duplicate code to a single version - Various documentation tweaks - Change of maintainer as PODMASTER cannot be contacted 0.08 Thu Apr 1 14:14:38 2004 - removed test which relied on stuff that changed in HTML-Parser-3.36 0.07 Thu Mar 18 06:21:38 2004 - allow for boolean attributes (thanks b10m) - which is why now attribute order is followed (attrseq) repeated elements get squashed (see 07_booleans.t for details). 0.06 Sun Nov 2 01:26:42 2003 - fixed more typos - added t\06_scrub_file.t (that part was broken, now fixed) 0.05 Thu Oct 30 23:27:37 2003 - fixed up various typos in tests ... - bumped up version number ;( 0.04 Wed Oct 29 18:35:08 2003 - added missing lc in a few places (and got rid of for @_) - fixed (and improved) optimizations (stupid typo) - added DESTROY to break circular reference (I lost my TODO, so i forgot) - added more pod (allow deny ...) - improved test suite - added LICENSE file - added script/style functions (nice) 0.03 Mon Jul 21 07:32:10 2003 - perltidy ;) - closed http://rt.cpan.org/NoAuth/Bug.html?id=2969 now escape spurious >< in text - updated test.pl 0.02 Fri Apr 18 14:12:02 2003 - finished TODO, settled on API - created a cpan worthy distribution and uploaded to CPAN 0.01 Thu Apr 17 20:34:11 2003 - original version; created by h2xs 1.21 with options -AX HTML::Scrubber - wrote initial version and released at http://perlmonks.org/index.pl?node_id=251427 HTML-Scrubber-0.17/dist.ini000644 000765 000024 00000006507 13124453667 015702 0ustar00nigelstaff000000 000000 name = HTML-Scrubber author = Ruslan Zakirov author = Nigel Metheringham author = D. H. license = Perl_5 copyright_holder = Ruslan Zakirov, Nigel Metheringham, 2003-2004 D. H. copyright_year = 2017 [AutoPrereqs] skip = ^blib [Prereqs / TestRequires] Test::NoTabs = 0 Pod::Coverage::TrustPod = 0 Test::CPAN::Meta = 0 Test::Differences = 0 Test::EOL = 0 Test::Kwalitee = 1.21 Test::Memory::Cycle = 0 Test::More = 0.88 Test::PAUSE::Permissions = 0 Test::Pod = 1.41 Test::Pod::Coverage = 1.08 ;; -- Declare additional author deps for Dist::Zilla ; authordep Pod::Elemental::Transformer::List ; authordep Pod::Weaver::Plugin::WikiDoc ; authordep Pod::Weaver::PluginBundle::Default ; authordep Pod::Weaver::Section::Contributors ; authordep Pod::Weaver::Section::Support [NextRelease] ; Mark up the next release in changes [@Git] changelog = Changes allow_dirty = dist.ini allow_dirty = Changes allow_dirty = README.md commit_msg = v%v%n%n%c tag_format = release/%v tag_message = %v push_to = origin ;; -- Additional git [Git::GatherDir] [Git::NextVersion] ; Get the next version tag from git version_regexp = ^release/(\d+.\d+)$ [Git::CheckFor::CorrectBranch] ; ensure on master branch for release [Git::Remote::Check] ; ensure our branch is ahead of remote [Git::Contributors] ; add contributors from the git logs [Git::CommitBuild] branch = release_branch = cpan ;; -- Sets of additional tests we want to do as part of release [Test::Perl::Critic] [MetaTests] [PodCoverageTests] [OurPkgVersion] [Test::Kwalitee] [Test::EOL] [Test::PAUSE::Permissions] ; if doing a release make sure we have PAUSE perms [Test::NoTabs] ;; -- Additional information [GithubMeta] ; Grab the repo metadata [PodWeaver] ; Mangle the pod a bit [CheckChangeLog] ; Make sure we have a change set [Authority] authority = cpan:NIGELM do_metadata = 1 locate_comment = 1 [@Starter] -remove = GatherDir ; we use [Git::GatherDir] instead ; -- Put an autogenerated Markdown readme into the repo [ReadmeAnyFromPod / Markdown_Readme] type = markdown filename = README.md location = root ; do not include pod readmes in the build! [Meta::Contributors] ;; -- Add decoration to the github readme [GitHubREADME::Badge] badges = travis ;badges = coveralls ;badges = gitter badges = cpants badges = issues badges = github_tag badges = license badges = version ;badges = codecov ;badges = gitlab_ci ;badges = gitlab_cover ;; - end HTML-Scrubber-0.17/lib/000755 000765 000024 00000000000 13124453667 014774 5ustar00nigelstaff000000 000000 HTML-Scrubber-0.17/LICENSE000644 000765 000024 00000044037 13124453667 015243 0ustar00nigelstaff000000 000000 This software is copyright (c) 2017 by Ruslan Zakirov, Nigel Metheringham, 2003-2004 D. H. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2017 by Ruslan Zakirov, Nigel Metheringham, 2003-2004 D. H. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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. END OF TERMS AND CONDITIONS Appendix: 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 humanity, 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 convey 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) 19yy 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 1, 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2017 by Ruslan Zakirov, Nigel Metheringham, 2003-2004 D. H. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End HTML-Scrubber-0.17/Makefile.PL000644 000765 000024 00000004200 13124453667 016174 0ustar00nigelstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.007. use strict; use warnings; use 5.008; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Perl extension for scrubbing/sanitizing HTML", "AUTHOR" => "Ruslan Zakirov , Nigel Metheringham , D. H. ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "HTML-Scrubber", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.008", "NAME" => "HTML::Scrubber", "PREREQ_PM" => { "HTML::Entities" => 0, "HTML::Parser" => "3.47", "List::Util" => 0, "Scalar::Util" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Temp" => 0, "Pod::Coverage::TrustPod" => 0, "Test" => 0, "Test::CPAN::Meta" => 0, "Test::Differences" => 0, "Test::EOL" => 0, "Test::Kwalitee" => "1.21", "Test::Memory::Cycle" => 0, "Test::More" => "0.88", "Test::NoTabs" => 0, "Test::PAUSE::Permissions" => 0, "Test::Pod" => "1.41", "Test::Pod::Coverage" => "1.08", "utf8" => 0 }, "VERSION" => "0.17", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Temp" => 0, "HTML::Entities" => 0, "HTML::Parser" => "3.47", "List::Util" => 0, "Pod::Coverage::TrustPod" => 0, "Scalar::Util" => 0, "Test" => 0, "Test::CPAN::Meta" => 0, "Test::Differences" => 0, "Test::EOL" => 0, "Test::Kwalitee" => "1.21", "Test::Memory::Cycle" => 0, "Test::More" => "0.88", "Test::NoTabs" => 0, "Test::PAUSE::Permissions" => 0, "Test::Pod" => "1.41", "Test::Pod::Coverage" => "1.08", "strict" => 0, "utf8" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); HTML-Scrubber-0.17/MANIFEST000644 000765 000024 00000001330 13124453667 015354 0ustar00nigelstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.007. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/HTML/Scrubber.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/01_use.t t/02_basic.t t/03_more.t t/04_style_script.t t/05_pi_comment.t t/06_scrub_file.t t/07_booleans.t t/08_cb_attrs.t t/09_memory_cycle.t t/09_no_scrub_warnings.t t/jvn53973084.t t/rt120384_remove_false_tags.t t/rt19063_xhtml.t t/rt25477_self_closing.t t/rt72659_utf8.t t/rt79044_multiple.t weaver.ini xt/author/00-compile.t xt/author/critic.t xt/author/eol.t xt/author/no-tabs.t xt/author/pod-coverage.t xt/author/pod-syntax.t xt/release/distmeta.t xt/release/kwalitee.t xt/release/pause-permissions.t HTML-Scrubber-0.17/META.json000644 000765 000024 00000057706 13124453667 015666 0ustar00nigelstaff000000 000000 { "abstract" : "Perl extension for scrubbing/sanitizing HTML", "author" : [ "Ruslan Zakirov ", "Nigel Metheringham ", "D. H. " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.007, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "HTML-Scrubber", "no_index" : { "directory" : [ "eg", "examples", "inc", "share", "t", "xt" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "English" : "0", "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Meta" : "0", "Test::EOL" : "0", "Test::Kwalitee" : "1.21", "Test::More" : "0.88", "Test::NoTabs" : "0", "Test::PAUSE::Permissions" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "HTML::Entities" : "0", "HTML::Parser" : "3.47", "List::Util" : "0", "Scalar::Util" : "0", "perl" : "5.008", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "File::Temp" : "0", "Pod::Coverage::TrustPod" : "0", "Test" : "0", "Test::CPAN::Meta" : "0", "Test::Differences" : "0", "Test::EOL" : "0", "Test::Kwalitee" : "1.21", "Test::Memory::Cycle" : "0", "Test::More" : "0.88", "Test::NoTabs" : "0", "Test::PAUSE::Permissions" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "utf8" : "0" } } }, "provides" : { "HTML::Scrubber" : { "file" : "lib/HTML/Scrubber.pm", "version" : "0.17" } }, "release_status" : "stable", "resources" : { "homepage" : "https://github.com/nigelm/html-scrubber", "repository" : { "type" : "git", "url" : "https://github.com/nigelm/html-scrubber.git", "web" : "https://github.com/nigelm/html-scrubber" } }, "version" : "0.17", "x_Dist_Zilla" : { "perl" : { "version" : "5.024000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "AutoPrereqs", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "TestRequires", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "NextRelease", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "README.md", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Git/Check", "version" : "2.039" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%v%n%n%c" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "README.md", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git/Commit", "version" : "2.039" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "release/0.17", "tag_format" : "release/%v", "tag_message" : "%v" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git/Tag", "version" : "2.039" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Git/Push", "version" : "2.039" }, { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "Git::GatherDir", "version" : "2.039" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : "0.001", "version_by_branch" : 0, "version_regexp" : "(?^u:^release/(\\d+.\\d+)$)" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "Git::NextVersion", "version" : "2.039" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch", "config" : { "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "Git::CheckFor::CorrectBranch", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Check", "name" : "Git::Remote::Check", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git --version" : "2.13.0", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "Git::Contributors", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::Git::CommitBuild", "config" : { "Dist::Zilla::Plugin::Git::CommitBuild" : { "branch" : "", "build_root" : null, "message" : "Build results of %h (on %b)", "multiple_inheritance" : 0, "release_branch" : "cpan", "release_message" : "Build results of %h (on %b)" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "Git::CommitBuild", "version" : "2.039" }, { "class" : "Dist::Zilla::Plugin::Test::Perl::Critic", "name" : "Test::Perl::Critic", "version" : "3.000" }, { "class" : "Dist::Zilla::Plugin::MetaTests", "name" : "MetaTests", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "PodCoverageTests", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::OurPkgVersion", "name" : "OurPkgVersion", "version" : "0.10" }, { "class" : "Dist::Zilla::Plugin::Test::Kwalitee", "config" : { "Dist::Zilla::Plugin::Test::Kwalitee" : { "filename" : "xt/release/kwalitee.t", "skiptest" : [] } }, "name" : "Test::Kwalitee", "version" : "2.12" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ], "trailing_whitespace" : 1 } }, "name" : "Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::PAUSE::Permissions", "name" : "Test::PAUSE::Permissions", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "Test::NoTabs", "version" : "0.15" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "GithubMeta", "version" : "0.54" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::WikiDoc", "name" : "-WikiDoc", "version" : "0.093004" }, { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.014" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.014" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@Default/SingleEncoding", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@Default/Name", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@Default/Version", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Default/prelude", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@Default/Leftovers", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Default/postlude", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@Default/Authors", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@Default/Legal", "version" : "4.014" }, { "class" : "Pod::Weaver::Section::Support", "name" : "Support", "version" : "1.007" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "-Transformer", "version" : "4.014" } ] } }, "name" : "PodWeaver", "version" : "4.008" }, { "class" : "Dist::Zilla::Plugin::CheckChangeLog", "name" : "CheckChangeLog", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Starter/PruneCruft", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Starter/ManifestSkip", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Starter/MetaConfig", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.007" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002003", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000031", "version" : "0.004" } }, "name" : "@Starter/MetaProvides::Package", "version" : "2.004002" }, { "class" : "Dist::Zilla::Plugin::MetaNoIndex", "name" : "@Starter/MetaNoIndex", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Starter/MetaYAML", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Starter/MetaJSON", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Starter/License", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "@Starter/ReadmeAnyFromPod", "version" : "0.161170" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Starter/ExecDir", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Starter/ShareDir", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Starter/PodSyntaxTests", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@Starter/Test::ReportPrereqs", "version" : "0.025" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : 0, "fail_on_warning" : "author", "fake_home" : 0, "filename" : "xt/author/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "develop", "script_finder" : [ ":PerlExecFiles" ], "skips" : [] } }, "name" : "@Starter/Test::Compile", "version" : "2.054" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Starter/MakeMaker", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Starter/Manifest", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Starter/TestRelease", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Starter/RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Starter/ConfirmRelease", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Starter/UploadToCPAN", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "Markdown_Readme", "version" : "0.161170" }, { "class" : "Dist::Zilla::Plugin::Meta::Contributors", "name" : "Meta::Contributors", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::GitHubREADME::Badge", "name" : "GitHubREADME::Badge", "version" : "0.20" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.007" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.007" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.007" } }, "x_authority" : "cpan:NIGELM", "x_contributors" : [ "Andrei Vereha ", "Lee Johnson ", "Michael Caron ", "Michael Caron ", "Nigel Metheringham ", "Paul Cochrane ", "Ruslan Zakirov ", "Sergey Romanov ", "vagrant " ], "x_serialization_backend" : "Cpanel::JSON::XS version 3.0217" } HTML-Scrubber-0.17/META.yml000644 000765 000024 00000036210 13124453667 015501 0ustar00nigelstaff000000 000000 --- abstract: 'Perl extension for scrubbing/sanitizing HTML' author: - 'Ruslan Zakirov ' - 'Nigel Metheringham ' - 'D. H. ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' File::Temp: '0' Pod::Coverage::TrustPod: '0' Test: '0' Test::CPAN::Meta: '0' Test::Differences: '0' Test::EOL: '0' Test::Kwalitee: '1.21' Test::Memory::Cycle: '0' Test::More: '0.88' Test::NoTabs: '0' Test::PAUSE::Permissions: '0' Test::Pod: '1.41' Test::Pod::Coverage: '1.08' utf8: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.007, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: HTML-Scrubber no_index: directory: - eg - examples - inc - share - t - xt provides: HTML::Scrubber: file: lib/HTML/Scrubber.pm version: '0.17' requires: HTML::Entities: '0' HTML::Parser: '3.47' List::Util: '0' Scalar::Util: '0' perl: '5.008' strict: '0' warnings: '0' resources: homepage: https://github.com/nigelm/html-scrubber repository: https://github.com/nigelm/html-scrubber.git version: '0.17' x_Dist_Zilla: perl: version: '5.024000' plugins: - class: Dist::Zilla::Plugin::AutoPrereqs name: AutoPrereqs version: '6.007' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: TestRequires version: '6.007' - class: Dist::Zilla::Plugin::NextRelease name: NextRelease version: '6.007' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - README.md - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Git/Check' version: '2.039' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%v%n%n%c Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - README.md - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git/Commit' version: '2.039' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: release/0.17 tag_format: release/%v tag_message: '%v' Dist::Zilla::Role::Git::Repo: repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git/Tag' version: '2.039' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Git/Push' version: '2.039' - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: Git::GatherDir version: '2.039' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '0.001' version_by_branch: 0 version_regexp: (?^u:^release/(\d+.\d+)$) Dist::Zilla::Role::Git::Repo: repo_root: . name: Git::NextVersion version: '2.039' - class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch config: Dist::Zilla::Role::Git::Repo: repo_root: . name: Git::CheckFor::CorrectBranch version: '0.013' - class: Dist::Zilla::Plugin::Git::Remote::Check name: Git::Remote::Check version: 0.1.2 - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: 'git --version': 2.13.0 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: Git::Contributors version: '0.029' - class: Dist::Zilla::Plugin::Git::CommitBuild config: Dist::Zilla::Plugin::Git::CommitBuild: branch: '' build_root: ~ message: 'Build results of %h (on %b)' multiple_inheritance: 0 release_branch: cpan release_message: 'Build results of %h (on %b)' Dist::Zilla::Role::Git::Repo: repo_root: . name: Git::CommitBuild version: '2.039' - class: Dist::Zilla::Plugin::Test::Perl::Critic name: Test::Perl::Critic version: '3.000' - class: Dist::Zilla::Plugin::MetaTests name: MetaTests version: '6.007' - class: Dist::Zilla::Plugin::PodCoverageTests name: PodCoverageTests version: '6.007' - class: Dist::Zilla::Plugin::OurPkgVersion name: OurPkgVersion version: '0.10' - class: Dist::Zilla::Plugin::Test::Kwalitee config: Dist::Zilla::Plugin::Test::Kwalitee: filename: xt/release/kwalitee.t skiptest: [] name: Test::Kwalitee version: '2.12' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' trailing_whitespace: 1 name: Test::EOL version: '0.19' - class: Dist::Zilla::Plugin::Test::PAUSE::Permissions name: Test::PAUSE::Permissions version: '0.003' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: Test::NoTabs version: '0.15' - class: Dist::Zilla::Plugin::GithubMeta name: GithubMeta version: '0.54' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::WikiDoc name: -WikiDoc version: '0.093004' - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.014' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.014' - class: Pod::Weaver::Plugin::SingleEncoding name: '@Default/SingleEncoding' version: '4.014' - class: Pod::Weaver::Section::Name name: '@Default/Name' version: '4.014' - class: Pod::Weaver::Section::Version name: '@Default/Version' version: '4.014' - class: Pod::Weaver::Section::Region name: '@Default/prelude' version: '4.014' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.014' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.014' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.014' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.014' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.014' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.014' - class: Pod::Weaver::Section::Leftovers name: '@Default/Leftovers' version: '4.014' - class: Pod::Weaver::Section::Region name: '@Default/postlude' version: '4.014' - class: Pod::Weaver::Section::Authors name: '@Default/Authors' version: '4.014' - class: Pod::Weaver::Section::Legal name: '@Default/Legal' version: '4.014' - class: Pod::Weaver::Section::Support name: Support version: '1.007' - class: Pod::Weaver::Section::Contributors name: Contributors version: '0.009' - class: Pod::Weaver::Plugin::Transformer name: -Transformer version: '4.014' name: PodWeaver version: '4.008' - class: Dist::Zilla::Plugin::CheckChangeLog name: CheckChangeLog version: '0.02' - class: Dist::Zilla::Plugin::Authority name: Authority version: '1.009' - class: Dist::Zilla::Plugin::PruneCruft name: '@Starter/PruneCruft' version: '6.007' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Starter/ManifestSkip' version: '6.007' - class: Dist::Zilla::Plugin::MetaConfig name: '@Starter/MetaConfig' version: '6.007' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.007' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002003' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000031' version: '0.004' name: '@Starter/MetaProvides::Package' version: '2.004002' - class: Dist::Zilla::Plugin::MetaNoIndex name: '@Starter/MetaNoIndex' version: '6.007' - class: Dist::Zilla::Plugin::MetaYAML name: '@Starter/MetaYAML' version: '6.007' - class: Dist::Zilla::Plugin::MetaJSON name: '@Starter/MetaJSON' version: '6.007' - class: Dist::Zilla::Plugin::License name: '@Starter/License' version: '6.007' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: '@Starter/ReadmeAnyFromPod' version: '0.161170' - class: Dist::Zilla::Plugin::ExecDir name: '@Starter/ExecDir' version: '6.007' - class: Dist::Zilla::Plugin::ShareDir name: '@Starter/ShareDir' version: '6.007' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Starter/PodSyntaxTests' version: '6.007' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@Starter/Test::ReportPrereqs' version: '0.025' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: 0 filename: xt/author/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: develop script_finder: - ':PerlExecFiles' skips: [] name: '@Starter/Test::Compile' version: '2.054' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Starter/MakeMaker' version: '6.007' - class: Dist::Zilla::Plugin::Manifest name: '@Starter/Manifest' version: '6.007' - class: Dist::Zilla::Plugin::TestRelease name: '@Starter/TestRelease' version: '6.007' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Starter/RunExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Starter/ConfirmRelease' version: '6.007' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Starter/UploadToCPAN' version: '6.007' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: Markdown_Readme version: '0.161170' - class: Dist::Zilla::Plugin::Meta::Contributors name: Meta::Contributors version: '0.003' - class: Dist::Zilla::Plugin::GitHubREADME::Badge name: GitHubREADME::Badge version: '0.20' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.007' - class: Dist::Zilla::Plugin::FinderCode name: '@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.007' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.007' x_authority: cpan:NIGELM x_contributors: - 'Andrei Vereha ' - 'Lee Johnson ' - 'Michael Caron ' - 'Michael Caron ' - 'Nigel Metheringham ' - 'Paul Cochrane ' - 'Ruslan Zakirov ' - 'Sergey Romanov ' - 'vagrant ' x_serialization_backend: 'YAML::Tiny version 1.69' HTML-Scrubber-0.17/README000644 000765 000024 00000035054 13124453667 015115 0ustar00nigelstaff000000 000000 NAME HTML::Scrubber - Perl extension for scrubbing/sanitizing HTML VERSION version 0.17 SYNOPSIS use HTML::Scrubber; my $scrubber = HTML::Scrubber->new( allow => [ qw[ p b i u hr br ] ] ); print $scrubber->scrub('

bold missing

'); # output is:

bold

# more complex input my $html = q[
a => link br =>
b => bold u => UNDERLINE ]; print $scrubber->scrub($html); $scrubber->deny( qw[ p b i u hr br ] ); print $scrubber->scrub($html); DESCRIPTION If you want to "scrub" or "sanitize" html input in a reliable and flexible fashion, then this module is for you. I wasn't satisfied with HTML::Sanitizer because it is based on HTML::TreeBuilder, so I thought I'd write something similar that works directly with HTML::Parser. METHODS First a note on documentation: just study the EXAMPLE below. It's all the documentation you could need. Also, be sure to read all the comments as well as How does it work?. If you're new to perl, good luck to you. new my $scrubber = HTML::Scrubber->new( allow => [ qw[ p b i u hr br ] ] ); Build a new HTML::Scrubber. The arguments are the initial values for the following directives:- * default * allow * deny * rules * process * comment comment warn "comments are ", $p->comment ? 'allowed' : 'not allowed'; $p->comment(0); # off by default process warn "process instructions are ", $p->process ? 'allowed' : 'not allowed'; $p->process(0); # off by default script warn "script tags (and everything in between) are supressed" if $p->script; # off by default $p->script( 0 || 1 ); ** Please note that this is implemented using HTML::Parser's ignore_elements function, so if script is set to true, all script tags encountered will be validated like all other tags. style warn "style tags (and everything in between) are supressed" if $p->style; # off by default $p->style( 0 || 1 ); ** Please note that this is implemented using HTML::Parser's ignore_elements function, so if style is set to true, all style tags encountered will be validated like all other tags. allow $p->allow(qw[ t a g s ]); deny $p->deny(qw[ t a g s ]); rules $p->rules( img => { src => qr{^(?!http://)}i, # only relative image links allowed alt => 1, # alt attribute allowed '*' => 0, # deny all other attributes }, a => { href => sub { ... }, # check or adjust with a callback }, b => 1, ... ); Updates a set of attribute rules. Each rule can be 1/0, a regular expression or a callback. Values longer than 1 char are treated as regexps. The callback is called with the following arguments: the current object, tag name, attribute name, and attribute value; the callback should return an empty list to drop the attribute, undef to keep it without a value, or a new scalar value. default print "default is ", $p->default(); $p->default(1); # allow tags by default $p->default( undef, # don't change { # default attribute rules '*' => 1, # allow attributes by default } ); scrub_file $html = $scrubber->scrub_file('foo.html'); ## returns giant string die "Eeek $!" unless defined $html; ## opening foo.html may have failed $scrubber->scrub_file('foo.html', 'new.html') or die "Eeek $!"; $scrubber->scrub_file('foo.html', *STDOUT) or die "Eeek $!" if fileno STDOUT; scrub print $scrubber->scrub($html); ## returns giant string $scrubber->scrub($html, 'new.html') or die "Eeek $!"; $scrubber->scrub($html', *STDOUT) or die "Eeek $!" if fileno STDOUT; default handler, used by both _scrub and _scrub_fh. Moved all the common code (basically all of it) into a single routine for ease of maintenance. default handler, does the scrubbing if we're scrubbing out to a file. Now calls _scrub_str and pushes that out to a file. default handler, does the scrubbing if we're returning a giant string. Now calls _scrub_str and appends that to the output string. How does it work? When a tag is encountered, HTML::Scrubber allows/denies the tag using the explicit rule if one exists. If no explicit rule exists, Scrubber applies the default rule. If an explicit rule exists, but it's a simple rule(1), then the default attribute rule is applied. EXAMPLE #!/usr/bin/perl -w use HTML::Scrubber; use strict; my @allow = qw[ br hr b a ]; my @rules = ( script => 0, img => { src => qr{^(?!http://)}i, # only relative image links allowed alt => 1, # alt attribute allowed '*' => 0, # deny all other attributes }, ); my @default = ( 0 => # default rule, deny all tags { '*' => 1, # default rule, allow all attributes 'href' => qr{^(?:http|https|ftp)://}i, 'src' => qr{^(?:http|https|ftp)://}i, # If your perl doesn't have qr # just use a string with length greater than 1 'cite' => '(?i-xsm:^(?:http|https|ftp):)', 'language' => 0, 'name' => 1, # could be sneaky, but hey ;) 'onblur' => 0, 'onchange' => 0, 'onclick' => 0, 'ondblclick' => 0, 'onerror' => 0, 'onfocus' => 0, 'onkeydown' => 0, 'onkeypress' => 0, 'onkeyup' => 0, 'onload' => 0, 'onmousedown' => 0, 'onmousemove' => 0, 'onmouseout' => 0, 'onmouseover' => 0, 'onmouseup' => 0, 'onreset' => 0, 'onselect' => 0, 'onsubmit' => 0, 'onunload' => 0, 'src' => 0, 'type' => 0, } ); my $scrubber = HTML::Scrubber->new(); $scrubber->allow(@allow); $scrubber->rules(@rules); # key/value pairs $scrubber->default(@default); $scrubber->comment(1); # 1 allow, 0 deny ## preferred way to create the same object $scrubber = HTML::Scrubber->new( allow => \@allow, rules => \@rules, default => \@default, comment => 1, process => 0, ); require Data::Dumper, die Data::Dumper::Dumper($scrubber) if @ARGV; my $it = q[
IN ITALICS WITH FAKE="attribute"
IN BOLD
HREF=JAVA <!>
ONMOUSEOVER JAVASCRIPT
]; print "#original text", $/, $it, $/; print "#scrubbed text (default ", $scrubber->default(), # no arguments returns the current value " comment ", $scrubber->comment(), " process ", $scrubber->process(), " )", $/, $scrubber->scrub($it), $/; $scrubber->default(1); # allow all tags by default $scrubber->comment(0); # deny comments print "#scrubbed text (default ", $scrubber->default(), " comment ", $scrubber->comment(), " process ", $scrubber->process(), " )", $/, $scrubber->scrub($it), $/; $scrubber->process(1); # allow process instructions (dangerous) $default[0] = 1; # allow all tags by default $default[1]->{'*'} = 0; # deny all attributes by default $scrubber->default(@default); # set the default again print "#scrubbed text (default ", $scrubber->default(), " comment ", $scrubber->comment(), " process ", $scrubber->process(), " )", $/, $scrubber->scrub($it), $/; FUN If you have Test::Inline (and you've installed HTML::Scrubber), try pod2test Scrubber.pm >scrubber.t perl scrubber.t SEE ALSO HTML::Parser, Test::Inline. The HTML::Sanitizer module is no longer available on CPAN. VERSION REQUIREMENTS As of version 0.14 I have added a perl minimum version requirement of 5.8. This is basically due to failures on the smokers perl 5.6 installations - which appears to be down to installation mechanisms and requirements. Since I don't want to spend the time supporting a version that is so old (and may not work for reasons on UTF support etc), I have added a use 5.008; to the main module. If this is problematic I am very willing to accept patches to fix this up, although I do not personally see a good reason to support a release that has been obsolete for 13 years. CONTRIBUTING If you want to contribute to the development of this module, the code is on GitHub . You'll need a perl environment with Dist::Zilla, and if you're just getting started, there's some documentation on using Vagrant and Perlbrew here . There is now a .perltidyrc and a .tidyallrc file within the repository for the standard perltidy settings used - I will apply these before new releases. Please do not let formatting prevent you from sending in patches etc - this can be sorted out as part of the release process. Info on tidyall can be found at https://metacpan.org/pod/distribution/Code-TidyAll/bin/tidyall. AUTHORS * Ruslan Zakirov * Nigel Metheringham * D. H. COPYRIGHT AND LICENSE This software is copyright (c) 2017 by Ruslan Zakirov, Nigel Metheringham, 2003-2004 D. H. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. SUPPORT Perldoc You can find documentation for this module with the perldoc command. perldoc HTML::Scrubber Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. http://metacpan.org/release/HTML-Scrubber * Search CPAN The default CPAN search engine, useful to view POD in HTML format. http://search.cpan.org/dist/HTML-Scrubber * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. https://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Scrubber * AnnoCPAN The AnnoCPAN is a website that allows community annotations of Perl module documentation. http://annocpan.org/dist/HTML-Scrubber * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. http://cpanratings.perl.org/d/HTML-Scrubber * CPAN Forum The CPAN Forum is a web forum for discussing Perl modules. http://cpanforum.com/dist/HTML-Scrubber * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. http://cpants.cpanauthors.org/dist/HTML-Scrubber * CPAN Testers The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. http://www.cpantesters.org/distro/H/HTML-Scrubber * CPAN Testers Matrix The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. http://matrix.cpantesters.org/?dist=HTML-Scrubber * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. http://deps.cpantesters.org/?module=HTML::Scrubber Bugs / Feature Requests Please report any bugs or feature requests by email to bug-html-scrubber at rt.cpan.org, or through the web interface at https://rt.cpan.org/Public/Bug/Report.html?Queue=HTML-Scrubber. You will be automatically notified of any progress on the request by the system. Source Code The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) https://github.com/nigelm/html-scrubber git clone https://github.com/nigelm/html-scrubber.git CONTRIBUTORS * Andrei Vereha * Lee Johnson * Michael Caron * Michael Caron * Nigel Metheringham * Paul Cochrane * Ruslan Zakirov * Sergey Romanov * vagrant HTML-Scrubber-0.17/t/000755 000765 000024 00000000000 13124453667 014471 5ustar00nigelstaff000000 000000 HTML-Scrubber-0.17/weaver.ini000644 000765 000024 00000000131 13124453667 016213 0ustar00nigelstaff000000 000000 [-WikiDoc] [@Default] [Support] [Contributors] [-Transformer] transformer = List HTML-Scrubber-0.17/xt/000755 000765 000024 00000000000 13124453667 014661 5ustar00nigelstaff000000 000000 HTML-Scrubber-0.17/xt/author/000755 000765 000024 00000000000 13124453667 016163 5ustar00nigelstaff000000 000000 HTML-Scrubber-0.17/xt/release/000755 000765 000024 00000000000 13124453667 016301 5ustar00nigelstaff000000 000000 HTML-Scrubber-0.17/xt/release/distmeta.t000644 000765 000024 00000000172 13124453667 020300 0ustar00nigelstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. use Test::CPAN::Meta; meta_yaml_ok(); HTML-Scrubber-0.17/xt/release/kwalitee.t000644 000765 000024 00000000275 13124453667 020277 0ustar00nigelstaff000000 000000 # this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.12 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok(); done_testing; HTML-Scrubber-0.17/xt/release/pause-permissions.t000644 000765 000024 00000000454 13124453667 022157 0ustar00nigelstaff000000 000000 use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::PAUSE::Permissions 0.003 use Test::More; BEGIN { plan skip_all => 'Test::PAUSE::Permissions required for testing pause permissions' if $] < 5.010; } use Test::PAUSE::Permissions; all_permissions_ok(); HTML-Scrubber-0.17/xt/author/00-compile.t000644 000765 000024 00000002241 13124453667 020214 0ustar00nigelstaff000000 000000 use 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 use Test::More; plan tests => 2; my @module_files = ( 'HTML/Scrubber.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); HTML-Scrubber-0.17/xt/author/critic.t000644 000765 000024 00000000435 13124453667 017627 0ustar00nigelstaff000000 000000 #!perl use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); HTML-Scrubber-0.17/xt/author/eol.t000644 000765 000024 00000001321 13124453667 017124 0ustar00nigelstaff000000 000000 use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/HTML/Scrubber.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/01_use.t', 't/02_basic.t', 't/03_more.t', 't/04_style_script.t', 't/05_pi_comment.t', 't/06_scrub_file.t', 't/07_booleans.t', 't/08_cb_attrs.t', 't/09_memory_cycle.t', 't/09_no_scrub_warnings.t', 't/jvn53973084.t', 't/rt120384_remove_false_tags.t', 't/rt19063_xhtml.t', 't/rt25477_self_closing.t', 't/rt72659_utf8.t', 't/rt79044_multiple.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; HTML-Scrubber-0.17/xt/author/no-tabs.t000644 000765 000024 00000001267 13124453667 017721 0ustar00nigelstaff000000 000000 use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/HTML/Scrubber.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/01_use.t', 't/02_basic.t', 't/03_more.t', 't/04_style_script.t', 't/05_pi_comment.t', 't/06_scrub_file.t', 't/07_booleans.t', 't/08_cb_attrs.t', 't/09_memory_cycle.t', 't/09_no_scrub_warnings.t', 't/jvn53973084.t', 't/rt120384_remove_false_tags.t', 't/rt19063_xhtml.t', 't/rt25477_self_closing.t', 't/rt72659_utf8.t', 't/rt79044_multiple.t' ); notabs_ok($_) foreach @files; done_testing; HTML-Scrubber-0.17/xt/author/pod-coverage.t000644 000765 000024 00000000334 13124453667 020723 0ustar00nigelstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); HTML-Scrubber-0.17/xt/author/pod-syntax.t000644 000765 000024 00000000252 13124453667 020455 0ustar00nigelstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); HTML-Scrubber-0.17/t/00-report-prereqs.dd000644 000765 000024 00000005550 13124453667 020216 0ustar00nigelstaff000000 000000 do { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' } }, 'develop' => { 'requires' => { 'English' => '0', 'File::Spec' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Pod::Coverage::TrustPod' => '0', 'Test::CPAN::Meta' => '0', 'Test::EOL' => '0', 'Test::Kwalitee' => '1.21', 'Test::More' => '0.88', 'Test::NoTabs' => '0', 'Test::PAUSE::Permissions' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08' } }, 'runtime' => { 'requires' => { 'HTML::Entities' => '0', 'HTML::Parser' => '3.47', 'List::Util' => '0', 'Scalar::Util' => '0', 'perl' => '5.008', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'File::Temp' => '0', 'Pod::Coverage::TrustPod' => '0', 'Test' => '0', 'Test::CPAN::Meta' => '0', 'Test::Differences' => '0', 'Test::EOL' => '0', 'Test::Kwalitee' => '1.21', 'Test::Memory::Cycle' => '0', 'Test::More' => '0.88', 'Test::NoTabs' => '0', 'Test::PAUSE::Permissions' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'utf8' => '0' } } }; $x; }HTML-Scrubber-0.17/t/00-report-prereqs.t000644 000765 000024 00000012714 13124453667 020072 0ustar00nigelstaff000000 000000 #!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.025 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do 't/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( @dep_errors ) { diag join("\n", "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n", "The following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: HTML-Scrubber-0.17/t/01_use.t000644 000765 000024 00000000331 13124453667 015747 0ustar00nigelstaff000000 000000 # Check this module loads use strict; use warnings; use Test::More tests => 1; BEGIN { use_ok('HTML::Scrubber') || print "Bail out!\n"; } diag("Testing HTML::Scrubber $HTML::Scrubber::VERSION, Perl $], $^X"); HTML-Scrubber-0.17/t/02_basic.t000644 000765 000024 00000013611 13124453667 016242 0ustar00nigelstaff000000 000000 # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use strict; use warnings; use Test; BEGIN { plan tests => 77 } use HTML::Scrubber; ok(1); # If we made it this far, we're ok. # test 1 ######################### # Insert your test code below, the Test module is use()ed here so read # its man page ( perldoc Test ) for help writing this test script. my $html = q[
bold < underlined LINK ]; my $scrubber = HTML::Scrubber->new(); ok($scrubber); # test 2 ok( !$scrubber->default() ); # test 3 ok( !$scrubber->comment() ); # test 4 ok( !$scrubber->process() ); # test 5 ok( !$scrubber->allow(qw[ p b i u hr br ]) ); # test 6 $scrubber = $scrubber->scrub($html); ok($scrubber); # test 7 ok( $scrubber !~ /href/i ); # test 8 ok( $scrubber !~ /Align/i ); # test 9 ok( $scrubber !~ /\Q mid1 mid2 end]; isa_ok( $s, 'HTML::Scrubber' ); is( $s->comment, 0, 'comment off by default' ); is( $s->process, 0, 'process off by default' ); is( $s->scrub($html), 'start mid1 mid2 end' ); $s->comment(1); is( $s->comment, 1, 'comment on' ); is( $s->scrub($html), 'start mid1 mid2 end', 'comment on' ); $s->process(1); is( $s->process, 1, 'process on' ); is( $s->scrub($html), 'start mid1 mid2 end', 'process on' ); HTML-Scrubber-0.17/t/06_scrub_file.t000644 000765 000024 00000003414 13124453667 017302 0ustar00nigelstaff000000 000000 # perl Makefile.PL && nmake realclean && cls && perl Makefile.PL && nmake test use strict; use File::Temp qw/ tempfile tempdir /; use Test::More tests => 10; BEGIN { $^W = 1 } use_ok('HTML::Scrubber'); my $s = HTML::Scrubber->new; my $html = q[

hi
start mid1 mid2 end]; isa_ok( $s, 'HTML::Scrubber' ); my $tmpdir = tempdir( CLEANUP => 1 ); SKIP: { skip "no writable temporary directory found", 6 unless length $tmpdir and -d $tmpdir; my $template = 'html-scrubber-XXXX'; my ( $tfh, $tmpfile ) = tempfile( $template, DIR => $tmpdir, SUFFIX => '.html' ); my $r = $s->scrub( $html, $tmpfile ); $r = "Error: \$@=$@ \$!=$!" unless $r; is( $r, 1, "scrub(\$html,\$tmpfile=$tmpfile)" ); open my $filis, "+>", $tmpfile or die "can't write to $tmpfile"; $r = $s->scrub( $html, $filis ); $r = "Error: \$@=$@ \$!=$!" unless $r; is( $r, 1, q[scrub($html, $filis)] ); seek $filis, 0, 0; $r = join '', readline $filis; is( $r, "histart mid1 mid2 end", '$filis has the right stuff' ); is( close($filis), 1, q[close($filis)] ); my ( $tfh2, $tmpfile2 ) = tempfile( $template, DIR => $tmpdir, SUFFIX => '.html' ); $r = $s->scrub_file( $tmpfile, "$tmpfile2" ); $r = "Error: \$@=$@ \$!=$!" unless $r; is( $r, 1, qq[scrub_file(\$tmpfile,"\$tmpfile2"=$tmpfile2)] ); open $filis, "+>", $tmpfile2 or die "can't write to $tmpfile"; $r = $s->scrub_file( $tmpfile, $filis ); $r = "Error: \$@=$@ \$!=$!" unless $r; is( $r, 1, q[scrub_file($tmpfile, $filis)] ); seek $filis, 0, 0; $r = join '', readline $filis; is( $r, "histart mid1 mid2 end", '$filis has the right stuff' ); is( close($filis), 1, q[close($filis)] ); } HTML-Scrubber-0.17/t/07_booleans.t000644 000765 000024 00000002671 13124453667 016774 0ustar00nigelstaff000000 000000 # 07_booleans.t use strict; use File::Spec; use Test::More tests => 9; BEGIN { $^W = 1 } use_ok('HTML::Scrubber'); use HTML::Scrubber; my @allow = qw[ br hr b a option button th ]; my $scrubber = HTML::Scrubber->new(); $scrubber->allow(@allow); $scrubber->default( undef, # don't change { # default attribute rules '/' => 1, # '/' ia boolean (stand-alone) attribute 'pie' => 1, 'selected' => 1, 'disabled' => 1, 'nowrap' => 1, } ); ok( $scrubber, "got scrubber" ); test( q~
hi
~, q~
hi
~, "br /" ); test( q~~, q~~, "selected" ); test( q~~, q~~, "disabled" ); test( q~~, q~~, "dd" ); test( q~ | ~, q~ | ~, "pie" ); test( q~ | ~, q~ | ~, "selected pie" ); #dependent on version of HTML::Parser, after 0.36 1st is returned (ie pie) #test(q~
~, q~
~, 'repeated mixed'); test( q~~, q~~, "th nowrap=nowrap" ); sub test { my ( $in, $out, $name ) = @_; is( $scrubber->scrub($in), $out, $name ); } HTML-Scrubber-0.17/t/08_cb_attrs.t000644 000765 000024 00000001306 13124453667 016766 0ustar00nigelstaff000000 000000 use strict; use warnings; use Test::More; use_ok('HTML::Scrubber'); use HTML::Scrubber; my $scrubber = HTML::Scrubber->new; $scrubber->default(1); my $cb = sub { my ( $self, $tag, $attr, $avalue ) = @_; my %h = ( drop => [], bool => [undef], empty => [''], foo => ['bar'], ); return @{ $h{$avalue} }; }; $scrubber->rules( p => { a => $cb } ); is( $scrubber->scrub('

'), '

', "correct result" ); is( $scrubber->scrub('

'), '

', "correct result" ); is( $scrubber->scrub('

'), '

', "correct result" ); is( $scrubber->scrub('

'), '

', "correct result" ); done_testing; HTML-Scrubber-0.17/t/09_memory_cycle.t000644 000765 000024 00000000304 13124453667 017652 0ustar00nigelstaff000000 000000 use strict; use warnings; use Test::More tests => 1; use Test::Memory::Cycle; use HTML::Scrubber; my $scrubber = HTML::Scrubber->new(); memory_cycle_ok( $scrubber, "Scrubber has no cycles" ); HTML-Scrubber-0.17/t/09_no_scrub_warnings.t000644 000765 000024 00000000615 13124453667 020712 0ustar00nigelstaff000000 000000 use strict; use warnings; use Test::More; use_ok('HTML::Scrubber'); use HTML::Scrubber; my $scrubber = HTML::Scrubber->new; # really one of the Test:: warnings would be better here # but lets keep this simple local $SIG{__WARN__} = sub { fail("warning raised by scrub: @_"); }; ok( !$scrubber->scrub ); ok( !$scrubber->scrub('') ); ok( !$scrubber->scrub('') ); done_testing; HTML-Scrubber-0.17/t/jvn53973084.t000644 000765 000024 00000001106 13124453667 016320 0ustar00nigelstaff000000 000000 # Tests related to JVN53973084 use strict; use warnings; use Test::More; use_ok('HTML::Scrubber'); my @allow = qw[ hr ]; my $html_1 = q[


abc]; my $html_2 = q[new( allow => \@allow, comment => $comment_value ); is( $scrubber->scrub($html_1), '
abc', "correct result (1) - with comment => $comment_value" ); is( $scrubber->scrub($html_2), '', "correct result (2) - with comment => $comment_value" ); } done_testing; HTML-Scrubber-0.17/t/rt120384_remove_false_tags.t000644 000765 000024 00000007303 13124453667 021535 0ustar00nigelstaff000000 000000 use warnings; use strict; use utf8; use Test::More; use Test::Differences; use HTML::Scrubber; use HTML::Parser; my $scrub = HTML::Scrubber->new( allow => [ qw{ p b i area br base col colgroup embed hr img input link map meta object param table track source video wbr } ] ); $scrub->default( undef, { '*' => 1 } ); # allow all attributes $scrub->comment(1); # html snippets adapted from https://developer.mozilla.org/en/docs/ # except for the
snippet, which is taken from the example in the # original ticket my %snippets = ( "area" => ' Click to go Left ', "base" => '', "br" => '

"You may get to touch her
If your gloves are sterilized

Rinse your mouth with Listerine
Blow disinfectant in her eyes"

-- X-Ray Spex, Germ-Free Adolescents', "col" => '
', "embed" => '', "hr" => '

This is the first paragraph of text.


This is the second paragraph of text.

', "img" => 'alt text', "input" => '', "link" => '', "meta" => '', "param" => ' ', "source" => '', "track" => '', "wbr" => '

word.break.opportunity.

', ); plan tests => scalar keys %snippets; my %expected = ( "area" => ' Click to go Left ', "base" => '', "br" => '

"You may get to touch her
If your gloves are sterilized
Rinse your mouth with Listerine Blow disinfectant in her eyes"
-- X-Ray Spex, Germ-Free Adolescents', "col" => '
', "embed" => '', "hr" => '

This is the first paragraph of text.


This is the second paragraph of text.

', "img" => 'alt text', "input" => '', "link" => '', "meta" => '', "param" => ' ', "source" => '', "track" => '', "wbr" => "

word.break.opportunity.

", ); for my $tag_name ( sort keys %snippets ) { eq_or_diff $scrub->scrub( $snippets{$tag_name} ), $expected{$tag_name}, "False ending <$tag_name> tags are removed"; } # vim: expandtab shiftwidth=4 HTML-Scrubber-0.17/t/rt19063_xhtml.t000644 000765 000024 00000000544 13124453667 017125 0ustar00nigelstaff000000 000000 # Tests related to RT25477 - https://rt.cpan.org/Public/Bug/Display.html?id=25477 use strict; use warnings; use File::Spec; use Test::More; use_ok('HTML::Scrubber'); use HTML::Scrubber; my $scrubber = HTML::Scrubber->new; $scrubber->default(1); is( $scrubber->scrub('



'), '



', "correct result" ); done_testing; HTML-Scrubber-0.17/t/rt25477_self_closing.t000644 000765 000024 00000001000 13124453667 020432 0ustar00nigelstaff000000 000000 # Tests related to RT25477 - https://rt.cpan.org/Public/Bug/Display.html?id=25477 use strict; use warnings; use File::Spec; use Test::More; use_ok('HTML::Scrubber'); use HTML::Scrubber; my $scrubber = HTML::Scrubber->new; $scrubber->default(1); my $scrubbed = $scrubber->scrub( <<'END' ); two END is( $scrubbed, <<'END', "correct result" ); one two END done_testing; HTML-Scrubber-0.17/t/rt72659_utf8.t000644 000765 000024 00000001413 13124453667 016665 0ustar00nigelstaff000000 000000 # Tests related to RG72659 - https://rt.cpan.org/Public/Bug/Display.html?id=72659 # # I was unable to reproduce the errors described, but am leaving this in # place for now as it will catch any future issues with utf8 disjoints. # use strict; use utf8; use File::Spec; use Test::More; use_ok('HTML::Scrubber'); use HTML::Scrubber; my $source = "\x{DF}"; utf8::upgrade($source); ok( utf8::is_utf8($source), 'Source string is marked UTF8' ); ok( utf8::valid($source), 'Source string is valid UTF8' ); # scrub it my $scrubber = HTML::Scrubber->new(); my $result = $scrubber->scrub($source); ok( utf8::is_utf8($result), 'Result string is marked UTF8' ); ok( utf8::valid($result), 'Result string is valid UTF8' ); is( $source, $result, 'Result = Source' ); done_testing; HTML-Scrubber-0.17/t/rt79044_multiple.t000644 000765 000024 00000001373 13124453667 017632 0ustar00nigelstaff000000 000000 # rt79044_multiple.t # this is to test for the problem described in RT #79044 use strict; use Test::More; use_ok('HTML::Scrubber'); use HTML::Scrubber; my @allow = qw[ p ]; my $scrubber = HTML::Scrubber->new(); $scrubber->allow(@allow); ok( $scrubber, "got scrubber" ); # all of these should go through unscathed my @data = ( '

one

', '

two

', '

three

', '

four

' ); foreach my $datum (@data) { is( $scrubber->scrub($datum), $datum, 'Test unscathed' ); } # now do the same thing again, this time not allowing a

tag $scrubber->allow(); foreach my $datum (@data) { my $result = $datum; $datum =~ s|||g; # strip with regexp - yay! is( $scrubber->scrub($datum), $datum, 'Test processed' ); } done_testing; HTML-Scrubber-0.17/lib/HTML/000755 000765 000024 00000000000 13124453667 015540 5ustar00nigelstaff000000 000000 HTML-Scrubber-0.17/lib/HTML/Scrubber.pm000644 000765 000024 00000056100 13124453667 017647 0ustar00nigelstaff000000 000000 package HTML::Scrubber; # ABSTRACT: Perl extension for scrubbing/sanitizing HTML use 5.008; # enforce minimum perl version of 5.8 use strict; use warnings; use HTML::Parser 3.47 (); use HTML::Entities; use Scalar::Util ('weaken'); use List::Util qw(any); our ( @_scrub, @_scrub_fh ); our $VERSION = '0.17'; # VERSION our $AUTHORITY = 'cpan:NIGELM'; # AUTHORITY # my my my my, these here to prevent foolishness like # http://perlmonks.org/index.pl?node_id=251127#Stealing+Lexicals (@_scrub) = ( \&_scrub, "self, event, tagname, attr, attrseq, text" ); (@_scrub_fh) = ( \&_scrub_fh, "self, event, tagname, attr, attrseq, text" ); sub new { my $package = shift; my $p = HTML::Parser->new( api_version => 3, default_h => \@_scrub, marked_sections => 0, strict_comment => 0, unbroken_text => 1, case_sensitive => 0, boolean_attribute_value => undef, empty_element_tags => 1, ); my $self = { _p => $p, _rules => { '*' => 0, }, _comment => 0, _process => 0, _r => "", _optimize => 1, _script => 0, _style => 0, }; $p->{"\0_s"} = bless $self, $package; weaken( $p->{"\0_s"} ); return $self unless @_; my (%args) = @_; for my $f (qw[ default allow deny rules process comment ]) { next unless exists $args{$f}; if ( ref $args{$f} ) { $self->$f( @{ $args{$f} } ); } else { $self->$f( $args{$f} ); } } return $self; } sub comment { return $_[0]->{_comment} if @_ == 1; $_[0]->{_comment} = $_[1]; return; } sub process { return $_[0]->{_process} if @_ == 1; $_[0]->{_process} = $_[1]; return; } sub script { return $_[0]->{_script} if @_ == 1; $_[0]->{_script} = $_[1]; return; } sub style { return $_[0]->{_style} if @_ == 1; $_[0]->{_style} = $_[1]; return; } sub allow { my $self = shift; for my $k (@_) { $self->{_rules}{ lc $k } = 1; } $self->{_optimize} = 1; # each time a rule changes, reoptimize when parse return; } sub deny { my $self = shift; for my $k (@_) { $self->{_rules}{ lc $k } = 0; } $self->{_optimize} = 1; # each time a rule changes, reoptimize when parse return; } sub rules { my $self = shift; my (%rules) = @_; for my $k ( keys %rules ) { $self->{_rules}{ lc $k } = $rules{$k}; } $self->{_optimize} = 1; # each time a rule changes, reoptimize when parse return; } sub default { return $_[0]->{_rules}{'*'} if @_ == 1; $_[0]->{_rules}{'*'} = $_[1] if defined $_[1]; $_[0]->{_rules}{'_'} = $_[2] if defined $_[2] and ref $_[2]; $_[0]->{_optimize} = 1; # each time a rule changes, reoptimize when parse return; } sub scrub_file { if ( @_ > 2 ) { return unless defined $_[0]->_out( $_[2] ); } else { $_[0]->{_p}->handler( default => @_scrub ); } $_[0]->_optimize(); #if $_[0]->{_optimize}; $_[0]->{_p}->parse_file( $_[1] ); return delete $_[0]->{_r} unless exists $_[0]->{_out}; print { $_[0]->{_out} } $_[0]->{_r} if length $_[0]->{_r}; delete $_[0]->{_out}; return 1; } sub scrub { if ( @_ > 2 ) { return unless defined $_[0]->_out( $_[2] ); } else { $_[0]->{_p}->handler( default => @_scrub ); } $_[0]->_optimize(); # if $_[0]->{_optimize}; $_[0]->{_p}->parse( $_[1] ) if defined( $_[1] ); $_[0]->{_p}->eof(); return delete $_[0]->{_r} unless exists $_[0]->{_out}; delete $_[0]->{_out}; return 1; } sub _out { my ( $self, $o ) = @_; unless ( ref $o and ref \$o ne 'GLOB' ) { open my $F, '>', $o or return; binmode $F; $self->{_out} = $F; } else { $self->{_out} = $o; } $self->{_p}->handler( default => @_scrub_fh ); return 1; } sub _validate { my ( $s, $t, $r, $a, $as ) = @_; return "<$t>" unless %$a; $r = $s->{_rules}->{$r}; my %f; for my $k ( keys %$a ) { my $check = exists $r->{$k} ? $r->{$k} : exists $r->{'*'} ? $r->{'*'} : next; if ( ref $check eq 'CODE' ) { my @v = $check->( $s, $t, $k, $a->{$k}, $a, \%f ); next unless @v; $f{$k} = shift @v; } elsif ( ref $check || length($check) > 1 ) { $f{$k} = $a->{$k} if $a->{$k} =~ m{$check}; } elsif ($check) { $f{$k} = $a->{$k}; } } if (%f) { my %seen; return "<$t $r>" if $r = join ' ', map { defined $f{$_} ? qq[$_="] . encode_entities( $f{$_} ) . q["] : $_; # boolean attribute (TODO?) } grep { exists $f{$_} and !$seen{$_}++; } @$as; } return "<$t>"; } sub _scrub_str { my ( $p, $e, $t, $a, $as, $text ) = @_; my $s = $p->{"\0_s"}; my $outstr = ''; if ( $e eq 'start' ) { if ( exists $s->{_rules}->{$t} ) # is there a specific rule { if ( ref $s->{_rules}->{$t} ) # is it complicated?(not simple;) { $outstr .= $s->_validate( $t, $t, $a, $as ); } elsif ( $s->{_rules}->{$t} ) # validate using default attribute rule { $outstr .= $s->_validate( $t, '_', $a, $as ); } } elsif ( $s->{_rules}->{'*'} ) # default allow tags { $outstr .= $s->_validate( $t, '_', $a, $as ); } } elsif ( $e eq 'end' ) { # empty tags list taken from # https://developer.mozilla.org/en/docs/Glossary/empty_element my @empty_tags = qw(area base br col embed hr img input link meta param source track wbr); return "" if $text ne '' && any { $t eq $_ } @empty_tags; # skip false closing empty tags my $place = 0; if ( exists $s->{_rules}->{$t} ) { $place = 1 if $s->{_rules}->{$t}; } elsif ( $s->{_rules}->{'*'} ) { $place = 1; } if ($place) { if ( length $text ) { $outstr .= ""; } else { substr $s->{_r}, -1, 0, ' /'; } } } elsif ( $e eq 'comment' ) { if ( $s->{_comment} ) { # only copy comments through if they are well formed... $outstr .= $text if ( $text =~ m|^$|ms ); } } elsif ( $e eq 'process' ) { $outstr .= $text if $s->{_process}; } elsif ( $e eq 'text' or $e eq 'default' ) { $text =~ s//>/g; $outstr .= $text; } elsif ( $e eq 'start_document' ) { $outstr = ""; } return $outstr; } sub _scrub_fh { my $self = $_[0]->{"\0_s"}; print { $self->{_out} } $self->{'_r'} if length $self->{_r}; $self->{'_r'} = _scrub_str(@_); } sub _scrub { $_[0]->{"\0_s"}->{_r} .= _scrub_str(@_); } sub _optimize { my ($self) = @_; my (@ignore_elements) = grep { not $self->{"_$_"} } qw(script style); $self->{_p}->ignore_elements(@ignore_elements); # if @ is empty, we reset ;) return unless $self->{_optimize}; #sub allow # return unless $self->{_optimize}; # till I figure it out (huh) if ( $self->{_rules}{'*'} ) { # default allow $self->{_p}->report_tags(); # so clear it } else { my (@reports) = grep { # report only tags we want $self->{_rules}{$_} } keys %{ $self->{_rules} }; $self->{_p}->report_tags( # default deny, so optimize @reports ) if @reports; } # sub deny # return unless $self->{_optimize}; # till I figure it out (huh) my (@ignores) = grep { not $self->{_rules}{$_} } grep { $_ ne '*' } keys %{ $self->{_rules} }; $self->{_p}->ignore_tags( # always ignore stuff we don't want @ignores ) if @ignores; $self->{_optimize} = 0; return; } 1; #print sprintf q[ '%-12s => %s,], "$_'", $h{$_} for sort keys %h;# perl! #perl -ne"chomp;print $_;print qq'\t\t# test ', ++$a if /ok\(/;print $/" test.pl >test2.pl #perl -ne"chomp;print $_;if( /ok\(/ ){s/\#test \d+$//;print qq'\t\t# test ', ++$a }print $/" test.pl >test2.pl #perl -ne"chomp;if(/ok\(/){s/# test .*$//;print$_,qq'\t\t# test ',++$a}else{print$_}print$/" test.pl >test2.pl __END__ =pod =encoding UTF-8 =head1 NAME HTML::Scrubber - Perl extension for scrubbing/sanitizing HTML =head1 VERSION version 0.17 =for stopwords html cpan callback homepage Perlbrew perltidy repository =head1 SYNOPSIS use HTML::Scrubber; my $scrubber = HTML::Scrubber->new( allow => [ qw[ p b i u hr br ] ] ); print $scrubber->scrub('

bold missing

'); # output is:

bold

# more complex input my $html = q[
a =>
link br =>
b => bold u => UNDERLINE ]; print $scrubber->scrub($html); $scrubber->deny( qw[ p b i u hr br ] ); print $scrubber->scrub($html); =head1 DESCRIPTION If you want to "scrub" or "sanitize" html input in a reliable and flexible fashion, then this module is for you. I wasn't satisfied with L because it is based on L, so I thought I'd write something similar that works directly with L. =head1 METHODS First a note on documentation: just study the L below. It's all the documentation you could need. Also, be sure to read all the comments as well as L. If you're new to perl, good luck to you. =head2 new my $scrubber = HTML::Scrubber->new( allow => [ qw[ p b i u hr br ] ] ); Build a new L. The arguments are the initial values for the following directives:- =over 4 =item * default =item * allow =item * deny =item * rules =item * process =item * comment =back =head2 comment warn "comments are ", $p->comment ? 'allowed' : 'not allowed'; $p->comment(0); # off by default =head2 process warn "process instructions are ", $p->process ? 'allowed' : 'not allowed'; $p->process(0); # off by default =head2 script warn "script tags (and everything in between) are supressed" if $p->script; # off by default $p->script( 0 || 1 ); B<**> Please note that this is implemented using L's C function, so if C