Pod-PseudoPod-0.18000755001750001750 011620337705 15175 5ustar00chromaticchromatic000000000000Pod-PseudoPod-0.18/META.yml000444001750001750 177111620337705 16611 0ustar00chromaticchromatic000000000000--- abstract: 'A framework for parsing PseudoPod' author: - 'Allison Randal (allison@perl.org)' build_requires: Test::More: 0 configure_requires: Module::Build: 0.38 dynamic_config: 1 generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.112150' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Pod-PseudoPod provides: Pod::PseudoPod: file: lib/Pod/PseudoPod.pm version: 0.18 Pod::PseudoPod::Checker: file: lib/Pod/PseudoPod/Checker.pm version: 0.18 Pod::PseudoPod::DocBook: file: lib/Pod/PseudoPod/DocBook.pm version: 0.18 Pod::PseudoPod::HTML: file: lib/Pod/PseudoPod/HTML.pm version: 0.18 Pod::PseudoPod::Index: file: lib/Pod/PseudoPod/Index.pm version: 0.18 Pod::PseudoPod::Text: file: lib/Pod/PseudoPod/Text.pm version: 0.18 requires: HTML::Entities: 0 Pod::Simple: 3.02 Text::Wrap: 98.112902 resources: license: http://dev.perl.org/licenses/ version: 0.18 Pod-PseudoPod-0.18/README000444001750001750 151311620337705 16212 0ustar00chromaticchromatic000000000000DESCRIPTION PseudoPOD is an extended set of POD tags for book manuscripts. Standard POD doesn't have all the markup options you might want for marking up files for publishing production. PseudoPOD adds a few extra tags for footnotes and tables, and has extended uses of "=begin" elements. See Pod::PseudoPod::Tutorial. INSTALLATION perl Makefile.PL make make test make install # or perl Build.PL ./Build ./Build test ./Build install USAGE The standard installation includes ppod2html and ppod2txt converters and a ppodchecker script. $ ppod2html filename.pod If you copy the sample style.css from the "examples/" directory into the same directory as the html files you generate, the output is a tolerable simulation of O'Reilly's animal book format. Pod-PseudoPod-0.18/Todo000444001750001750 57111620337705 16145 0ustar00chromaticchromatic000000000000TODO list for Perl module Pod::PseudoPod - Handle X<> tags for html output. They should create an html anchor (randomly generated number?), and an index list at the end of the document. - Add a utility to generate a table of contents from a list of files (module and script, probably). - Handle N<> tags so they output document-end footnotes instead of inline text. Pod-PseudoPod-0.18/META.json000444001750001750 322011620337705 16750 0ustar00chromaticchromatic000000000000{ "abstract" : "A framework for parsing PseudoPod", "author" : [ "Allison Randal (allison@perl.org)" ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.112150", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Pod-PseudoPod", "prereqs" : { "build" : { "requires" : { "Test::More" : 0 } }, "configure" : { "requires" : { "Module::Build" : "0.38" } }, "runtime" : { "requires" : { "HTML::Entities" : 0, "Pod::Simple" : "3.02", "Text::Wrap" : "98.112902" } } }, "provides" : { "Pod::PseudoPod" : { "file" : "lib/Pod/PseudoPod.pm", "version" : "0.18" }, "Pod::PseudoPod::Checker" : { "file" : "lib/Pod/PseudoPod/Checker.pm", "version" : "0.18" }, "Pod::PseudoPod::DocBook" : { "file" : "lib/Pod/PseudoPod/DocBook.pm", "version" : "0.18" }, "Pod::PseudoPod::HTML" : { "file" : "lib/Pod/PseudoPod/HTML.pm", "version" : "0.18" }, "Pod::PseudoPod::Index" : { "file" : "lib/Pod/PseudoPod/Index.pm", "version" : "0.18" }, "Pod::PseudoPod::Text" : { "file" : "lib/Pod/PseudoPod/Text.pm", "version" : "0.18" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "0.18" } Pod-PseudoPod-0.18/Changes000444001750001750 531611620337705 16632 0ustar00chromaticchromatic000000000000Revision history for Pod::PseudoPod 0.18 Aug 09, 2010 - improved HTML validity - allowed more PP nesting after certain constructs 0.17 Nov 28, 2010 - Removed Text::Wrap from Pod::PseudoPod::HTML altogether (RT #58784) 0.16 Mar 29, 2010 - Remove Pod::Simple tests, Pod::PseudoPod is compatible with old and new versions of Pod::Simple, doesn't need to be dictating the behavior of an external module. 0.15 Jun 11, 2009 - Update Tutorial for change in maintainership. - Further improvements to the DocBook formatter. 0.14 Mar 20, 2007 - Add a DocBook 4.4. formatter, to output the new format O'Reilly needs for book production with help from Lakshmi Sadasiv at O'Reilly. 0.13 Aug 03, 2006 - Resolve failing tests, check for encoded entities with pattern match instead of exact text match. 0.12 Jul 17, 2005 - Now install ppod2html, ppod2txt, and ppodchecker during the make or build process. - Applied patch from chromatic and Timothy Appnel to HTML formatter to automatically escape certain characters in verbatim sections. - Added support for listing blocks at the request of a user. 0.11 Jun 26, 2004 - Applied patch from Boris Zentner to make example scripts use File::Basename. - Applied patch from chromatic to display figure titles in HTML formatter, and display a "no errors" message from the checker when the file parses without errors. - Updated main Pod::PseudoPod module to take advantage of Pod::Simple 3.02 (pieces of Pod::PseudoPod were integrated into Pod::Simple). 0.10 Apr 26, 2004 - Added the tutorial to the manifest, ooops. 0.09 Apr 24, 2004 - Added a PseudoPod tutorial, based on O'Reilly's docs. - Added rudimentary text index generation. - Now supports 'Build' or 'make'. - Makefile.PL explicitly generates list of tests (change suggested by Jeff Zucker because Win98 couldn't read the "*.t".) 0.08 Feb 18, 2004 - Parse formatting codes in verbatim code blocks. - Preserve entities in HTML formatter. - Update text formatter to take advantage of new features. 0.07 Jan 6, 2004 - Also allow =for directives with '=end for' directives. The PseudoPod docs disagree on which is right, so I'm allowing both. 0.06 Jan 5, 2004 - Allow =for directives with empty =end directives. 0.05 Jan 2, 2004 - Fixed sidebars and tables so they can handle codes within their text. 0.04 Jan 1, 2004 - Add support for tables, including: "=begin table", =row, =cell, =headrow, =bodyrows. 0.03 Dec 31, 2003 - Add generic support for =begin entities with title text after the target name. 0.02 Nov 30, 2003 - Switch to call style similar to Pod::Simple::Methody. 0.01 Jan 6, 2003 - Original simple subclass of Pod::Simple. Pod-PseudoPod-0.18/Build.PL000444001750001750 131511620337705 16626 0ustar00chromaticchromatic000000000000use Module::Build; my $build = Module::Build->new ( module_name => 'Pod::PseudoPod', license => 'perl', build_requires => { 'Test::More' => 0, }, requires => { 'Pod::Simple' => 3.02, 'Text::Wrap' => 98.112902, 'HTML::Entities' => 0, }, script_files => [ 'bin/ppod2html', 'bin/ppod2txt', 'bin/ppod2docbook', 'bin/ppodchecker' ], recursive_test_files => 1, dist_author => 'Allison Randal (allison@perl.org)', dist_abstract => "A framework for parsing PseudoPod", ); $build->create_build_script; Pod-PseudoPod-0.18/MANIFEST000444001750001750 72411620337705 16446 0ustar00chromaticchromatic000000000000Build.PL Changes LICENSE Makefile.PL MANIFEST META.yml README Todo bin/ppodchecker bin/ppod2docbook bin/ppod2html bin/ppod2txt examples/ppodindex examples/style.css lib/Pod/PseudoPod.pm lib/Pod/PseudoPod/Checker.pm lib/Pod/PseudoPod/DocBook.pm lib/Pod/PseudoPod/HTML.pm lib/Pod/PseudoPod/Index.pm lib/Pod/PseudoPod/Text.pm lib/Pod/PseudoPod/Tutorial.pod t/basic.t t/beginend.t t/checker.t t/docbook.t t/fcodes.t t/for.t t/html.t t/index.t t/text.t t/table.t META.json Pod-PseudoPod-0.18/Makefile.PL000444001750001750 161611620337705 17310 0ustar00chromaticchromatic000000000000use ExtUtils::MakeMaker; # The list of tests has to be explicitly generated on Win98. my @tests; for my $dir (qw(t)) { opendir TESTS, $dir or die $!; push @tests, map { "$dir/$_" } grep { /\.t$/ } readdir TESTS; closedir TESTS; } WriteMakefile( NAME => 'Pod::PseudoPod', VERSION_FROM => 'lib/Pod/PseudoPod.pm', # finds $VERSION PREREQ_PM => { 'Pod::Simple' => 3.02, 'Text::Wrap' => 98.112902, 'HTML::Entities' => 0, 'Test::More' => 0, }, EXE_FILES => [ 'bin/ppod2html', 'bin/ppod2txt', 'bin/ppod2docbook', 'bin/ppodchecker', ], test => {TESTS => "@tests"}, AUTHOR => 'Allison Randal (allison@perl.org)', ABSTRACT => "A framework for parsing PseudoPod", PL_FILES => {}, # ignore the Build.PL file ); Pod-PseudoPod-0.18/LICENSE000444001750001750 5010111620337705 16354 0ustar00chromaticchromatic000000000000Terms of Perl 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 General Public License (GPL) Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU 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. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to 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 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 show them these terms so they know 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. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. 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 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 derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 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 License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 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. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary 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 License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 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 Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing 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 for copying, distributing or modifying the Program or works based on it. 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. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. 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 this 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 this License, you may choose any version ever published by the Free Software Foundation. 10. 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 11. 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. 12. 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 --------------------------------------------------------------------------- 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. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. 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 Pod-PseudoPod-0.18/bin000755001750001750 011620337705 15745 5ustar00chromaticchromatic000000000000Pod-PseudoPod-0.18/bin/ppod2html000444001750001750 217411620337705 17742 0ustar00chromaticchromatic000000000000#!/usr/bin/perl ###################################################################### # # A sample PseudoPod to HTML converter script that uses # Pod::PseudoPod::HTML. # # usage: # # $ ppod2html filename1.pod filename2.pod # # Will produce one html file for each pod file passed in. # # filename1.html # filename2.html # ###################################################################### use strict; use Pod::PseudoPod::HTML; use File::Basename; foreach my $file (@ARGV) { my $parser = Pod::PseudoPod::HTML->new(); # HTML output goes to the current working # directory not the source directory. my $outfile = fileparse( $file, qr{\..*} ) . '.html'; open HTMLOUT, ">$outfile" or die "Can't write to $outfile: $!"; $parser->output_fh(*HTMLOUT); $parser->add_body_tags(1); # output a complete html document $parser->add_css_tags(1); # add css tags for cleaner display $parser->no_errata_section(1); # don't put errors in doc output $parser->complain_stderr(1); # output errors on STDERR instead if (-e $file) { $parser->parse_file($file); } else { die "Unable to open file\n"; } close HTMLOUT; } exit; Pod-PseudoPod-0.18/bin/ppod2txt000444001750001750 177611620337705 17624 0ustar00chromaticchromatic000000000000#!/usr/bin/perl ###################################################################### # # A sample PseudoPod to text converter script that uses # Pod::PseudoPod::Text. # # usage: # # $ ppod2txt filename1.pod filename2.pod # # Will produce one text file for each pod file passed in. # # filename1.txt # filename2.txt # ###################################################################### use strict; use lib "lib"; use Pod::PseudoPod::Text; use File::Basename; foreach my $file (@ARGV) { my $parser = Pod::PseudoPod::Text->new(); # Text output goes to the current working # directory not the source directory. my $outfile = fileparse( $file, qr{\..*} ) . '.txt'; open TXTOUT, ">$outfile" or die "Can't write to $outfile: $!"; $parser->output_fh(*TXTOUT); $parser->no_errata_section(1); # don't put errors in doc output $parser->complain_stderr(1); # output errors on STDERR instead if (-e $file) { $parser->parse_file($file); } else { die "Unable to open file\n"; } close TXTOUT; } exit; Pod-PseudoPod-0.18/bin/ppod2docbook000444001750001750 644211620337705 20420 0ustar00chromaticchromatic000000000000#!/usr/bin/perl ###################################################################### # # A PseudoPod to DocBook converter script that uses # Pod::PseudoPod::DocBook. # # usage: # # $ ppod2html [-i bookid] [-n include.xml] filename1.pod filename2.pod # # It produces a single XML file 'book.xml' that contains all chapters # passed to it. # # If the -i option is passed in, with a one-word identifier for the # book, the formatter uses that identifier as part of all autogenerated # ID tags in the book (on chapters, sections, tables, figures, # footnotes, and index items). # # If the -n option is passed in, with the full path to a partial XML # file, the contents of that file are included raw in the generated XML # file (at the beginning of the file where the book and # <bookinfo> tags usually appear). # ###################################################################### use strict; use lib 'lib'; use Pod::PseudoPod::DocBook; use File::Basename; use Getopt::Std; # Optionally, you can set a book ID for autogenerated ID tags, and an # xml file of bookinfo to include in the book. my %opts; getopts('i:n:', \%opts); my $bookid = $opts{'i'}; # DocBook output goes to the current working directory. open XMLOUT, ">book.xml" or die "Can't write to book.xml: $!"; # Prepend appropriate header information for a DocBook XML document. print XMLOUT <<'EOHEAD'; <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"> <book> <!-- bookinfo gets included here --> EOHEAD # If a partial XML file was provided to include, output it into the # generated XML file. if ( $opts{'n'} && open INCLUDE, $opts{'n'}) { my @include = <INCLUDE>; print XMLOUT @include; close INCLUDE; } my ($book_xml, $index_count, $preface_num); foreach my $file (@ARGV) { my $parser = Pod::PseudoPod::DocBook->new(); $parser->index_count($index_count); $parser->book_id($bookid); # Figures out the type of chapter and chapter number by the # filename. This assumes the standard naming convention of # ch01.pod (for the first chapter), appa.pod (for the first # appendix), and colophon.pod for the colophon. The preface may # be either ch00.pod, or preface.pod. For any other chapter # naming convention, you'll need to modify this code to # correctly identify the appropriate chapter information, so it # can generate the right DocBook tags. my $filename = fileparse( $file, qr{\..*} ); if ($filename =~ /preface/) { $parser->chapter_type('preface'); $parser->chapter_num(++$preface_num); } elsif ($filename =~ /colophon/) { $parser->chapter_type('colophon'); } elsif ($filename =~ /^app(\w)/) { $parser->chapter_type('appendix'); $parser->chapter_num(uc($1)); } if ($filename =~ /(\d+)/) { $parser->chapter_num(int($1)); if ($1 == 0) { $parser->chapter_type('preface'); $parser->chapter_num(++$preface_num); } } $parser->output_string($book_xml); $parser->no_errata_section(1); # don't put errors in doc output $parser->complain_stderr(1); # output errors on STDERR instead if (-e $file) { $parser->parse_file($file); } else { die "Unable to open file\n"; } $index_count = $parser->index_count(); } print XMLOUT $book_xml; print XMLOUT "\n</book>"; close XMLOUT; exit; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/bin/ppodchecker������������������������������������������������������������������000444��001750��001750�� 1023�11620337705� 20310� 0����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl ###################################################################### # # A sample PseudoPod checker that uses # Pod::PseudoPod::Checker. # # usage: # # $ ppodchecker filename1.pod filename2.pod # # Sends errors to STDOUT. # ###################################################################### use strict; use Pod::PseudoPod::Checker; foreach my $file (@ARGV) { my $parser = Pod::PseudoPod::Checker->new(); if (-e $file) { $parser->parse_file($file); } else { die "Unable to open file\n"; } } exit; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/examples�������������������������������������������������������������������������000755��001750��001750�� 0�11620337705� 17013� 5����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/examples/style.css���������������������������������������������������������������000444��001750��001750�� 2137�11620337705� 21025� 0����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!-- h1 { font-family: sans-serif; } h2 { font-family: sans-serif; } h3 { font-family: sans-serif; } h4 { font-family: sans-serif; } h5 { font-family: sans-serif; } table { font-size: 12px; font-family: sans-serif; } th { background: #CCCCCC; text-align: left;} code {color: #000099; font-family: courier, monospaced;} .url { color: #000099; } .footnote { color: #333333; } div.sidebar { border: 1px solid black; padding: 10px; } div.epigraph { text-align: right; font-style: italic; } div.author { background: #ffaaaa; border-style: solid; border-width: thin; padding: 2px; width: 25%; } div.editor { background: #aaaaff; border-style: solid; border-width: thin; padding: 2px; width: 25%; } div.hack > p:first-child { font-style: italic; font-weight: bold; width: 50%; margin-left: 5%; } div.note { border-width: thin; border-style: solid; } div.caution { border-width: thin; border-style: solid; background: #ff6666; } div.production { background: #000000; color: #ffffff; padding: 2px; text-align: center; } .code_command { font-weight: bold; text-decoration: underline; } --> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/examples/ppodindex���������������������������������������������������������������000444��001750��001750�� 1756�11620337705� 21076� 0����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl ###################################################################### # # A sample PseudoPod to TXT converter script that uses # Pod::PseudoPod::Index. # # usage: # # ./textindex filename1.pod filename2.pod # # Will produce one html file for each pod file passed in. # # filename1.html # filename2.html # ###################################################################### use strict; use lib "../lib"; # delete this line use Pod::PseudoPod::Index; my $parser; my $outfile = 'index.txt'; # in the current working directory open TXTOUT, ">$outfile" or die "Can't write to $outfile: $!"; my $index = {}; foreach my $file (@ARGV) { $parser = Pod::PseudoPod::Index->new($index); $parser->no_errata_section(1); # don't put errors in doc output $parser->complain_stderr(1); # output errors on STDERR instead if (-e $file) { $parser->parse_file($file); } else { die "Unable to open file\n"; } } $parser->output_fh(*TXTOUT); $parser->output_text; close TXTOUT; exit; ������������������Pod-PseudoPod-0.18/lib������������������������������������������������������������������������������000755��001750��001750�� 0�11620337705� 15743� 5����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/lib/Pod��������������������������������������������������������������������������000755��001750��001750�� 0�11620337705� 16465� 5����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/lib/Pod/PseudoPod.pm�������������������������������������������������������������000444��001750��001750�� 42621�11620337705� 21107� 0����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������� package Pod::PseudoPod; use Pod::Simple; @ISA = qw(Pod::Simple); use strict; use vars qw( $VERSION @ISA @Known_formatting_codes @Known_directives %Known_formatting_codes %Known_directives ); @ISA = ('Pod::Simple'); $VERSION = '0.18'; BEGIN { *DEBUG = sub () {0} unless defined &DEBUG } @Known_formatting_codes = qw(A B C E F G H I L M N R S T U X Z); %Known_formatting_codes = map(($_=>1), @Known_formatting_codes); @Known_directives = qw(head0 head1 head2 head3 head4 item over back headrow bodyrows row cell); %Known_directives = map(($_=>'Plain'), @Known_directives); sub new { my $self = shift; my $new = $self->SUPER::new(); $new->{'accept_codes'} = { map( ($_=>$_), @Known_formatting_codes ) }; $new->{'accept_directives'} = \%Known_directives; return $new; } sub _handle_element_start { my ($self, $element, $flags) = @_; $element =~ tr/-:./__/; my $sub = $self->can('start_' . $element); $sub->($self, $flags) if $sub; } sub _handle_text { my $self = shift; my $sub = $self->can('handle_text'); $sub->($self, @_) if $sub; } sub _handle_element_end { my ($self, $element, $flags) = @_; $element =~ tr/-:./__/; my $sub = $self->can('end_' . $element); $sub->($self, $flags) if $sub; } sub nix_Z_codes { $_[0]{'nix_Z_codes'} = $_[1] } # Largely copied from Pod::Simple::_treat_Zs, modified to optionally # keep Z elements, and so it doesn't complain about Zs with content. # sub _treat_Zs { # Nix Z<...>'s my($self,@stack) = @_; my($i, $treelet); my $start_line = $stack[0][1]{'start_line'}; # A recursive algorithm implemented iteratively! Whee! while($treelet = shift @stack) { for($i = 2; $i < @$treelet; ++$i) { # iterate over children next unless ref $treelet->[$i]; # text nodes are uninteresting unless($treelet->[$i][0] eq 'Z') { unshift @stack, $treelet->[$i]; # recurse next; } if ($self->{'nix_Z_codes'}) { #DEBUG > 1 and print "Nixing Z node @{$treelet->[$i]}\n"; splice(@$treelet, $i, 1); # thereby just nix this node. --$i; } } } return; } # The _ponder_* methods override the _ponder_* methods from # Pod::Simple::BlackBox to add or alter functionality. sub _ponder_paragraph_buffer { # Para-token types as found in the buffer. # ~Verbatim, ~Para, ~end, =head1..4, =for, =begin, =end, # =over, =back, =item # and the null =pod (to be complained about if over one line) # # "~data" paragraphs are something we generate at this level, depending on # a currently open =over region # Events fired: Begin and end for: # directivename (like head1 .. head4), item, extend, # for (from =begin...=end, =for), # over-bullet, over-number, over-text, over-block, # item-bullet, item-number, item-text, # Document, # Data, Para, Verbatim # B, C, longdirname (TODO -- wha?), etc. for all directives # my $self = $_[0]; my $paras; return unless @{$paras = $self->{'paras'}}; my $curr_open = ($self->{'curr_open'} ||= []); DEBUG > 10 and print "# Paragraph buffer: <<", pretty($paras), ">>\n"; # We have something in our buffer. So apparently the document has started. unless($self->{'doc_has_started'}) { $self->{'doc_has_started'} = 1; my $starting_contentless; $starting_contentless = ( !@$curr_open and @$paras and ! grep $_->[0] ne '~end', @$paras # i.e., if the paras is all ~ends ) ; DEBUG and print "# Starting ", $starting_contentless ? 'contentless' : 'contentful', " document\n" ; $self->_handle_element_start('Document', { 'start_line' => $paras->[0][1]{'start_line'}, $starting_contentless ? ( 'contentless' => 1 ) : (), }, ); } my($para, $para_type); while(@$paras) { last if @$paras == 1 and ( $paras->[0][0] eq '=over' or $paras->[0][0] eq '~Verbatim' or $paras->[0][0] eq '=item' ) ; # Those're the three kinds of paragraphs that require lookahead. # Actually, an "=item Foo" inside an <over type=text> region # and any =item inside an <over type=block> region (rare) # don't require any lookahead, but all others (bullets # and numbers) do. # TODO: winge about many kinds of directives in non-resolving =for regions? # TODO: many? like what? =head1 etc? $para = shift @$paras; $para_type = $para->[0]; DEBUG > 1 and print "Pondering a $para_type paragraph, given the stack: (", $self->_dump_curr_open(), ")\n"; if($para_type eq '=for') { next if $self->_ponder_for($para,$curr_open,$paras); } elsif($para_type eq '=begin') { next if $self->_ponder_begin($para,$curr_open,$paras); } elsif($para_type eq '=end') { next if $self->_ponder_end($para,$curr_open,$paras); } elsif($para_type eq '~end') { # The virtual end-document signal next if $self->_ponder_doc_end($para,$curr_open,$paras); } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ #~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ if(grep $_->[1]{'~ignore'}, @$curr_open) { DEBUG > 1 and print "Skipping $para_type paragraph because in ignore mode.\n"; next; } #~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ if($para_type eq '=pod') { $self->_ponder_pod($para,$curr_open,$paras); } elsif($para_type eq '=over') { next if $self->_ponder_over($para,$curr_open,$paras); } elsif($para_type eq '=back') { next if $self->_ponder_back($para,$curr_open,$paras); } elsif($para_type eq '=row') { next if $self->_ponder_row_start($para,$curr_open,$paras); } else { # All non-magical codes!!! # Here we start using $para_type for our own twisted purposes, to # mean how it should get treated, not as what the element name # should be. DEBUG > 1 and print "Pondering non-magical $para_type\n"; # In tables, the start of a headrow or bodyrow also terminates an # existing open row. if($para_type eq '=headrow' || $para_type eq '=bodyrows') { $self->_ponder_row_end($para,$curr_open,$paras); } # Enforce some =headN discipline if($para_type =~ m/^=head\d$/s and ! $self->{'accept_heads_anywhere'} and @$curr_open and $curr_open->[-1][0] eq '=over' ) { DEBUG > 2 and print "'=$para_type' inside an '=over'!\n"; $self->whine( $para->[1]{'start_line'}, "You forgot a '=back' before '$para_type'" ); unshift @$paras, ['=back', {}, ''], $para; # close the =over next; } if($para_type eq '=item') { next if $self->_ponder_item($para,$curr_open,$paras); $para_type = 'Plain'; # Now fall thru and process it. } elsif($para_type eq '=extend') { # Well, might as well implement it here. $self->_ponder_extend($para); next; # and skip } elsif($para_type eq '=encoding') { # Not actually acted on here, but we catch errors here. $self->_handle_encoding_second_level($para); next; # and skip } elsif($para_type eq '~Verbatim') { $para->[0] = 'Verbatim'; $para_type = '?Verbatim'; } elsif($para_type eq '~Para') { $para->[0] = 'Para'; $para_type = '?Plain'; } elsif($para_type eq 'Data') { $para->[0] = 'Data'; $para_type = '?Data'; } elsif( $para_type =~ s/^=//s and defined( $para_type = $self->{'accept_directives'}{$para_type} ) ) { DEBUG > 1 and print " Pondering known directive ${$para}[0] as $para_type\n"; } else { # An unknown directive! DEBUG > 1 and printf "Unhandled directive %s (Handled: %s)\n", $para->[0], join(' ', sort keys %{$self->{'accept_directives'}} ) ; $self->whine( $para->[1]{'start_line'}, "Unknown directive: $para->[0]" ); # And maybe treat it as text instead of just letting it go? next; } if($para_type =~ s/^\?//s) { if(! @$curr_open) { # usual case DEBUG and print "Treating $para_type paragraph as such because stack is empty.\n"; } else { my @fors = grep $_->[0] eq '=for', @$curr_open; DEBUG > 1 and print "Containing fors: ", join(',', map $_->[1]{'target'}, @fors), "\n"; if(! @fors) { DEBUG and print "Treating $para_type paragraph as such because stack has no =for's\n"; #} elsif(grep $_->[1]{'~resolve'}, @fors) { #} elsif(not grep !$_->[1]{'~resolve'}, @fors) { } elsif( $fors[-1][1]{'~resolve'} ) { # Look to the immediately containing for if($para_type eq 'Data') { DEBUG and print "Treating Data paragraph as Plain/Verbatim because the containing =for ($fors[-1][1]{'target'}) is a resolver\n"; $para->[0] = 'Para'; $para_type = 'Plain'; } else { DEBUG and print "Treating $para_type paragraph as such because the containing =for ($fors[-1][1]{'target'}) is a resolver\n"; } } else { DEBUG and print "Treating $para_type paragraph as Data because the containing =for ($fors[-1][1]{'target'}) is a non-resolver\n"; $para->[0] = $para_type = 'Data'; } } } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if($para_type eq 'Plain') { $self->_ponder_Plain($para); } elsif($para_type eq 'Verbatim') { $self->_ponder_Verbatim($para); } elsif($para_type eq 'Data') { $self->_ponder_Data($para); } else { die "\$para type is $para_type -- how did that happen?"; # Shouldn't happen. } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $para->[0] =~ s/^[~=]//s; DEBUG and print "\n", Pod::Simple::BlackBox::pretty($para), "\n"; # traverse the treelet (which might well be just one string scalar) $self->{'content_seen'} ||= 1; $self->_traverse_treelet_bit(@$para); } } return; } sub _ponder_for { my ($self,$para,$curr_open,$paras) = @_; # Fake it out as a begin/end my $target; if(grep $_->[1]{'~ignore'}, @$curr_open) { DEBUG > 1 and print "Ignoring ignorable =for\n"; return 1; } for(my $i = 2; $i < @$para; ++$i) { if($para->[$i] =~ s/^\s*(\S+)\s*//s) { $target = $1; last; } } unless(defined $target) { $self->whine( $para->[1]{'start_line'}, "=for without a target?" ); return 1; } if (@$para > 3 or $para->[2]) { # This is an ordinary =for and should be handled in the Pod::Simple way DEBUG > 1 and print "Faking out a =for $target as a =begin $target / =end $target\n"; $para->[0] = 'Data'; unshift @$paras, ['=begin', {'start_line' => $para->[1]{'start_line'}, '~really' => '=for'}, $target, ], $para, ['=end', {'start_line' => $para->[1]{'start_line'}, '~really' => '=for'}, $target, ], ; } else { # This is a =for with an =end tag DEBUG > 1 and print "Faking out a =for $target as a =begin $target\n"; unshift @$paras, ['=begin', {'start_line' => $para->[1]{'start_line'}, '~really' => '=for'}, $target, ], ; } return 1; } sub _ponder_begin { my ($self,$para,$curr_open,$paras) = @_; unless ($para->[2] =~ /^\s*(?:table|sidebar|figure|listing)/) { return $self->SUPER::_ponder_begin($para,$curr_open,$paras); } my $content = join ' ', splice @$para, 2; $content =~ s/^\s+//s; $content =~ s/\s+$//s; my ($target, $title) = $content =~ m/^(\S+)\s*(.*)$/; $title =~ s/^(picture|html)\s*// if ($target eq 'table'); $para->[1]{'title'} = $title if ($title); $para->[1]{'target'} = $target; # without any ':' return 1 unless $self->{'accept_targets'}{$target}; $para->[0] = '=for'; # Just what we happen to call these, internally $para->[1]{'~really'} ||= '=begin'; # $para->[1]{'~ignore'} = 0; $para->[1]{'~resolve'} = 1; push @$curr_open, $para; $self->{'content_seen'} ||= 1; $self->_handle_element_start($target, $para->[1]); return 1; } sub _ponder_end { my ($self,$para,$curr_open,$paras) = @_; my $content = join ' ', splice @$para, 2; $content =~ s/^\s+//s; $content =~ s/\s+$//s; DEBUG and print "Ogling '=end $content' directive\n"; unless(length($content)) { if (@$curr_open and $curr_open->[-1][1]{'~really'} eq '=for') { # =for allows an empty =end directive $content = $curr_open->[-1][1]{'target'}; } else { # Everything else should complain about an empty =end directive my $complaint = "'=end' without a target?"; if ( @$curr_open and $curr_open->[-1][0] eq '=for' ) { $complaint .= " (Should be \"=end " . $curr_open->[-1][1]{'target'} . '")'; } $self->whine( $para->[1]{'start_line'}, $complaint); DEBUG and print "Ignoring targetless =end\n"; return 1; } } unless($content =~ m/^\S+$/) { # i.e., unless it's one word $self->whine( $para->[1]{'start_line'}, "'=end $content' is invalid. (Stack: " . $self->_dump_curr_open() . ')' ); DEBUG and print "Ignoring mistargetted =end $content\n"; return 1; } $self->_ponder_row_end($para,$curr_open,$paras) if $content eq 'table'; unless(@$curr_open and $curr_open->[-1][0] eq '=for') { $self->whine( $para->[1]{'start_line'}, "=end $content without matching =begin. (Stack: " . $self->_dump_curr_open() . ')' ); DEBUG and print "Ignoring mistargetted =end $content\n"; return 1; } unless($content eq $curr_open->[-1][1]{'target'}) { if ($content eq 'for' and $curr_open->[-1][1]{'~really'} eq '=for') { # =for allows a "=end for" directive $content = $curr_open->[-1][1]{'target'}; } else { $self->whine( $para->[1]{'start_line'}, "=end $content doesn't match =begin " . $curr_open->[-1][1]{'target'} . ". (Stack: " . $self->_dump_curr_open() . ')' ); DEBUG and print "Ignoring mistargetted =end $content at line $para->[1]{'start_line'}\n"; return 1; } } # Else it's okay to close... if(grep $_->[1]{'~ignore'}, @$curr_open) { DEBUG > 1 and print "Not firing any event for this =end $content because in an ignored region\n"; # And that may be because of this to-be-closed =for region, or some # other one, but it doesn't matter. } else { $curr_open->[-1][1]{'start_line'} = $para->[1]{'start_line'}; # what's that for? $self->{'content_seen'} ||= 1; if ($content eq 'table' or $content eq 'sidebar' or $content eq 'figure' or $content eq 'listing') { $self->_handle_element_end( $content ); } else { $self->_handle_element_end( 'for', { 'target' => $content } ); } } DEBUG > 1 and print "Popping $curr_open->[-1][0] $curr_open->[-1][1]{'target'} because of =end $content\n"; pop @$curr_open; return 1; } sub _ponder_row_start { my ($self,$para,$curr_open,$paras) = @_; $self->_ponder_row_end($para,$curr_open,$paras); push @$curr_open, $para; $self->{'content_seen'} ||= 1; $self->_handle_element_start('row', $para->[1]); return 1; } sub _ponder_row_end { my ($self,$para,$curr_open,$paras) = @_; # PseudoPod doesn't have a row closing entity, so "=row" and "=end # table" have to double for it. if(@$curr_open and $curr_open->[-1][0] eq '=row') { $self->{'content_seen'} ||= 1; my $over = pop @$curr_open; $self->_handle_element_end( 'row' ); } return 1; } 1; __END__ =head1 NAME Pod::PseudoPod - A framework for parsing PseudoPod =head1 SYNOPSIS use strict; package SomePseudoPodFormatter; use base qw(Pod::PseudoPod); sub handle_text { my($self, $text) = @_; ... } sub start_head1 { my($self, $flags) = @_; ... } sub end_head1 { my($self) = @_; ... } ...and start_*/end_* methods for whatever other events you want to catch. =head1 DESCRIPTION PseudoPod is an extended set of Pod tags used for book manuscripts. Standard Pod doesn't have all the markup options you need to mark up files for publishing production. PseudoPod adds a few extra tags for footnotes, tables, sidebars, etc. This class adds parsing support for the PseudoPod tags. It also overrides Pod::Simple's C<_handle_element_start>, C<_handle_text>, and C<_handle_element_end> methods so that parser events are turned into method calls. In general, you'll only want to use this module as the base class for a PseudoPod formatter/processor. =head1 SEE ALSO L<Pod::Simple>, L<Pod::PseudoPod::HTML>, L<Pod::PseudoPod::Tutorial> =head1 COPYRIGHT Copyright (C) 2003-2009 Allison Randal. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. This library 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. =head1 AUTHOR Allison Randal <allison@perl.org> =cut ���������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/lib/Pod/PseudoPod����������������������������������������������������������������000755��001750��001750�� 0�11620337705� 20367� 5����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/lib/Pod/PseudoPod/Checker.pm�����������������������������������������������������000444��001750��001750�� 11500�11620337705� 22443� 0����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������� # A quite dimwitted pod2plaintext that need only know how to format whatever # text comes out of Pod::BlackBox's _gen_errata package Pod::PseudoPod::Checker; use strict; use vars qw( $VERSION ); $VERSION = '0.18'; use Carp (); use base qw( Pod::PseudoPod ); BEGIN { *DEBUG = defined(&Pod::PseudoPod::DEBUG) ? \&Pod::PseudoPod::DEBUG : sub() {0} } use Text::Wrap 98.112902 (); # was 2001.0131, but I don't think we need that $Text::Wrap::wrap = 'overflow'; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub any_errata_seen { # read-only accessor return $_[1]->{'Errata_seen'}; } sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->accept_targets_as_text( qw(author blockquote comment caution editor epigraph example figure important note production programlisting screen sidebar table tip warning) ); $new->nix_X_codes(1); $new->nbsp_for_S(1); $new->{'scratch'} = ''; $new->{'Indent'} = 0; $new->{'Indentstring'} = ' '; $new->{'Errata_seen'} = 0; return $new; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub handle_text { $_[0]{'Errata_seen'} and $_[0]{'scratch'} .= $_[1] } sub start_Para { $_[0]{'scratch'} = '' } sub start_head1 { if($_[0]{'Errata_seen'}) { $_[0]{'scratch'} = ''; } else { if($_[1]{'errata'}) { # start of errata! $_[0]{'Errata_seen'} = 1; $_[0]{'scratch'} = $_[0]{'source_filename'} ? "$_[0]{'source_filename'} -- " : '' } } } sub start_head2 { $_[0]{'scratch'} = '' } sub start_head3 { $_[0]{'scratch'} = '' } sub start_head4 { $_[0]{'scratch'} = '' } sub start_Verbatim { $_[0]{'scratch'} = '' } sub start_item_bullet { $_[0]{'scratch'} = '* ' } sub start_item_number { $_[0]{'scratch'} = "$_[1]{'number'}. " } sub start_item_text { $_[0]{'scratch'} = '' } sub start_over_bullet { ++$_[0]{'Indent'} } sub start_over_number { ++$_[0]{'Indent'} } sub start_over_text { ++$_[0]{'Indent'} } sub start_over_block { ++$_[0]{'Indent'} } sub end_over_bullet { --$_[0]{'Indent'} } sub end_over_number { --$_[0]{'Indent'} } sub end_over_text { --$_[0]{'Indent'} } sub end_over_block { --$_[0]{'Indent'} } # . . . . . Now the actual formatters: sub end_head1 { $_[0]->emit(-4) } sub end_head2 { $_[0]->emit(-3) } sub end_head3 { $_[0]->emit(-2) } sub end_head4 { $_[0]->emit(-1) } sub end_Para { $_[0]->emit( 0) } sub end_item_bullet { $_[0]->emit( 0) } sub end_item_number { $_[0]->emit( 0) } sub end_item_text { $_[0]->emit(-2) } sub emit { return unless $_[0]{'Errata_seen'}; my($self, $tweak_indent) = splice(@_,0,2); my $indent = ' ' x ( 2 * $self->{'Indent'} + ($tweak_indent||0) ); # Yes, 'STRING' x NEGATIVE gives '', same as 'STRING' x 0 $self->{'scratch'} =~ tr{\xAD}{}d if Pod::Simple::ASCII; my $out = Text::Wrap::wrap($indent, $indent, $self->{'scratch'} .= "\n"); $out =~ tr{\xA0}{ } if Pod::Simple::ASCII; print {$self->{'output_fh'}} $out, ; $self->{'scratch'} = ''; return; } # . . . . . . . . . . And then off by its lonesome: sub end_Verbatim { return unless $_[0]{'Errata_seen'}; my $self = shift; if(Pod::Simple::ASCII) { $self->{'scratch'} =~ tr{\xA0}{ }; $self->{'scratch'} =~ tr{\xAD}{}d; } my $i = ' ' x ( 2 * $self->{'Indent'} + 4); $self->{'scratch'} =~ s/^/$i/mg; print { $self->{'output_fh'} } '', $self->{'scratch'}, "\n\n" ; $self->{'scratch'} = ''; return; } sub end_Document { my ($self) = @_; return if $self->{'Errata_seen'}; print { $self->{'output_fh'} } "\tNo errors seen!\n"; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1; __END__ =head1 NAME Pod::PseudoPod::Checker -- check the PseudoPod syntax of a document =head1 SYNOPSIS use Pod::PseudoPod::Checker; my $checker = Pod::PseudoPod::Checker->new(); ... $checker->parse_file('path/to/file.pod'); =head1 DESCRIPTION This class is for checking the syntactic validity of Pod. It works by basically acting like a simple-minded version of L<Pod::PseudoPod::Text> that formats only the "Pod Errors" section (if Pod::PseudoPod even generates one for the given document). It's largely unchanged from L<Pod::Simple::Checker>. =head1 SEE ALSO L<Pod::PseudoPod>, L<Pod::PseudoPod::Text>, L<Pod::Checker> =head1 COPYRIGHT Copyright (c) 2002-2004 Sean M. Burke and Allison Randal. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 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. =head1 AUTHOR Sean M. Burke C<sburke@cpan.org> and Allison Randal <allison@perl.org> =cut ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-PseudoPod-0.18/lib/Pod/PseudoPod/Text.pm��������������������������������������������������������000444��001750��001750�� 11737�11620337705� 22037� 0����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������� require 5; package Pod::PseudoPod::Text; use strict; use Carp (); use vars qw( $VERSION $FREAKYMODE ); $VERSION = '0.18'; use base qw( Pod::PseudoPod ); use Text::Wrap 98.112902 (); $Text::Wrap::wrap = 'overflow'; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->accept_target_as_text(qw( text plaintext plain )); $new->accept_targets_as_text( qw(author blockquote comment caution editor epigraph example figure important listing note production programlisting screen sidebar table tip warning) ); $new->nix_X_codes(1); $new->nix_Z_codes(1); $new->nbsp_for_S(1); $new->codes_in_verbatim(1); $new->{'scratch'} = ''; $new->{'Indent'} = 0; $new->{'Indentstring'} = ' '; return $new; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub handle_text { $_[0]{'scratch'} .= $_[1] } sub start_Para { $_[0]{'scratch'} = '' } sub end_Para { $_[0]->emit(0) } sub start_Verbatim { $_[0]{'scratch'} = '' } sub start_head0 { $_[0]{'scratch'} = '' } sub end_head0 { $_[0]->emit(-4) } sub start_head1 { $_[0]{'scratch'} = '' } sub end_head1 { $_[0]->emit(-3) } sub start_head2 { $_[0]{'scratch'} = '' } sub end_head2 { $_[0]->emit(-2) } sub start_head3 { $_[0]{'scratch'} = '' } sub end_head3 { $_[0]->emit(-1) } sub start_head4 { $_[0]{'scratch'} = '' } sub end_head4 { $_[0]->emit(0) } sub start_item_bullet { $_[0]{'scratch'} = $FREAKYMODE ? '' : '* ' } sub end_item_bullet { $_[0]->emit( 0) } sub start_item_number { $_[0]{'scratch'} = $FREAKYMODE ? '' : "$_[1]{'number'}. " } sub end_item_number { $_[0]->emit( 0) } sub start_item_text { $_[0]{'scratch'} = '' } sub end_item_text { $_[0]->emit(-2) } sub start_over_bullet { ++$_[0]{'Indent'} } sub end_over_bullet { --$_[0]{'Indent'} } sub start_over_number { ++$_[0]{'Indent'} } sub end_over_number { --$_[0]{'Indent'} } sub start_over_text { ++$_[0]{'Indent'} } sub end_over_text { --$_[0]{'Indent'} } sub start_over_block { ++$_[0]{'Indent'} } sub end_over_block { --$_[0]{'Indent'} } sub start_for { ++$_[0]{'Indent'} } sub end_for { $_[0]->emit(); --$_[0]{'Indent'} } sub start_sidebar { my ($self, $flags) = @_; $self->{'scratch'} = ''; if ($flags->{'title'}) { $self->{'scratch'} .= "Sidebar: " . $flags->{'title'} . "\n"; } ++$self->{'Indent'}; $self->emit(); } sub end_sidebar { $_[0]->emit(); --$_[0]{'Indent'} } sub start_table { my ($self, $flags) = @_; $self->{'scratch'} = ''; if ($flags->{'title'}) { $self->{'scratch'} .= "Table: " . $flags->{'title'} . "\n"; } ++$self->{'Indent'}; } sub end_table { --$_[0]{'Indent'} } sub end_cell { $_[0]{'scratch'} .= " | "; } sub end_row { $_[0]->emit() } sub start_N { $_[0]{'scratch'} .= ' [footnote: '; } sub end_N { $_[0]{'scratch'} .= ']'; } sub emit { my($self, $tweak_indent) = splice(@_,0,2); my $indent = ' ' x ( 2 * $self->{'Indent'} + 4 + ($tweak_indent||0) ); # Yes, 'STRING' x NEGATIVE gives '', same as 'STRING' x 0 $self->{'scratch'} =~ tr{\xAD}{}d if Pod::Simple::ASCII; my $out = $self->{'scratch'} . "\n"; $out = Text::Wrap::wrap($indent, $indent, $out); $out =~ tr{\xA0}{ } if Pod::Simple::ASCII; print {$self->{'output_fh'}} $out, "\n"; $self->{'scratch'} = ''; return; } # . . . . . . . . . . And then off by its lonesome: sub end_Verbatim { my $self = shift; if(Pod::Simple::ASCII) { $self->{'scratch'} =~ tr{\xA0}{ }; $self->{'scratch'} =~ tr{\xAD}{}d; } my $i = ' ' x ( 2 * $self->{'Indent'} + 4); #my $i = ' ' x (4 + $self->{'Indent'}); $self->{'scratch'} =~ s/^/$i/mg; print { $self->{'output_fh'} } '', $self->{'scratch'}, "\n\n" ; $self->{'scratch'} = ''; return; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1; __END__ =head1 NAME Pod::PseudoPod::Text -- format PseudoPod as plaintext =head1 SYNOPSIS perl -MPod::PseudoPod::Text -e \ "exit Pod::PseudoPod::Text->filter(shift)->any_errata_seen" \ thingy.pod =head1 DESCRIPTION This class is a formatter that takes PseudoPod and renders it as wrapped plaintext. Its wrapping is done by L<Text::Wrap>, so you can change C<$Text::Wrap::columns> as you like. This is a subclass of L<Pod::PseudoPod> and inherits all its methods. =head1 SEE ALSO L<Pod::Simple>, L<Pod::Simple::TextContent>, L<Pod::Text> =head1 COPYRIGHT Copyright (c) 2002-2004 Sean M. Burke and Allison Randal. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. 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. =head1 AUTHOR Sean M. Burke C<sburke@cpan.org> & Allison Randal <allison@perl.org> =cut ���������������������������������Pod-PseudoPod-0.18/lib/Pod/PseudoPod/DocBook.pm�����������������������������������������������������000444��001750��001750�� 30435�11620337705� 22427� 0����������������������������������������������������������������������������������������������������ustar�00chromatic�����������������������chromatic�����������������������000000��000000�������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pod::PseudoPod::DocBook; use strict; use vars qw( $VERSION ); $VERSION = '0.18'; use Carp (); use base qw( Pod::PseudoPod ); use HTML::Entities 'encode_entities'; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->accept_targets( 'docbook', 'DocBook' ); $new->accept_targets_as_text( qw(blockquote caution epigraph example figure important literal note production screen sidebar table tip warning) ); $new->nbsp_for_S(1); # $new->nix_Z_codes(1); $new->codes_in_verbatim(1); $new->chapter_type('chapter'); # default chapter type $new->{'scratch'} = ''; $new->{'sections'} = (); # a stack for tracking section nesting $new->{'sectionnum'} = (); # a list for tracking section number $new->{'sectionname'} = ['chapter','sect1', 'sect2', 'sect3', 'sect4']; return $new; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub handle_text { my ($self) = @_; # escape special characters in DocBook (<, >, &, etc) my $text = encode_entities( $_[1] ); if ($self->{'in_filename'}) { $self->{'figure_file'} = $text; } else { $self->{'scratch'} .= $text; } } sub start_Para { $_[0]{'scratch'} = '<para>' unless $_[0]{'in_figure'} } sub start_Verbatim { $_[0]{'scratch'} = "<programlisting>\n" unless ($_[0]{'in_screen'}); $_[0]{'in_verbatim'} = 1; } sub start_head0 { $_[0]->set_section(0); } sub start_head1 { $_[0]->set_section(1); } sub start_head2 { $_[0]->set_section(2); } sub start_head3 { $_[0]->set_section(3); } sub start_head4 { $_[0]->set_section(4); } sub set_section { my ($self, $level) = @_; $self->{'scratch'} = $self->close_sections($level); $self->{'sectionnum'}[$level]++ if ($level > 0); my $id = $self->chapter_id(); if ($level > 0) { my @sectionnum = @{$self->{'sectionnum'}}; $id .= '-SECT-'; $id .= join '.', @sectionnum[1 .. $#sectionnum]; } $self->{'scratch'} .= '<' . $self->{'sectionname'}[$level]; $self->{'scratch'} .= ' id="' . $id . '">'; $self->{'scratch'} .= "\n<title>"; push @{$self->{'sections'}}, $level; } sub close_sections { my ($self, $level) = @_; my $scratch = ''; my $sections = $self->{'sections'}; # Are we starting a new section that isn't a subsection? while (defined $sections && @$sections > 0 && $level <= $sections->[-1]) { my $closing = pop @$sections; delete $self->{'sectionnum'}[$closing + 1]; $scratch .= "</" . $self->{'sectionname'}[$closing] . ">\n"; } return $scratch; } sub start_over_bullet { $_[0]{'scratch'} = '<itemizedlist>'; $_[0]->emit() } sub start_over_block { $_[0]{'scratch'} = '<itemizedlist>'; $_[0]->emit() } sub start_over_number { $_[0]{'scratch'} = '<orderedlist>'; $_[0]->emit() } sub start_over_text { $_[0]{'scratch'} = '<variablelist>'; $_[0]->emit() } sub end_over_bullet { $_[0]{'scratch'} .= '</itemizedlist>'; $_[0]->emit() } sub end_over_block { $_[0]{'scratch'} .= '</itemizedlist>'; $_[0]->emit() } sub end_over_number { $_[0]{'scratch'} .= "</para></listitem>\n" if ($_[0]{'in_numlist'}); $_[0]{'scratch'} .= '</orderedlist>'; $_[0]{'in_numlist'} = 0; $_[0]->emit(); } sub end_over_text { $_[0]{'scratch'} .= "</listitem>\n</varlistentry>\n" if ($_[0]{'in_varlist'}); $_[0]{'scratch'} .= '</variablelist>'; $_[0]{'in_varlist'} = 0; $_[0]->emit(); } sub start_item_bullet { $_[0]{'scratch'} = '<listitem><para>' } sub end_item_bullet { $_[0]{'scratch'} .= '</para></listitem>'; $_[0]->emit() } sub start_item_number { $_[0]{'scratch'} .= "</para></listitem>\n" if ($_[0]{'in_numlist'}); $_[0]{'scratch'} .= "<listitem><para>"; $_[0]{'in_numlist'} = 1; } sub end_item_number { $_[0]->emit() } sub start_item_text { $_[0]{'scratch'} .= "</listitem>\n</varlistentry>\n" if ($_[0]{'in_varlist'}); $_[0]{'scratch'} .= "<varlistentry>\n<term>"; $_[0]{'in_varlist'} = 1; } sub end_item_text { $_[0]{'scratch'} .= "</term>\n<listitem>"; $_[0]->emit() } # . . . . . Now the actual formatters: sub end_Para { unless ($_[0]{'in_figure'}) { $_[0]{'scratch'} .= '</para>'; $_[0]->emit(); } } sub end_Verbatim { $_[0]{'scratch'} .= "\n</programlisting>" unless ($_[0]{'in_screen'}); $_[0]{'in_verbatim'} = 0; $_[0]->emit(); } sub end_head0 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head1 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head2 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head3 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head4 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub start_sidebar { my ($self, $flags) = @_; $self->{'scratch'} = ''; if ($flags->{'title'}) { # small hack for encoded entities in sidebar titles $flags->{'title'} =~ s/E<(\w+)>/&$1;/g; $self->{'scratch'} .= "\n" . $flags->{'title'} . ""; } $self->emit(); } sub end_sidebar { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub start_figure { my ($self, $flags) = @_; $self->{'in_figure'} = 1; $self->{'figure_file'} = ''; # $self->{'scratch'} .= '
'; # $self->{'scratch'} .= '' . $flags->{'title'} . '' if $flags->{'title'}; } sub end_figure { my ($self, $flags) = @_; if ($self->{'figure_file'}) { my $filepath = $self->{'figure_file'}; my $fileformat = ''; if ($filepath =~ m/\.(\w+$)/) { $fileformat = uc($1); } $self->{'scratch'} .= <<"XMLBLOCK"; XMLBLOCK # $self->{'scratch'} .= "
"; $self->emit(); } $self->{'in_figure'} = 0; $self->{'figure_file'} = ''; } # This handles =begin and =for blocks of all kinds. sub start_for { my ($self, $flags) = @_; my $target = $flags->{'target'}; if ($target eq "production") { $self->{'scratch'} .= "Note for Production:"; } else { $self->{'scratch'} .= "<$target>"; } $self->{"in_$target"} = 1; $self->emit(); } sub end_for { my ($self, $flags) = @_; my $target = $flags->{'target'}; if ($target eq "production") { $self->{'scratch'} .= ""; } else { $self->{'scratch'} .= ""; } $self->{"in_$target"} = 0; $self->emit(); } sub start_table { my ($self, $flags) = @_; my $id = $self->chapter_id() . '-TABLE-'. $self->table_next(); $self->{'scratch'} .= '{'scratch'} .= 'colsep="0" rowsep="0">'; if ($flags->{'title'}) { $self->{'scratch'} .= "\n" . $flags->{'title'} . ''; } $self->{'scratch'} .= "\n" . ''; $self->emit(); } sub table_next { ++$_[0]{'table_count'} } sub end_table { $_[0]{'scratch'} .= '
'; $_[0]->emit() } sub start_headrow { $_[0]{'scratch'} .= "\n"; $_[0]{'headrow'} = 1 } sub start_bodyrows { my ($self, $flags) = @_; $self->{'scratch'} .= "\n" if ($self->{'headrow'}); $self->{'headrow'} = 0; $self->{'scratch'} .= "\n"; } sub start_row {$_[0]{'scratch'} .= "\n" } sub end_row { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub start_cell { $_[0]{'scratch'} .= ''; } sub end_cell { my $self = shift; $self->{'scratch'} .= ''; $self->emit(); } sub start_Document { my ($self) = @_; } sub end_Document { my ($self) = @_; $self->{'scratch'} .= $self->close_sections(-1); $self->emit(); } # Handling entity tags sub start_L { $_[0]{'scratch'} .= '' } sub start_A { my $self = shift @_; $self->start_L(@_) } sub end_A { my $self = shift @_; $self->end_L(@_) } sub start_B { $_[0]{'scratch'} .= '' } sub end_B { $_[0]{'scratch'} .= '' } sub start_C { $_[0]{'scratch'} .= '' } sub end_C { $_[0]{'scratch'} .= '' } sub start_E { $_[0]{'scratch'} .= '&' } sub end_E { $_[0]{'scratch'} .= ';' } sub start_F { my ($self) = @_; if ($self->{'in_figure'}) { $self->{'in_filename'} = 1; } else { $self->{'scratch'} .= ''; } } sub end_F { my ($self) = @_; if ($self->{'in_figure'}) { $self->{'in_filename'} = 0; } else { $self->{'scratch'} .= ''; } } sub start_G { $_[0]{'scratch'} .= '' } sub end_G { $_[0]{'scratch'} .= '' } sub start_H { $_[0]{'scratch'} .= '' } sub end_H { $_[0]{'scratch'} .= '' } sub start_I { $_[0]{'scratch'} .= '' } sub end_I { $_[0]{'scratch'} .= '' } sub start_N { my ($self) = @_; my $id = $self->chapter_id() . '-FNOTE-'. $self->footnote_next(); $self->{'scratch'} .= ''; } sub end_N { my ($self) = @_; $self->{'scratch'} .= ''; } sub footnote_next { ++$_[0]{'footnote_count'} } sub start_M { $_[0]{'scratch'} .= '' } sub end_M { $_[0]{'scratch'} .= '' } sub start_R { $_[0]{'scratch'} .= '' } sub end_R { $_[0]{'scratch'} .= '' } sub start_U { $_[0]{'scratch'} .= '' } sub start_X { my ($self) = @_; my $id = $self->chapter_id() . '-IDX-' . $self->index_next(); $self->{'scratch'} .= ''; } sub end_X { $_[0]{'scratch'} .= '' } sub index_next { my ($self) = @_; my $idx = ++$self->{'index_count'}; return sprintf("%04d", $idx); } sub start_Z { $_[0]{'scratch'} .= '' } sub emit { my($self) = @_; if ($self->{'scratch'}) { my $out = $self->{'scratch'} . "\n"; print {$self->{'output_fh'}} $out; $self->{'scratch'} = ''; } return; } sub book_id { $_[0]{'book_id'} = $_[1] } sub index_count { $_[0]{'index_count'} = $_[1] if ($_[1]); return $_[0]{'index_count'}; } sub chapter_num { my ($self, $number) = @_; $self->{'chapter_num'} = $number; $self->{'sectionnum'}[0] = $number; } sub chapter_type { my ($self, $type) = @_; $self->{'chapter_type'} = $type; $self->{'sectionname'}[0] = $type; } sub chapter_id { my ($self) = @_; unless ($self->{'chapter_id'}) { my $id; $id = $self->{'book_id'} . '-' if ($self->{'book_id'}); if ($self->{'chapter_type'} eq 'preface') { $id .= 'PREFACE'; $id .= '-' . $self->{'chapter_num'} if ($self->{'chapter_num'}); } elsif ($self->{'chapter_type'} eq 'colophon') { $id .= 'COLOPHON'; } elsif ($self->{'chapter_type'} eq 'appendix') { $id .= 'APP-' . $self->{'chapter_num'}; } elsif ($self->{'chapter_type'} eq 'chapter') { $id .= 'CHP-' . $self->{'chapter_num'}; } $self->{'chapter_id'} = $id; } return $self->{'chapter_id'}; } # bypass built-in E<> handling to preserve entity encoding sub _treat_Es {} 1; __END__ =head1 NAME Pod::PseudoPod::DocBook -- format PseudoPod as DocBook =head1 SYNOPSIS use Pod::PseudoPod::DocBook; my $parser = Pod::PseudoPod::DocBook->new(); ... $parser->parse_file('path/to/file.pod'); Before sending in your manuscript, check that the formatter produced a well-formed DocBook file with I: $ xmllint --noout --valid book.xml =head1 DESCRIPTION This class is a formatter that takes PseudoPod and renders it as DocBook 4.4. This is a subclass of L and inherits all its methods. =head1 SEE ALSO L, L =head1 COPYRIGHT Copyright (c) 2003-2006 Allison Randal. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. This library 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. =head1 AUTHOR Allison Randal =cut Pod-PseudoPod-0.18/lib/Pod/PseudoPod/HTML.pm000444001750001750 2041311620337705 21646 0ustar00chromaticchromatic000000000000package Pod::PseudoPod::HTML; use strict; use vars qw( $VERSION ); $VERSION = '0.18'; use Carp (); use base qw( Pod::PseudoPod ); use HTML::Entities 'encode_entities'; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->accept_targets( 'html', 'HTML' ); $new->accept_targets_as_text( qw(author blockquote comment caution editor epigraph example figure important listing literal note production programlisting screen sidebar table tip warning) ); $new->nix_X_codes(1); $new->nbsp_for_S(1); $new->add_css_tags(0); $new->add_body_tags(0); $new->codes_in_verbatim(1); $new->{'scratch'} = ''; return $new; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub handle_text { # escape special characters in HTML (<, >, &, etc) $_[0]{'scratch'} .= $_[0]{'in_verbatim'} ? encode_entities( $_[1] ) : $_[1] } sub start_Para { $_[0]{'scratch'} .= '

' } sub start_Verbatim { $_[0]{'scratch'} .= '

'; $_[0]{'in_verbatim'} = 1}

sub start_head0 {  $_[0]{'scratch'} = '

' } sub start_head1 { $_[0]{'scratch'} = '

' } sub start_head2 { $_[0]{'scratch'} = '

' } sub start_head3 { $_[0]{'scratch'} = '

' } sub start_head4 { $_[0]{'scratch'} = '

' } sub start_item_bullet { $_[0]{'scratch'} .= '
  • ' } sub start_item_number { $_[0]{'scratch'} .= "
  • $_[1]{'number'}. " } sub start_item_text { $_[0]{'scratch'} .= '
  • ' } sub start_over_bullet { $_[0]{'scratch'} .= '
      '; $_[0]->emit() } sub start_over_text { $_[0]{'scratch'} .= '
        '; $_[0]->emit() } sub start_over_block { $_[0]{'scratch'} .= '
          '; $_[0]->emit() } sub start_over_number { $_[0]{'scratch'} .= '
            '; $_[0]->emit() } sub end_over_bullet { $_[0]{'scratch'} .= '
        '; $_[0]->emit('nowrap') } sub end_over_text { $_[0]{'scratch'} .= '
      '; $_[0]->emit('nowrap') } sub end_over_block { $_[0]{'scratch'} .= '
    '; $_[0]->emit('nowrap') } sub end_over_number { $_[0]{'scratch'} .= ''; $_[0]->emit('nowrap') } # . . . . . Now the actual formatters: sub end_Para { $_[0]{'scratch'} .= '

    '; $_[0]->emit() } sub end_Verbatim { $_[0]{'scratch'} .= '
  • '; $_[0]{'in_verbatim'} = 0; $_[0]->emit('nowrap'); } sub end_head0 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head1 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head2 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head3 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_head4 { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_item_bullet { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_item_number { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub end_item_text { $_[0]->emit() } sub start_sidebar { my ($self, $flags) = @_; $self->{'scratch'} = $self->{'css_tags'} ? '' : ''; $_[0]->emit() } sub start_figure { my ($self, $flags) = @_; $self->{'in_figure'} = 1; $self->{'figure_title'} = $flags->{'title'} if $flags->{'title'}; } sub end_figure { my ($self, $flags) = @_; $self->{'in_figure'} = 0; if ($self->{'figure_title'}) { $self->{'scratch'} .= "

    " . $self->{'figure_title'} . "

    "; delete $self->{'figure_title'}; } $self->emit('nowrap'); } # This handles =begin and =for blocks of all kinds. sub start_for { my ($self, $flags) = @_; if ($self->{'css_tags'}) { $self->{'scratch'} .= '{'scratch'} .= ' class="'.$flags->{'target'}.'"' if ($flags->{'target'}); $self->{'scratch'} .= '>'; $self->emit('nowrap'); } } sub end_for { my ($self) = @_; if ($self->{'css_tags'}) { $self->{'scratch'} .= ''; $self->emit('nowrap'); } } sub start_table { my ($self, $flags) = @_; if ($flags->{'title'}) { $self->{'scratch'} .= "

    Table: " . $flags->{'title'} . "

    \n"; } $self->{'scratch'} .= ''; $self->emit('nowrap'); } sub end_table { $_[0]{'scratch'} .= '
    '; $_[0]->emit('nowrap') } sub start_headrow { $_[0]{'in_headrow'} = 1 } sub start_bodyrows { $_[0]{'in_headrow'} = 0 } sub start_row { $_[0]{'scratch'} .= "\n\n" } sub end_row { $_[0]{'scratch'} .= ''; $_[0]->emit() } sub start_cell { $_[0]{'scratch'} .= $_[0]{'in_headrow'} ? '' : ''; } sub end_cell { my $self = shift; $self->{'scratch'} .= ($self->{'in_headrow'}) ? '' : ''; $self->emit('nowrap'); } sub start_Document { my ($self) = @_; if ($self->{'body_tags'}) { $self->{'scratch'} .= "\n"; $self->{'scratch'} .= "\n" if $self->{'css_tags'}; $self->emit('nowrap'); } } sub end_Document { my ($self) = @_; if ($self->{'body_tags'}) { $self->{'scratch'} .= "\n"; $self->emit('nowrap'); } } # Handling code tags sub start_A { $_[0]{'scratch'} .= 'link' } sub start_B { $_[0]{'scratch'} .= '' } sub end_B { $_[0]{'scratch'} .= '' } sub start_C { $_[0]{'scratch'} .= '' } sub end_C { $_[0]{'scratch'} .= '' } sub start_E { $_[0]{'scratch'} .= '&' } sub end_E { $_[0]{'scratch'} .= ';' } sub start_F { $_[0]{'scratch'} .= ($_[0]{'in_figure'}) ? '' : '' } sub start_G { $_[0]{'scratch'} .= '' } sub end_G { $_[0]{'scratch'} .= '' } sub start_H { $_[0]{'scratch'} .= '' } sub end_H { $_[0]{'scratch'} .= '' } sub start_I { $_[0]{'scratch'} .= '' } sub end_I { $_[0]{'scratch'} .= '' } sub start_N { my ($self) = @_; $self->{'scratch'} .= '' if ($self->{'css_tags'}); $self->{'scratch'} .= ' (footnote: '; } sub end_N { my ($self) = @_; $self->{'scratch'} .= ')'; $self->{'scratch'} .= '' if $self->{'css_tags'}; } sub start_R { $_[0]{'scratch'} .= '' } sub end_R { $_[0]{'scratch'} .= '' } sub start_U { $_[0]{'scratch'} .= '' if $_[0]{'css_tags'} } sub end_U { $_[0]{'scratch'} .= '' if $_[0]{'css_tags'} } sub start_Z { $_[0]{'scratch'} .= '' } sub emit { my($self, $nowrap) = @_; my $out = $self->{'scratch'} . "\n"; print {$self->{'output_fh'}} $out, "\n"; $self->{'scratch'} = ''; return; } # Set additional options sub add_body_tags { $_[0]{'body_tags'} = $_[1] } sub add_css_tags { $_[0]{'css_tags'} = $_[1] } # bypass built-in E<> handling to preserve entity encoding sub _treat_Es {} 1; __END__ =head1 NAME Pod::PseudoPod::HTML -- format PseudoPod as HTML =head1 SYNOPSIS use Pod::PseudoPod::HTML; my $parser = Pod::PseudoPod::HTML->new(); ... $parser->parse_file('path/to/file.pod'); =head1 DESCRIPTION This class is a formatter that takes PseudoPod and renders it as wrapped html. This is a subclass of L and inherits all its methods. =head1 METHODS =head2 add_body_tags $parser->add_body_tags(1); $parser->parse_file($file); Adds beginning and ending "" and "" tags to the formatted document. =head2 add_css_tags $parser->add_css_tags(1); $parser->parse_file($file); Imports a css stylesheet to the html document and adds additional css tags to url, footnote, and sidebar elements for a nicer display. If you don't plan on writing a style.css file (or using the one provided in "examples/"), you probably don't want this option on. =head1 SEE ALSO L, L =head1 COPYRIGHT Copyright (c) 2003-2004 Allison Randal. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. This library 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. =head1 AUTHOR Allison Randal =cut Pod-PseudoPod-0.18/lib/Pod/PseudoPod/Tutorial.pod000444001750001750 4764611620337705 23074 0ustar00chromaticchromatic000000000000=pod =head1 PseudoPod A Pod Extension for Authoring Large Documents =head2 Introduction Perl's "Plain Old Documentation" format (Pod) is not, by any means, a perfect markup language. It lacks XML's robust features of well-formedness and unambiguous syntax. In fact, it was never intended to be anything more than a simple format for embedding documentation inside programs, as Larry Wall's comment in the perlpod man page alludes: "...I'm not at all claiming this to be sufficient for producing a book." Yet many Pod People -- er, I mean, authors -- want to do just that. Pod is, after all, the darling of Perl hackers everywhere. O'Reilly decided to extend it into the realm of large, complex documents, such as the typical book. This extension, called PseudoPod (thanks to Jason McIntosh for the excellent name), adds some inline tags, block structures, and rules to make processing work smoothly. Before you go any further, you should go and read the perlpod man page, if you haven't already. It lays the foundation for PseudoPod, establishing some important rules for syntax and semantics that we rely on. =head2 Terminology Before we dive into the nitty-gritty details of PseudoPod, we should recap the basic concepts of Pod. The following table covers just about everything: =over =item Block A region of text that contains one or more lines, such as a paragraph, head, code listing, or figure. =begin foo Fa la la la la. =end foo =item Inline Segment A region of text that contained inside a block, usually within one line, with localized style properties or semantics. I I Proust's T. =item Simple Paragraph Just a plain, ordinary block of text. Always unindented. Hello there. =item Verbatim Paragraph A section of code, screen output, or an equation whose space and characters need to be preserved, verbatim. Always indented. x + y = z =item Command Paragraph Start a new block style of one or more lines. Multi-line commands may require another command to end the block. =head1 What I Did On My Summer Vacation =item Begin Block A block that contains other blocks, usually to create a special structure, such as a figure or sidebar. =begin note It's not a good idea to stick metal objects into a wall socket. =end note =item For Block A block that denotes a special style or semantic, for example to generate a visible comment in text. =for production In the following paragraph, please use the Mayan petroglyph for corn in place of [corn]. =end for =back =head2 Simple Paragraphs Simple paragraphs are well-named, for they have no special formatting requirements other than to separate them with a blank line. Here are two simple paras living together in a file: A bland, uninteresting, boring, garden-variety, nondescript, rudimentary, common, run-of-the-mill, low-key, unassuming, plain old paragraph. Another bland, uninteresting, boring, garden-variety, nondescript, rudimentary, common, run-of-the-mill, low-key, unassuming, plain old paragraph. Simple paragraphs will not preserve special spacing. Pod formatters are allowed to throw away line breaks, adjust line width, and make any other changes to beautify the paragraphs. If you need to preserve spacing for any reason, you should use a verbatim paragraph. Note that simple paragraphs may not be indented. Any indented line will be treated as a line of code in a separate block. =head2 Verbatim Paragraphs A verbatim paragraph will, unlike the simple paragraph type, preserve all spaces and linebreaks. It's distinguished by indenting every line at least one space. The amount doesn't matter, as long as subsequent lines are indented as least as much as the first line. The Pod parser will measure the first line's indentation and subtract it from following lines. Here's an example: # generate a magic number sub floopy { my $x = shift; if( $x >= 9 ) { return ($x << 3) * 7; } else { return 0; } } Blank lines in code are okay. The verbatim block will continue until a simple paragraph or command paragraph interrupt it. Please do not use tabs! Tab characters are unpredictible. We will try to convert them into strings of 8 spaces, but that might not be what you want. So, to be unambiguous about it, please only use spaces. =head2 Command Paragraphs Command paragraphs are used for all other structures in Pod. The command takes the form of an equals sign (=) followed by some string of alphabetic characters and either a newline or a space and an optional string of data. It looks like this: =COMMAND DATA The equals sign must be the first character on the line or it will be interpreted as something else. If you need to place an equals sign at the beginning of a line, you should use an inline tag like C<=> to encapsulate it. It's good style, but not required, to precede and follow a command paragraph with blank lines. The data can be anything, and it depends on the context what will be done with it. A =head1 command would use data as a section title. This line would begin a table and use everything after the word "graphic" as the title of the table: =begin table graphic Using array references. So the data may contain other commands with data, several levels deep. In general, we try to keep it pretty simple, however. =head2 Heads and Document Structure The most common command paragraph type is the head. A head takes the form of =headN TITLE where N is a single digit from 0 to 4, inversely proportional to its level of significance and TITLE is the text to be used in the head. Level 0 is for the title of a chapter, while level 4 is a sub-sub-sub-section (also called a D-head). An A-head, or level 1 section, would look like this: =head1 Lizard Feeding Tips Pod books typically are split up into multiple files, each containing a single chapter, appendix, or part page (intro to a part of the book). Every PseudoPod file should follow this pattern: =head0 CHAPTER TITLE INTRO PARAGRAPH. =head1 SECTION TITLE INTRO PARAGRAPH. =head2 SUBSECTION TITLE INTRO PARAGRAPH. PARAGRAPH. line of code line of code line of code line of code line of code ... The file should always start with a =head0 which corresponds to a chapter or appendix title. There should be only one per file. Following that is a =head1 which starts a new section. This may be followed by a =head2 and so on down to =head4, but no further than that. Please be careful to nest section levels properly. It's an error to have something line this: =head1 A Happy Section Blah blah blah blah. =head3 A Misplaced Section! This section doesn't belong here. So never let a =head3 follow a =head1 without an intervening =head2 or the parser will likely burst into flames. And it's bad style too. =head2 Inline Character Tagging Inline character tags, also known as interior sequences in Pod parlance, are a special syntactic form that delineates special treatment for character sequences inside a block. For example, to mark a word so that it has italic font style, you would do this: This I should be italicized. In this example, the word "word" will be rendered in italics, while all the other words will be treated normally. The general form of an inline tag is a single character (A-Z are currently supported), followed by a start delimiter and end delimiter. The simplest delimiters are angle brackets (< and >). But sometimes these aren't enough. If you need to enclose the character >, for example, then you have to use an alternate delimiter set so the parser won't be confused. In that case, you can use multiples of < and >, as long as the number of braces on the left match the number on the right. You can also add space between brackets and data, which will be stripped. These all do the same thing: C C<> C<< foo >> C<<<<< foo >>>>> We have tried to preserve all the inline tags defined in the original Pod spec. The set used by PseudoPod adds a bunch more. The following table lays out the tags and their meanings: Tag Meaning Example A, L Cross reference to an end See A. point declared with Z<> B Bold You make me B angry. C Constant Width Set the data using the method C. E Entity reference The product is x E y. F Filename Edit the file F<.cshrc>. G Superscript E = MCG<2> H Subscript HH<2>O I Italic Do I eat that. M First occuring term This phenomenon is called M. N Footnote TheoreticallyN, it's possible. R Replaceable thing C< R + 2 >, where R is the number of pages S Text with non-breaking spaces T Citation Read my book, T. U URL Download the module from U. X Index term X Z A cross reference endpoint =begin figure My Bedroom Z Some notes about the above table: =over =item 1 The C tag will be replaced with some generated text that references another object. Its data is a unique indentifier string that matches a C tag elsewhere in the document. So, if there is an A head followed by a CfloofE>, then you can insert CfloofE> anywhere in the document. It will be replaced with something like "Section 3.4, 'Gloppy Drainpipes'" or whatever makes sense in that context. This will work with sections, chapters, tables, examples, or figures. =item 2 In standard Pod, C means any escaped character, but we have taken this further. In PseudoPod, the data in C is the name of an XML entity, as defined in ISO-8879. So, translated into XML it would wind up as × and when translated into Unicode, it would become the multiplication symbol ×. For a complete list of these entities, consult DocBook, The Definitive Guide by Walsh and Muellner, which contains a handy table in an appendix. =item 3 As is also true for all other inlines, the C tag, for footnotes, cannot contain multiple paragraphs. =item 4 The C tag will not be displayed where it's invoked. Instead, the parser will stash it away to use in building the index later. (Technically, it will still be located there after conversion, but in another form that is also invisible.) Separate primary, secondary, and tertiary terms with a comma. Start the data with the words "See" or "See also" to create an index entry that redirects to another term. Only one C tag per entry is allowed. =item 5 The C tag always follows a command paragraph to which it lends its data as an identifier. Elsewhere in the file, an C tag will contain the same data, setting up a cross reference to that structure. =back The most common type of error we see in Pod files is imbalanced delimiters in inline tags. Be wary of this! These are all errors: C<>> C<< x - y > z > TDATAE> starts a cross reference to an object with an identifer "DATA". It can appear inside any simple paragraph or list. CDATAE> completes a cross reference by labelling the object that contains it "DATA". It always appears inside a structure, right after the command paragraph that starts it, like a figure or section. The following is an example, with a paragraph containing a cross reference that points to a figure: Our escape route takes us underneath the prison wall, out into an old apple orchard. The map is detailed in A. =begin figure picture Tunnel Trajectory Z ... picture here ... =end figure It doesn't matter if the C tag comes before or after the C tag, nor how many times the C is referenced. However, every C must reference an existing C, and no two C tags can contain the same identifier. It's not a fatal error, but will cause the parser to complain and be unable to complete the link. If you want to reference something in another file, it works the same way. However, all the files share the same namespace for identifiers. Make sure that you don't use the same identifier twice in different files or cross references will behave unpredictibly. =head2 Lists A list always begins with a =over command and ends with a =back command. List items start with =item and can take several forms, depending on the kind of list: =over =item bulleted list Place a star after the =item like this: =over =item * popsicle =item * ice cream =back Note that it doesn't matter if the item text continues on the same line as the star or begins on a new line. =item numbered list Place a number after the =item. The actual value doesn't matter, as the formatter will number items automatically, so typically people just use the number "1": =over =item 1 mount bicycle =item 1 balance on seat =item 1 put feet on pedals =item 1 pedal quickly so you don't fall over =back Again, it doesn't matter if you continue on the same line with item text. Longer paras will probably be more readable if you use a new line. =item term-definition list The term immediately follows the =item command, with definition on a new line: =over =item food A thing to ingest that gives you energy and tastes yummy. =item mud A thing you play with and makes your clothes all dirty. =back =back Lists can be nested, and each list item can hold multiple paragraphs. But please, no tables or figures inside lists. They're icky and make the parser sad. Here's a complex example: If you need sugar in a hurry, this list will provide some suggestions: =over =item 1 Donuts There are three principle varieties of this confection: =over =item 1 Crullers =item 1 Roundies =item 1 Jellies =back =item 1 Candy bars Even more carbohydrates packed into a convenient, tiny package. Some of my favorites are: =over =item 1 Payday (nutty) =item 1 Snickers (nougaty) =item 1 Zagnut (coconutty) =back =back =head2 Examples An example is simply a wrapper for something to give it a title and hook for cross references. The usual candidate for inclusion is a code listing. Here's an example: =begin listing A Frightening Subroutine Z for( my $i=0; $i<10; $i++ ) { print "BOO!\n"; } =end listing =head2 Tables A table is a great way to convey complex information in a compact way. Unfortunately, tables are themselves complex when it comes to markup. We realize that authors don't like to be constrained in complex markup scenarios, so we offer three ways to markup tables: =over =item * As a Pod formatted table =item * As verbatim text =item * As an HTML-tagged table =back Here's the basic form of a table: =begin table TYPE TITLE Z CONTENT =end table The preferred method is the PseudoPod table format which has =row and =cell tags, as well as =headrow to mark the heading row and =bodyrows to mark the start of the main body of the table: =begin table An Example Table =headrow =row =cell Header for first column (row 1, col 1) =cell Header for 2nd column (row 1, col 2) =bodyrows =row =cell Cell for row 2, col 1 =cell Cell for row 2, col 2 =row =cell Cell for row 3, col 1 =cell Cell for row 3, col 2 =end table The second method is a freestyle, anything-goes format. Make your own columns and headers any way you want. The plus side is: infinite creativity! The downside is: we will end up recoding the whole table ourselves in production which slows us down a bit. Just try to make it clear what is in which column and on what row, and it will be okay with us. The table markup is a wrapper, similar to examples, but with an extra keyword, TYPE, to denote the kind of table. If the keyword is "html", our parser will read it like an HTML table. If it's anything else, like "graphic" or "picture", it will be treated as an ASCII rendering. For example: =begin table picture Comparing Camels to Horses. Z CAMEL HORSE Lives in desert Lives in grassland Bumpy Smooth Spits Kicks =end table =head2 Figures A figure holds some kind of picture, whether an imported graphic or an ASCII masterpiece you paint yourself. The general form is similar to a table's: =begin figure TYPE TITLE Z CONTENT =end figure If the TYPE is "graphic", then the parser will expect to see a reference to an external file, the name of a graphic to import. For example: =begin figure graphic My Hairstyle Z F =end figure For any other value of TYPE, the parser assumes you drew your own lovely diagram in text: =begin figure pikchur My Hairstyle Z \ | / // \ \ - / \ \ | / (o o) I look like a pineapple! ( < ) (===) =end figure =head2 Other Structures The rest of this tutorial is a mixed bag of oddball stuff you can drop in your book. =head3 Comments If you want to leave a comment in the manuscript for somebody to see, you can use the =for command. The data in the command specifies who the comment is for. Typical designations include "production", "author", and "editor". For instance: =for editors My misspelling of 'antidisestablishmentarianism' in the following paragraph is intentional. =end for =head3 Literal Layouts If you want something to be treated like a verbatim paragraph, but not rendered in constant width font, then use =begin literal. Here's a bit of poetry done up like that: =begin literal As I was going up the stair, I met a man who was not there. He wasn't there again today; I wish that man would go away. =end literal =head3 Footnotes Footnotes use the C inline tag to locate them inside blocks. Strangely, they also function like blocks in that they can be many lines long. The following example shows how you might use them: O'Reilly books often contain footnotes,N it.>.> though I believe that house style limits them to three per page.N =head3 Epigraphs For an epigraph, just wrap it up in a =begin epigraph command like this: =begin epigraph Great art must be licked. --Jas W Felter, Mail Artist =end epigraph =head3 Author Information If you need to specify the author's name for a particular chapter or article, use the =author command: =author Ferdinand Buscaglia =head2 History PseudoPod was originally the brainchild of Jason "J-mac" McIntosh who worked for O'Reilly's Publishing Tools Group. It was used for many venerable Perl books, including several revisions of the Camel and Llama. The Pod::PseudoPod modules were developed by Allison Randal while writing a book for O'Reilly as an easy-to-use and easy-to-install alternative to O'Reilly's internal PseudoPod parsing and formatting tools, to allow authors to check their formatting before submitting files. As of 2007, PsuedoPod is no longer used or maintained by O'Reilly, after they switched all their manuscripts to DocBook. L is now the primary parser for PseudoPod, and includes L to generate DocBook output suitable for submission to O'Reilly. Pod-PseudoPod-0.18/lib/Pod/PseudoPod/Index.pm000444001750001750 624211620337705 22135 0ustar00chromaticchromatic000000000000package Pod::PseudoPod::Index; use strict; use Carp (); use base qw( Pod::PseudoPod ); use vars qw( $VERSION ); $VERSION = '0.18'; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub new { my $self = shift; my $index = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->accept_targets_as_text( qw(author blockquote comment caution editor epigraph example figure important note production programlisting screen sidebar table tip warning) ); $new->nix_Z_codes(1); $new->{'index'} = $index || {}; $new->{'scratch'} = ''; $new->{'Indent'} = 0; $new->{'Indentstring'} = ' '; return $new; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub start_X { $_[0]{'X'} = 1; } sub end_X { my $self = shift; my $text = $self->{'scratch'}; $self->{'scratch'} = ''; my $cross_ref = $self->{'index_file'} || $self->set_filename; &_build_index($self->{'index'},$cross_ref,split(';', $text)); $self->{'X'} = 0; } sub _build_index { my ($node,$cross_ref,@elems) = @_; foreach my $entry (@elems,undef) { if (defined $entry) { $node->{$entry} = {} unless (defined $node->{$entry}); $node = $node->{$entry}; } else { $node->{'page'} = [] unless (defined $node->{'page'}); push @{$node->{'page'}}, $cross_ref; } } } sub handle_text { $_[0]{'scratch'} .= $_[1] if $_[0]{'X'}; } sub get_index { return $_[0]{'index'} } sub output_text { my $self = shift; $self->_print_index($self->{'index'},''); print {$self->{'output_fh'}} $self->{'scratch'}; } # recursively print out index tree structure sub _print_index { my ($self,$node,$indent) = @_; foreach my $key (sort {lc($a) cmp lc($b)} keys %{$node}) { if ($key eq 'page') { $self->{'scratch'} .= ', '. join(", ", @{$node->{'page'}}); } else { $self->{'scratch'} .= "\n". $indent. $key; $self->_print_index($node->{$key}, $indent.' '); } } } sub set_filename { my $self = shift; my $file = $self->{'source_filename'} || ''; $file =~ /(\w+)\.pod$/; $self->{'index_file'} = $1 || "0"; return $self->{'index_file'}; } 1; __END__ =head1 NAME Pod::PseudoPod::Index -- format PseudoPod index entries =head1 SYNOPSIS use Pod::PseudoPod::Index; my $parser = Pod::PseudoPod::Index->new(); $parser->parse_file('path/to/file1.pod'); $parser->parse_file('path/to/file2.pod'); $parser->output_text; =head1 DESCRIPTION This class is a formatter that extracts index items from PseudoPod files and renders them as plain text or html. This is a subclass of L and inherits all its methods. =head1 SEE ALSO L =head1 COPYRIGHT Copyright (c) 2004 Allison Randal. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. 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. =head1 AUTHOR Allison Randal =cut Pod-PseudoPod-0.18/t000755001750001750 011620337705 15440 5ustar00chromaticchromatic000000000000Pod-PseudoPod-0.18/t/beginend.t000444001750001750 722611620337705 17544 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/beginend.t - check additions to =begin and =end BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 20; use_ok('Pod::PseudoPod::HTML') or exit; my ($parser, $results); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin sidebar This is the text of the sidebar. =end sidebar EOPOD is($results, <<'EOHTML', "a simple sidebar");

    This is the text of the sidebar.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin sidebar Title Text This is the text of the sidebar. =end sidebar EOPOD is($results, <<'EOHTML', "a sidebar with a title");

    Title Text

    This is the text of the sidebar.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin sidebar Title Text This is the text of the Z sidebar. =end sidebar EOPOD is($results, <<'EOHTML', "a sidebar with a Z<> entity");

    Title Text

    This is the text of the sidebar.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin programlisting This is used for code blocks and should have no effect beyond ordinary indented text. =end programlisting EOPOD is($results, <<'EOHTML', "allow programlisting blocks");
      This is used for code blocks
      and should have no effect
      beyond ordinary indented text.
    EOHTML initialize($parser, $results); $parser->add_css_tags(1); $parser->parse_string_document(<<'EOPOD'); =begin programlisting This is used for code blocks and should have no effect beyond ordinary indented text. =end programlisting EOPOD is($results, <<'EOHTML', "programlisting blocks with css tags turned on");
      This is used for code blocks
      and should have no effect
      beyond ordinary indented text.
    EOHTML initialize($parser, $results); $parser->add_css_tags(1); $parser->parse_string_document(<<'EOPOD'); =begin listing This is used for code blocks and should have no effect beyond ordinary indented text. =end listing EOPOD is($results, <<'EOHTML', "listing blocks");
      This is used for code blocks
      and should have no effect
      beyond ordinary indented text.
    EOHTML foreach my $target (qw(blockquote comment caution epigraph example important note screen tip warning)) { initialize($parser, $results); $parser->parse_string_document(<<"EOPOD"); =begin $target This is a $target. =end $target EOPOD is($results, <<"EOHTML", "allow $target blocks");

    This is a $target.

    EOHTML } initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin figure F =end figure EOPOD is($results, <<'EOHTML', "a simple figure");

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin figure Z F =end figure EOPOD is($results, <<'EOHTML', "a figure with a Z<> tag included.");

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin figure This is a sample figure Z F =end figure EOPOD is($results, <<'EOHTML', "a figure with a caption.");

    This is a sample figure

    EOHTML ###################################### sub initialize { $_[0] = Pod::PseudoPod::HTML->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/html.t000444001750001750 1772311620337705 16760 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/html.t - check output from Pod::PseudoPod::HTML BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 31; use_ok('Pod::PseudoPod::HTML') or exit; my $parser = Pod::PseudoPod::HTML->new (); isa_ok ($parser, 'Pod::PseudoPod::HTML'); my $results; initialize($parser, $results); $parser->parse_string_document( "=head0 Narf!" ); is($results, "

    Narf!

    \n\n", "head0 level output"); initialize($parser, $results); $parser->parse_string_document( "=head1 Poit!" ); is($results, "

    Poit!

    \n\n", "head1 level output"); initialize($parser, $results); $parser->parse_string_document( "=head2 I think so Brain." ); is($results, "

    I think so Brain.

    \n\n", "head2 level output"); initialize($parser, $results); $parser->parse_string_document( "=head3 I say, Brain..." ); is($results, "

    I say, Brain...

    \n\n", "head3 level output"); initialize($parser, $results); $parser->parse_string_document( "=head4 Zort!" ); is($results, "
    Zort!
    \n\n", "head4 level output"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Gee, Brain, what do you want to do tonight? EOPOD is($results, <<'EOHTML', "simple paragraph");

    Gee, Brain, what do you want to do tonight?

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EOPOD my $html = '

    B: Now, Pinky, if by any chance you are captured during this mission, ' . 'remember you are Gunther Heindriksen from Appenzell. You moved to ' . "Grindelwald to drive the cog train to Murren. Can you repeat that?

    \n\n" . "

    P: Mmmm, no, Brain, don't think I can.

    \n\n"; is($results, $html, "multiple paragraphs"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * P: Gee, Brain, what do you want to do tonight? =item * B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOHTML', "simple bulleted list");
    • P: Gee, Brain, what do you want to do tonight?
    • B: The same thing we do every night, Pinky. Try to take over the world!
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item 1 P: Gee, Brain, what do you want to do tonight? =item 2 B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOHTML', "numbered list");
    1. 1. P: Gee, Brain, what do you want to do tonight?
    2. 2. B: The same thing we do every night, Pinky. Try to take over the world!
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item Pinky Gee, Brain, what do you want to do tonight? =item Brain The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOHTML', "list with text headings");
    • Pinky

      Gee, Brain, what do you want to do tonight?

    • Brain

      The same thing we do every night, Pinky. Try to take over the world!

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod 1 + 1 = 2; 2 + 2 = 4; EOPOD is($results, <<'EOHTML', "code block");
      1 + 1 = 2;
      2 + 2 = 4;
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a C. EOPOD is($results, <<"EOHTML", "code entity in a paragraph");

    A plain paragraph with a functionname.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with aN. EOPOD is($results, <<"EOHTML", "footnote entity in a paragraph");

    A plain paragraph with a (footnote: footnote entry).

    EOHTML initialize($parser, $results); $parser->add_body_tags(1); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with body tags turned on. EOPOD is($results, <<"EOHTML", "adding html body tags");

    A plain paragraph with body tags turned on.

    EOHTML initialize($parser, $results); $parser->add_body_tags(1); $parser->add_css_tags(1); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with body tags and css tags turned on. EOPOD is($results, <<"EOHTML", "adding html body tags and css tags");

    A plain paragraph with body tags and css tags turned on.

    EOHTML initialize($parser, $results); $parser->add_css_tags(1); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with aN and css tags. EOPOD $html = '

    A plain paragraph with a (footnote: ' . "footnote entry) and css tags.

    \n\n"; is($results, $html, "css footnote entity in a paragraph"); initialize($parser, $results); $parser->add_css_tags(1); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a U. EOPOD $html = '

    A plain paragraph with a ' . "http://test.url.com/stuff/and/junk.txt.

    \n\n"; is($results, $html, "URL entity in a paragraph"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a Z. EOPOD is($results, <<"EOHTML", "Link anchor entity in a paragraph");

    A plain paragraph with a .

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a A. EOPOD is($results, <<"EOHTML", "Link entity in a paragraph");

    A plain paragraph with a link.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a G. EOPOD is($results, <<"EOHTML", "Superscript in a paragraph");

    A plain paragraph with a superscript.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a H. EOPOD is($results, <<"EOHTML", "Subscript in a paragraph");

    A plain paragraph with a subscript.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with B. EOPOD is($results, <<"EOHTML", "Bold text in a paragraph");

    A plain paragraph with bold text.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with I. EOPOD is($results, <<"EOHTML", "Italic text in a paragraph");

    A plain paragraph with italic text.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with R. EOPOD is($results, <<"EOHTML", "Replaceable text in a paragraph");

    A plain paragraph with replaceable text.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a F. EOPOD is($results, <<"EOHTML", "File name in a paragraph");

    A plain paragraph with a filename.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod # this header is very important & don't you forget it my $text = "File is: " . ; EOPOD like($results, qr/"/, "Verbatim text with encodable quotes"); like($results, qr/&/, "Verbatim text with encodable ampersands"); like($results, qr/</, "Verbatim text with encodable less-than"); like($results, qr/>/, "Verbatim text with encodable greater-than"); ###################################### sub initialize { $_[0] = Pod::PseudoPod::HTML->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/fcodes.t000444001750001750 202311620337705 17222 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/fcodes.t - check formatting codes BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 4; use_ok('Pod::PseudoPod::HTML') or exit; my $parser = Pod::PseudoPod::HTML->new (); isa_ok ($parser, 'Pod::PseudoPod::HTML'); my $results; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod B You astound me, Brain! EOPOD is($results, <<'EOHTML', "simple B<> code");

    Egad! You astound me, Brain!

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod literal code with B characters and some more lines, to test. EOPOD is($results, <<'EOHTML', "B<> in literal code");
      literal code with bold characters
      and some more lines, to test.
    EOHTML ###################################### sub initialize { $_[0] = Pod::PseudoPod::HTML->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/checker.t000444001750001750 152611620337705 17372 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/checker.t - test Checker.pm BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 3; use_ok('Pod::PseudoPod::Checker') or exit; my $parser = Pod::PseudoPod::Checker->new (); isa_ok ($parser, 'Pod::PseudoPod::Checker'); my $results; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin sidebar A sidebar with some content. =end EOPOD is($results, <<'EOERR', "catch mismatched =begin/=end tags"); POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 5: '=end' without a target? (Should be "=end sidebar") EOERR ###################################### sub initialize { $_[0] = Pod::PseudoPod::Checker->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/index.t000444001750001750 354611620337705 17101 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/index.t - check output from Pod::PseudoPod::Index BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 7; use_ok('Pod::PseudoPod::Index') or exit; my $parser = Pod::PseudoPod::Index->new (); isa_ok ($parser, 'Pod::PseudoPod::Index'); my $results; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Paragraph X paragraph. =end EOPOD $parser->output_text; is($results, "\ntest, 0", "a simple index item"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Paragraph X> paragraph. =end EOPOD $parser->output_text; is($results, "\ntest>, 0", "index item with coded entity"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Paragraph X paragraph. Second paragraph X second paragraph. =end EOPOD $parser->output_text; is($results, "\nanother test, 0\ntest, 0", "two simple index items"); $results = ''; my $index = {}; $parser = Pod::PseudoPod::Index->new ($index); $parser->parse_string_document(<<'EOPOD'); =pod Paragraph X paragraph. =end EOPOD $parser = Pod::PseudoPod::Index->new ($index); $parser->parse_string_document(<<'EOPOD'); =pod Second paragraph X second paragraph. =end EOPOD $parser->output_string( \$results ); # Send the resulting output to a string $parser->output_text; is($results, "\ngoing twice, 0\ntest, 0", "two index items in two files"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Paragraph X paragraph. =end EOPOD $parser->output_text; is($results, "\ntest\n blah, 0", "a two-level index item"); ###################################### sub initialize { $_[0] = Pod::PseudoPod::Index->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/docbook.t000444001750001750 2077111620337705 17431 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/docbook.t - check output from Pod::PseudoPod::DocBook BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 27; use_ok('Pod::PseudoPod::DocBook') or exit; my $parser = Pod::PseudoPod::DocBook->new (); isa_ok ($parser, 'Pod::PseudoPod::DocBook'); my $results; initialize($parser, $results); $parser->chapter_num(5); $parser->parse_string_document( <<'EOPOD' ); =head0 Narf! =head1 Poit! =head2 I think so Brain. =head3 I say, Brain... =head3 What do you want to do tonight, Brain? =head4 Zort! =head1 Egads! EOPOD is($results, <<'EODB', "multiple head level output"); Narf! Poit! I think so Brain. I say, Brain... What do you want to do tonight, Brain? Zort! Egads! EODB initialize($parser, $results); $parser->chapter_type('preface'); $parser->parse_string_document( <<'EOPOD' ); =head0 Narf! =head1 Poit! EOPOD is($results, <<'EODB', "multiple head level output (preface chapter)"); Narf! Poit! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Gee, Brain, what do you want to do tonight? EOPOD is($results, <<'EODB', "simple paragraph"); Gee, Brain, what do you want to do tonight? EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EOPOD is($results, <<'EODB', "multiple paragraphs"); B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * P: Gee, Brain, what do you want to do tonight? =item * B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EODB', "simple bulleted list"); P: Gee, Brain, what do you want to do tonight? B: The same thing we do every night, Pinky. Try to take over the world! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item 1 P: Gee, Brain, what do you want to do tonight? =item 2 B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EODB', "numbered list"); P: Gee, Brain, what do you want to do tonight? B: The same thing we do every night, Pinky. Try to take over the world! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item Pinky Gee, Brain, what do you want to do tonight? =item Brain The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EODB', "list with text headings"); Pinky Gee, Brain, what do you want to do tonight? Brain The same thing we do every night, Pinky. Try to take over the world! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod 1 + 1 = 2; 2 + 2 = 4; EOPOD is($results, <<'EODB', "code block"); 1 + 1 = 2; 2 + 2 = 4; EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a C. EOPOD is($results, <<"EODB", "code entity in a paragraph"); A plain paragraph with a functionname. EODB initialize($parser, $results); $parser->chapter_num(9); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a footnote.N EOPOD is($results, <<"EODB", "footnote entity in a paragraph"); A plain paragraph with a footnote.And the footnote is... EODB initialize($parser, $results); $parser->chapter_type('preface'); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a footnote.N EOPOD is($results, <<"EODB", "footnote entity in a paragraph (preface chapter)"); A plain paragraph with a footnote.And the footnote is... EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a U. EOPOD is($results, <<"EODB", "URL entity in a paragraph"); A plain paragraph with a . EODB TODO: { local $TODO = "waiting for spec from O'Reilly"; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a Z. EOPOD is($results, <<"EODB", "Link anchor entity in a paragraph"); A plain paragraph with a . EODB }; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a A. EOPOD is($results, <<"EODB", "Link entity in a paragraph"); A plain paragraph with a . EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a G. EOPOD is($results, <<"EODB", "Superscript in a paragraph"); A plain paragraph with a superscript. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a H. EOPOD is($results, <<"EODB", "Subscript in a paragraph"); A plain paragraph with a subscript. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with B. EOPOD is($results, <<"EODB", "Bold text in a paragraph"); A plain paragraph with bold text. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with I. EOPOD is($results, <<"EODB", "Italic text in a paragraph"); A plain paragraph with italic text. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with R. EOPOD is($results, <<"EODB", "Replaceable text in a paragraph"); A plain paragraph with replaceable text. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a F. EOPOD is($results, <<"EODB", "File name in a paragraph"); A plain paragraph with a filename. EODB TODO: { local $TODO = "waiting for spec from O'Reilly"; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin author A paragraph inside a block. =end author EOPOD is($results, <<"EODB", "File name in a paragraph"); A paragraph inside a block. EODB }; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod # this header is very important & don't you forget it B || 'Blank!';> my $text = "File is: " . ; EOPOD like($results, qr/"/, "Verbatim text with encodable quotes"); like($results, qr/&/, "Verbatim text with encodable ampersands"); like($results, qr/</, "Verbatim text with encodable less-than"); like($results, qr/>/, "Verbatim text with encodable greater-than"); ###################################### sub initialize { $_[0] = Pod::PseudoPod::DocBook->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/table.t000444001750001750 534311620337705 17056 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/table.t - check the output of tables to html BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 9; use_ok('Pod::PseudoPod::HTML') or exit; my $parser = Pod::PseudoPod::HTML->new (); isa_ok ($parser, 'Pod::PseudoPod::HTML'); my $results; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOHTML', "a simple table");
    Cell 1 Cell 2
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table An Example Table =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOHTML', "a table with a title");

    Table: An Example Table

    Cell 1 Cell 2
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table =headrow =row =cell Header 1 =cell Header 2 =bodyrows =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOHTML', "a table with a header row");
    Header 1 Header 2
    Cell 1 Cell 2
    EOHTML TODO: { local $TODO = "add checks for empty rows"; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table =row =end table EOPOD is($results, <<'EOHTML', "a table with an empty row");
    EOHTML }; # TODO initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table picture An Example Table =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOHTML', "get rid of table type info");

    Table: An Example Table

    Cell 1 Cell 2
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table Z =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOHTML', "a table with a Z<> tag inside");

    Cell 1 Cell 2
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table =row =cell This is a really, really long cell. So long, in fact that it wraps right around. =cell Cell 2 =end table EOPOD is($results, <<'EOHTML', "lines in cells are not wrapped");
    This is a really, really long cell. So long, in fact that it wraps right around. Cell 2
    EOHTML ###################################### sub initialize { $_[0] = Pod::PseudoPod::HTML->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/for.t000444001750001750 433611620337705 16556 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/for.t - check PseudoPod for blocks BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 8; use_ok('Pod::PseudoPod::HTML') or exit; my ($parser, $results); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for editor This is an ordinary for with no end directive. EOPOD is($results, <<'EOHTML', "a simple for");

    This is an ordinary for with no end directive.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for editor This is a PseudoPod for with an end directive. =end EOPOD is($results, <<'EOHTML', "a for with an '=end' directive");

    This is a PseudoPod for with an end directive.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for editor This is a PseudoPod for with an end for directive. =end for EOPOD is($results, <<'EOHTML', "a for with an '=end for' directive");

    This is a PseudoPod for with an end for directive.

    EOHTML initialize($parser, $results); $parser->add_css_tags(1); $parser->parse_string_document(<<'EOPOD'); =for editor This is a PseudoPod for with css tags turned on. =end EOPOD is($results, <<'EOHTML', "an ended for with css tags");

    This is a PseudoPod for with css tags turned on.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for author This is a PseudoPod for with an end directive. =end EOPOD is($results, <<'EOHTML', "author for");

    This is a PseudoPod for with an end directive.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for production This is a PseudoPod for with an end directive. =end EOPOD is($results, <<'EOHTML', "production for");

    This is a PseudoPod for with an end directive.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for ignore This is a PseudoPod for with an end directive. =end EOPOD is($results, '', "for with 'ignore' target is always ignored"); ###################################### sub initialize { $_[0] = Pod::PseudoPod::HTML->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/text.t000444001750001750 1661711620337705 17001 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/text.t - check output from Pod::PseudoPod::Text BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 27; use_ok('Pod::PseudoPod::Text') or exit; my $parser = Pod::PseudoPod::Text->new (); isa_ok ($parser, 'Pod::PseudoPod::Text'); my $results; initialize($parser, $results); $parser->parse_string_document( "=head0 Narf!" ); is($results, "Narf!\n\n", "head0 level output"); initialize($parser, $results); $parser->parse_string_document( "=head1 Poit!" ); is($results, " Poit!\n\n", "head1 level output"); initialize($parser, $results); $parser->parse_string_document( "=head2 I think so Brain." ); is($results, " I think so Brain.\n\n", "head2 level output"); initialize($parser, $results); $parser->parse_string_document( "=head3 I say, Brain..." ); is($results, " I say, Brain...\n\n", "head3 level output"); initialize($parser, $results); $parser->parse_string_document( "=head4 Zort!" ); is($results, " Zort!\n\n", "head4 level output"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Gee, Brain, what do you want to do tonight? EOPOD is($results, <<'EOTXT', "simple paragraph"); Gee, Brain, what do you want to do tonight? EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EOPOD is($results, <<'EOTXT', "multiple paragraphs"); B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * P: Gee, Brain, what do you want to do tonight? =item * B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOTXT', "simple bulleted list"); * P: Gee, Brain, what do you want to do tonight? * B: The same thing we do every night, Pinky. Try to take over the world! EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item 1 P: Gee, Brain, what do you want to do tonight? =item 2 B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOTXT', "numbered list"); 1. P: Gee, Brain, what do you want to do tonight? 2. B: The same thing we do every night, Pinky. Try to take over the world! EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item Pinky Gee, Brain, what do you want to do tonight? =item Brain The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOTXT', "list with text headings"); Pinky Gee, Brain, what do you want to do tonight? Brain The same thing we do every night, Pinky. Try to take over the world! EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod 1 + 1 = 2; 2 + 2 = 4; EOPOD is($results, <<'EOTXT', "code block"); 1 + 1 = 2; 2 + 2 = 4; EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a C. EOPOD is($results, <<"EOTXT", "code entity in a paragraph"); A plain paragraph with a functionname. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with aN. EOPOD is($results, <<"EOTXT", "footnote entity in a paragraph"); A plain paragraph with a [footnote: footnote entry]. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a U. EOPOD is($results, <<"EOHTML", "URL entity in a paragraph"); A plain paragraph with a http://test.url.com/stuff/and/junk.txt. EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a Zcross-reference. EOPOD is($results, <<"EOHTML", "Link anchor entity in a paragraph"); A plain paragraph with a cross-reference. EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for text This is a dummy for block. EOPOD is($results, <<"EOTXT", "a simple 'for' block"); This is a dummy for block. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =for editor This is a PseudoPod for with an end directive. =end EOPOD is($results, <<'EOTXT', "a for with an '=end' directive"); This is a PseudoPod for with an end directive. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin text This is a dummy begin block. =end text EOPOD is($results, <<"EOTXT", "a simple 'begin' block"); This is a dummy begin block. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin sidebar Title Text This is the text of the sidebar. =end sidebar EOPOD is($results, <<'EOTXT', "a sidebar with a title"); Sidebar: Title Text This is the text of the sidebar. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a link anchorZ. EOPOD is($results, <<"EOTXT", "Link anchor entity in a paragraph"); A plain paragraph with a link anchor. EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOTXT', "a simple table"); Cell 1 | Cell 2 | EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table An Example Table =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOTXT', "a table with a title"); Table: An Example Table Cell 1 | Cell 2 | EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table =headrow =row =cell Header 1 =cell Header 2 =bodyrows =row =cell Cell 1 =cell Cell 2 =end table EOPOD is($results, <<'EOTXT', "a table with a header row"); Header 1 | Header 2 | Cell 1 | Cell 2 | EOTXT initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin table =row =cell This is a really, really long cell. So long, in fact that it wraps right around. =cell Cell 2 =end table EOPOD is($results, <<'EOTXT', "lines in cells are wrapped"); This is a really, really long cell. So long, in fact that it wraps right around. | Cell 2 | EOTXT TODO: { local $TODO = "X<> codes get replaced with a space instead of nothing"; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =head2 Title Text X X This is some text after some X codes. Does it get indented oddly? How about the next paragraph? EOPOD is($results, <<'EOTXT', "Z<> and X<> codes in a paragraph"); Title Text This is some text after some X codes. Does it get indented oddly? How about the next paragraph? EOTXT }; # TODO ###################################### sub initialize { $_[0] = Pod::PseudoPod::Text->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-PseudoPod-0.18/t/basic.t000444001750001750 113411620337705 17042 0ustar00chromaticchromatic000000000000#!/usr/bin/perl -w # t/basic.t - check PseudoPod formatting codes and directives BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 12; use_ok('Pod::PseudoPod') or exit; my $object = Pod::PseudoPod->new (); isa_ok ($object, 'Pod::PseudoPod'); is ($object->{'accept_codes'}->{'F'}, 'F', 'standard formatting codes allowed'); for my $code ('A', 'G', 'H', 'M', 'N', 'R', 'T', 'U') { is ($object->{'accept_codes'}->{$code}, $code, "extra formatting code $code allowed"); } is ($object->{'accept_directives'}->{'head0'}, 'Plain', 'extra directives allowed');