r35245 - in /trunk/libhtml-wikiconverter-perl: ./ cgi/ debian/ lib/HTML/ lib/HTML/WikiConverter/ t/

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Tue May 12 10:44:45 UTC 2009


Author: eloy
Date: Tue May 12 10:44:40 2009
New Revision: 35245

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35245
Log:
new upstream version

Added:
    trunk/libhtml-wikiconverter-perl/cgi/
      - copied from r35244, branches/upstream/libhtml-wikiconverter-perl/current/cgi/
    trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter/WebApp.pm
      - copied unchanged from r35244, branches/upstream/libhtml-wikiconverter-perl/current/lib/HTML/WikiConverter/WebApp.pm
    trunk/libhtml-wikiconverter-perl/t/01-normalizer.t
      - copied unchanged from r35244, branches/upstream/libhtml-wikiconverter-perl/current/t/01-normalizer.t
    trunk/libhtml-wikiconverter-perl/webapp-install
      - copied unchanged from r35244, branches/upstream/libhtml-wikiconverter-perl/current/webapp-install
Modified:
    trunk/libhtml-wikiconverter-perl/Changes
    trunk/libhtml-wikiconverter-perl/INSTALL
    trunk/libhtml-wikiconverter-perl/MANIFEST
    trunk/libhtml-wikiconverter-perl/META.yml
    trunk/libhtml-wikiconverter-perl/Makefile.PL
    trunk/libhtml-wikiconverter-perl/README
    trunk/libhtml-wikiconverter-perl/debian/changelog
    trunk/libhtml-wikiconverter-perl/debian/control
    trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter.pm
    trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter/Normalizer.pm
    trunk/libhtml-wikiconverter-perl/t/01-wikiconverter.t

Modified: trunk/libhtml-wikiconverter-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/Changes?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/Changes (original)
+++ trunk/libhtml-wikiconverter-perl/Changes Tue May 12 10:44:40 2009
@@ -1,4 +1,44 @@
 # Change log for HTML::WikiConverter
+
+version: 0.68
+date: 2009-03-21
+changes:
+  - (bug #20594) require CSS.pm version 1.07 to fix some 'make test'
+    errors (eg, DokuWiki)
+  - improve some documentation
+
+version: 0.67
+date: 2009-03-16
+changes:
+  - add 'p_strict' attribute for enabling/disabling
+    HTML::TreeBuilder's p_strict option (enabled by default) -- this
+    was done for the Markdown dialect, specifically for bug #43997
+  - mention XML::Writer requirement in README if cgi app is installed
+  - webapp-install script creates webapp directory if necessary
+  - miscellaneous minor code cleanup
+
+version: 0.66
+date: 2009-03-07
+changes:
+  - fix test suite: change html2wiki/test.html to
+    html2wiki-old/test.html
+  - rudimentary webapp-install script
+
+version: 0.65
+date:    2009-03-07
+changes:
+  - web app fixes: comment-out the donation link in
+    templates/main.html, improved docs in cgi/index.cgi
+
+version: 0.64
+date:    2009-03-06
+changes:
+  - add web application, HTML::WikiConverter::WebApp
+  - now requires CGI::Application (for the aforementioned web app)
+  - (bug #40845, debian #506584) allow relative wiki_uri (eg,
+    "/wiki/"); an absolute wiki_uri is constructed from a relative
+    wiki_uri and a base_uri
+  - add perl license to Makefile.PL
 
 version: 0.63
 date:    2008-11-11
@@ -9,8 +49,9 @@
 version: 0.62
 date:    2008-05-16
 changes:
-  - blocked elements are not blocked if they are contained within a blocked element
-    (with much thanks to Dominick Bellizzi for the patch)
+  - blocked elements are not blocked if they are contained within a
+    blocked element (with much thanks to Dominick Bellizzi for the
+    patch)
   - rules_for_tag() now dereferences the 'alias' subrule
 
 version: 0.61
@@ -57,13 +98,16 @@
 version: 0.54
 date:    2006-06-07
 changes:
-  - (bug #19046) allow lone '0' in text (previously such strings were assumed empty)
-  - (bug #19046) element attributes must be containined on a single line
+  - (bug #19046) allow lone '0' in text (previously such strings were
+    assumed empty)
+  - (bug #19046) element attributes must be containined on a single
+    line
 
 version: 0.53
 date:    2006-06-03
 changes:
-  - revert "dialects now inherit via 'use HTML::WikiConverter -dialect;'" change
+  - revert "dialects now inherit via 'use HTML::WikiConverter
+    -dialect;'" change
   - lots of documentation tweaks
   - allow attributes in html2wiki()
   - add 'remove_empty' attribute (requires HTML::Tagset)
@@ -139,13 +183,17 @@
 version: 0.30
 date:    2005-06-03
 changes:
-  - add support for WakkaWiki, SnipSnap, Oddmuse, and TikiWiki (see http://c2.com/cgi/wiki?TopTenWikiEngines)
+  - add support for WakkaWiki, SnipSnap, Oddmuse, and TikiWiki (see
+    http://c2.com/cgi/wiki?TopTenWikiEngines)
   - add DokuWiki support for links, blockquotes, images, and tables
-  - add 'strip_scripts', 'strip_head', and 'strip_comments' options, on by default
-  - allow 'start' and 'end' rules to be specified with 'preserve' to allow for wiki escaping
+  - add 'strip_scripts', 'strip_head', and 'strip_comments' options,
+    on by default
+  - allow 'start' and 'end' rules to be specified with 'preserve' to
+    allow for wiki escaping
   - allow reading from HTML files using "html2wiki( file => ... )"
   - (bug 12944, 12303) preserve HTML entities in text nodes
-  - (bug 13017) MediaWiki should allow <i> and <b> to be preserved rather than converting to '' and '''
+  - (bug 13017) MediaWiki should allow <i> and <b> to be preserved
+    rather than converting to '' and '''
   - backend API changes; dialect modules now subclass HTML::WikiConverter
   - dialects specify their attributes using the attributes() method
   - more complete tests using larger input HTML file
@@ -160,14 +208,18 @@
   - (bug 12440) add 'empty' rule for elements with no content
   - (bug 12439) unknown HTML elements no longer ignored
   - (bug 12396) added command line tool bin/html2wiki
-  - (bug 12395) MoinMoin: added postprocessing step in MoinMoin dialect to replace "URL[[BR]]" with "URL [[BR]]"
-  - (bug 12433) MediaWiki: added complete set of whitelisted tags and attributes from Sanitizer.php
+  - (bug 12395) MoinMoin: added postprocessing step in MoinMoin
+    dialect to replace "URL[[BR]]" with "URL [[BR]]"
+  - (bug 12433) MediaWiki: added complete set of whitelisted tags and
+    attributes from Sanitizer.php
 
 version: 0.22
 date:    2005-04-25
 changes:
-  - (bug 12393) added 'wrap_in_html' option to wrap HTML input in <html> and </html> prior to wiki conversion
-  - (bug 12303) MediaWiki: bracketed content is nowiki-escaped if it resembles an external link reference
+  - (bug 12393) added 'wrap_in_html' option to wrap HTML input in
+    <html> and </html> prior to wiki conversion
+  - (bug 12303) MediaWiki: bracketed content is nowiki-escaped if it
+    resembles an external link reference
   - (bug 12438) PmWiki: add <td> whitespace trimming
 
 version: 0.21
@@ -179,8 +231,10 @@
   - add get_attr_str() and get_wiki_page() utility methods
   - rename elem_contents() to get_elem_contents() for consistency
   - added support for PmWiki
-  - fix postprocess whitespace trimming bug; only leading newlines and trailing whitespace is trimmed
-  - add URI 1.35 requirement (though some earlier versions will probably work)
+  - fix postprocess whitespace trimming bug; only leading newlines and
+    trailing whitespace is trimmed
+  - add URI 1.35 requirement (though some earlier versions will
+    probably work)
   - fix whitespace trimming in test suite
   - added new tests
   - Kwiki-specific changes:
@@ -214,16 +268,21 @@
   - remove warnings reported by cpan testers
   - lots of documentation additions
   - MediaWiki changes:
-      - 'wikify_span' now removes elements intended only for URL expansion (as used by the MonoBook skin)
-      - 'wikify_link' does not wikify anchor tags (i.e. A tags must have an HREF attribute)
-      - bug fix: table heading markup like "! bgcolor=black !" is now properly generated as "! bgcolor=black |"
+      - 'wikify_span' now removes elements intended only for URL
+        expansion (as used by the MonoBook skin)
+      - 'wikify_link' does not wikify anchor tags (i.e. A tags must
+        have an HREF attribute)
+      - bug fix: table heading markup like "! bgcolor=black !" is now
+        properly generated as "! bgcolor=black |"
       - TH now accepts a colspan and rowspan attribute
-      - "colspan=1" attribute is now stripped from table cells that only span a single column. Likewise for "rowspan"
+      - "colspan=1" attribute is now stripped from table cells that
+        only span a single column. Likewise for "rowspan"
       - added "taxo_format" option to help format taxoboxes
       - align attribute is now preserved in TH and TD
       - add "add_nowiki" parameter for adding NOWIKI tags around {{messages}}
       - table caption handling using "|+" wiki table markup
-      - better nested table handling; a newline is now added before the "{|" for nested tables
+      - better nested table handling; a newline is now added before
+        the "{|" for nested tables
       - improved handling of image thumbnails
       - now uses warnings, strict
 
@@ -231,16 +290,21 @@
 date:    2004-05-28
 changes:
   - Added 'elem_style_attr_props' method for parsing the STYLE attribute
-  - Tags that are meant to be stripped (e.g. HTML, META, HEAD) no longer need an empty replacement handler (they can simply be excluded from the list of tag handlers)
-  - Added handling of non-breaking elements (e.g. in some dialects, such as MediaWiki, P tags should not have any embedded newlines)
+  - Tags that are meant to be stripped (e.g. HTML, META, HEAD) no
+    longer need an empty replacement handler (they can simply be
+    excluded from the list of tag handlers)
+  - Added handling of non-breaking elements (e.g. in some dialects,
+    such as MediaWiki, P tags should not have any embedded newlines)
   - Fixed whitespace handling in H::W::Dialect
   - Documentation additions
   - Added benchmarking option
   - MediaWiki: added colspan and rowspan to allowed TD attrs
-  - MW: Now supports 'pretty_tables' option for making nice borders/shading
+  - MW: Now supports 'pretty_tables' option for making nice
+    borders/shading
   - MW: Removed arbitrary 20-char limit in conversion of {{...}} magic
   - MW: "[1]"-style links are now handled properly
-  - MW: Hex codes/HTML entities in URLs now translated to appropriate char (requires URI::Escape)
+  - MW: Hex codes/HTML entities in URLs now translated to appropriate
+    char (requires URI::Escape)
   - MW: Major list handling cleanup and bug fixes
   - MW: Added new realworld test (my User: page)
 
@@ -249,7 +313,8 @@
 changes:
   - Split module into several separate modules
   - HTML::WikiConverter is still the main interface
-  - Added support for wiki dialects via HTML::WIkiConverter::Dialect interface
+  - Added support for wiki dialects via HTML::WIkiConverter::Dialect
+    interface
   - Added HTML::WikiConverter::Dialect
   - Added HTML::WikiConverter::Dialect::MediaWiki
   - Added HTML::WikiConverter::Dialect::PhpWiki
@@ -263,7 +328,9 @@
 changes:
   - 'wikify_default' now called 'passthru'
   - NOWIKI blocks are no longer preserved
-  - Bug fix: Add newline to HTML source before wikification -- avoids apparent bugs in HTML::TreeBuilder that prevent proper tag handling
+  - Bug fix: Add newline to HTML source before wikification -- avoids
+    apparent bugs in HTML::TreeBuilder that prevent proper tag
+    handling
   - Added trim method
   - Bug fix: Extra whitespace in PRE blocks no longer trimmed
   - Can now handle "[[language]]s" links (with trailing characters)
@@ -271,21 +338,27 @@
 version: 0.12
 date:    2004-05-14
 changes:
-  - Bug fix: removed reference to non-existent 'has_parent' method within '_elem_has_ancestor' function
-  - Bug fix: fixed potential bug in 'wikify_list_item' which used $node->parent->tag eq '...' instead of _elem_has_ancestor($node, '...')
+  - Bug fix: removed reference to non-existent 'has_parent' method
+    within '_elem_has_ancestor' function
+  - Bug fix: fixed potential bug in 'wikify_list_item' which used
+    $node->parent->tag eq '...' instead of _elem_has_ancestor($node,
+    '...')
   - Now supports definition lists via ; and :
   - Now supports indentation via :
   - Replaced code handler for P tag with flank handler
   - Replaced code handler for OL/UL tags with flank handlers
-  - Renamed 'wikify_heading' method to 'wikify_h' for consistency with other wikify_* handlers
+  - Renamed 'wikify_heading' method to 'wikify_h' for consistency with
+    other wikify_* handlers
   - NOWIKI blocks are now preserved
-  - Introduced beginnings of Unicode support with the use of HTML entities to HTML-escape high-bit characters
+  - Introduced beginnings of Unicode support with the use of HTML
+    entities to HTML-escape high-bit characters
   - Added more tests to t/test.t
 
 version: 0.11
 date:    2004-05-10
 changes:
-  - added wikify_default code handler for tags that should be preserved.
+  - added wikify_default code handler for tags that should be
+    preserved.
   - Added wikify_span
   - Now preserves FONT, SUP, and SUB tags
   - SPAN tags are converted into FONT if possible

Modified: trunk/libhtml-wikiconverter-perl/INSTALL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/INSTALL?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/INSTALL (original)
+++ trunk/libhtml-wikiconverter-perl/INSTALL Tue May 12 10:44:40 2009
@@ -1,5 +1,5 @@
-HTML::WikiConverter installation instructions
-=============================================
+HTML::WikiConverter installation
+================================
 
 HTML::WikiConverter is an HTML to wiki converter capable of converting
 HTML source into a variety of wiki dialects. It's aimed at folks who
@@ -38,3 +38,62 @@
 
   % perl Makefile.PL PREFIX=~/myperl5
   % make && make test && make install
+
+Installing the web application
+==============================
+
+Included in this distribution is HTML::WikiConverter::WebApp, which is
+a CGI::Application-based web application that interfaces with
+HTML::WikiConverter and any installed dialects. (Note that you will
+need to have CGI::Application installed to use this feature.)
+
+The H::WC::WebApp module is installed automatically. The remaining
+files necessary for the web application are in the cgi/ directory. To
+install these files, first follow the basic installation instructions
+above. Next, copy the cgi/ directory to your cgi-bin/ directory,
+provide a suitable value for the 'template_path' variable in the
+provided index.cgi instance script, and assign appropriate
+permissions.
+
+These steps can all be accomplished via the included webapp-install
+script, which is excuted like so:
+
+  % ./webapp-install
+
+When complete, be sure to stop and restart your Apache server:
+
+  % sudo apachectl stop
+  % sudo apachectl start
+
+If the webapp-install script does not work or you choose not to use
+it, you may also install the web application by hand. (This is
+essentially what the webapp-install script does.)
+
+1) Copy the cgi/ directory to your cgi-bin/ directory:
+
+  % cp -r cgi /var/www/cgi-bin/html2wiki
+
+2) Assign appropriate permissions:
+
+  % chmod 655 /var/www/cgi-bin/html2wiki/index.cgi
+  % chmod a+r /var/www/cgi-bin/html2wiki/templates/*
+
+3) Edit the index.cgi instance script to provide a suitable template
+path, replacing __PATH_TO_TEMPLATES__ with the location of the
+cgi/templates/ folder:
+
+  # Inside /var/www/cgi-bin/html2wiki/index.cgi:
+  my %config = (
+    template_path => '/var/www/cgi-bin/html2wiki/templates',
+  );
+
+4) Restart your Apache server as appropriate.
+
+5) The template filler should then be available via a standard URL:
+
+  http://www.yourhost.com/cgi-bin/html2wiki/index.cgi
+
+Author
+======
+
+David J. Iberri <diberri at cpan.org>

Modified: trunk/libhtml-wikiconverter-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/MANIFEST?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/MANIFEST (original)
+++ trunk/libhtml-wikiconverter-perl/MANIFEST Tue May 12 10:44:40 2009
@@ -8,9 +8,16 @@
 lib/HTML/WikiConverter.pm
 lib/HTML/WikiConverter/Dialects.pod
 lib/HTML/WikiConverter/Normalizer.pm
+lib/HTML/WikiConverter/WebApp.pm
 t/00-load.t
+t/01-normalizer.t
 t/01-wikiconverter.t
 t/boilerplate.t
 t/pod-coverage.t
 t/pod.t
 bin/html2wiki
+cgi/index.cgi
+cgi/templates/main.html
+cgi/templates/sample_html.html
+cgi/templates/stylesheet.css
+webapp-install

Modified: trunk/libhtml-wikiconverter-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/META.yml?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/META.yml (original)
+++ trunk/libhtml-wikiconverter-perl/META.yml Tue May 12 10:44:40 2009
@@ -1,23 +1,32 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         HTML-WikiConverter
-version:      0.63
-version_from: lib/HTML/WikiConverter.pm
-installdirs:  site
+--- #YAML:1.0
+name:               HTML-WikiConverter
+version:            0.68
+abstract:           Convert HTML to wiki markup
+author:
+    - David J. Iberri <diberri at cpan.org>
+license:            perl
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    Carp:                          0
-    Class::Data::Inheritable:      0.02
-    CSS:                           0
-    Exporter:                      0
-    HTML::Element:                 0
-    HTML::Entities:                1.27
-    HTML::Tagset:                  3.04
-    HTML::Tree:                    3.18
-    Params::Validate:              0.77
-    Pod::Usage:                    1.16
-    Test::More:                    0
-    URI:                           1.35
-    URI::Escape:                   0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+    Carp:                 0
+    Class::Data::Inheritable:  0.02
+    CSS:                  1.07
+    Exporter:             0
+    HTML::Element:        0
+    HTML::Entities:       1.27
+    HTML::Tagset:         3.04
+    HTML::Tree:           3.18
+    Params::Validate:     0.77
+    Pod::Usage:           1.16
+    Test::More:           0
+    URI:                  1.35
+    URI::Escape:          0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.48
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: trunk/libhtml-wikiconverter-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/Makefile.PL?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/Makefile.PL (original)
+++ trunk/libhtml-wikiconverter-perl/Makefile.PL Tue May 12 10:44:40 2009
@@ -5,24 +5,25 @@
 WriteMakefile(
     NAME                => 'HTML::WikiConverter',
     AUTHOR              => 'David J. Iberri <diberri at cpan.org>',
+    LICENSE             => 'perl',
     VERSION_FROM        => 'lib/HTML/WikiConverter.pm',
     ABSTRACT_FROM       => 'lib/HTML/WikiConverter.pm',
     PL_FILES            => {},
     EXE_FILES           => [ 'bin/html2wiki' ],
     PREREQ_PM => {
-        'Test::More'     => 0,
-        'HTML::Tree'     => 3.18,
-        'HTML::Element'  => 0,
-        'CSS'            => 0,
-        'URI'            => 1.35,
-        'Pod::Usage'     => 1.16,
-        'URI::Escape'    => 0,
-        'HTML::Entities' => 1.27,
-        'HTML::Tagset'   => 3.04,
+        'Test::More'       => 0,
+        'HTML::Tree'       => 3.18,
+        'HTML::Element'    => 0,
+        'CSS'              => 1.07, # (bug #20594)
+        'URI'              => 1.35,
+        'Pod::Usage'       => 1.16,
+        'URI::Escape'      => 0,
+        'HTML::Entities'   => 1.27,
+        'HTML::Tagset'     => 3.04,
         'Params::Validate' => 0.77,
         'Class::Data::Inheritable' => 0.02,
-        'Exporter' => 0,
-        'Carp' => 0,
+        'Exporter'         => 0,
+        'Carp'             => 0,
     },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'HTML-WikiConverter-*' },

Modified: trunk/libhtml-wikiconverter-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/README?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/README (original)
+++ trunk/libhtml-wikiconverter-perl/README Tue May 12 10:44:40 2009
@@ -1,5 +1,5 @@
-HTML::WikiConverter version
-===========================
+HTML::WikiConverter readme
+==========================
 
 HTML::WikiConverter is an HTML to wiki converter capable of converting
 HTML source into a variety of wiki dialects. It's aimed at folks who
@@ -8,6 +8,7 @@
 The following dialects (and more) are supported:
 
   DokuWiki
+  GoogleCode
   Kwiki
   Markdown
   MediaWiki
@@ -17,6 +18,7 @@
   PhpWiki
   PmWiki
   SnipSnap
+  Socialtext
   TikiWiki
   UseMod
   WakkaWiki
@@ -24,10 +26,10 @@
 
 INSTALLATION
 
-The HTML::WikiConverter module is just an interface; to actually
-perform HTML-to-wiki conversion, you can either install individual
-dialect modules (see below) or install Bundle::HTMLWikiConverter to
-get all of the dialect modules in one shot:
+The HTML::WikiConverter module is just an interface; you must select
+the wiki dialects you would like to use. You may install dialect
+modules individually (see below) or install Bundle::HTMLWikiConverter
+to get most of the dialect modules in one shot:
 
   % perl -MCPAN -e 'install Bundle::HTMLWikiConverter'
 
@@ -50,15 +52,22 @@
 
 The included html2wiki utility converts on the command line:
 
-  % html2wiki --dialect MediaWiki input.html > output.mw
+  % html2wiki --dialect MediaWiki \
+              --base-uri http://en.wikipedia.org \
+              --wiki-uri /wiki/ \
+              input.html > output.mw
 
-There's also a web interface if you're so inclined:
-
-  http://diberri.dyndns.org/wikipedia/html2wiki/
+A web application is also provided with this distribution, called
+HTML::WikiConverter::WebApp. It provides a web interface to this
+module and any installed dialects. Detailed instructions on
+installation and usage are provided in the INSTALL file.
 
 PREREQUISITES
 
+The following are required for a basic installation:
+
   * Test::More
+  * Pod::Usage
   * Class::Data::Inheritable
   * Params::Validate
   * URI and URI::Escape
@@ -67,6 +76,10 @@
   * HTML::Entities
   * HTML::Element
   * CSS
+
+CGI::Application and XML::Writer are required if you will be using the
+installed web application, HTML::WikiConverter::WebApp. (My apologies;
+I'll make them optional in a future release.)
 
 BUGS
 

Modified: trunk/libhtml-wikiconverter-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/debian/changelog?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/debian/changelog (original)
+++ trunk/libhtml-wikiconverter-perl/debian/changelog Tue May 12 10:44:40 2009
@@ -1,3 +1,11 @@
+libhtml-wikiconverter-perl (0.68-1) UNRELEASED; urgency=low
+
+  * (NOT RELEASED YET) New upstream release
+  * Standards-Version: 3.8.1
+  * Added me
+
+ -- Krzysztof Krzyżaniak (eloy) <eloy at debian.org>  Tue, 12 May 2009 12:40:57 +0200
+
 libhtml-wikiconverter-perl (0.63-1) UNRELEASED; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libhtml-wikiconverter-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/debian/control?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/debian/control (original)
+++ trunk/libhtml-wikiconverter-perl/debian/control Tue May 12 10:44:40 2009
@@ -4,8 +4,10 @@
 Build-Depends: cdbs (>= 0.4.39), devscripts (>= 2.10.7), quilt, patchutils (>= 0.2.25), dh-buildinfo, debhelper (>= 5.0.44), perl (>= 5.6.0-16), libhtml-tree-perl (>= 3.18), libcss-perl, liburi-perl (>= 1.35), libhtml-parser-perl, libhtml-tagset-perl, libparams-validate-perl (>= 0.77), libclass-data-accessor-perl (>= 0.02), libtest-simple-perl, libtest-pod-perl (>= 1.14), libtest-pod-coverage-perl (>= 1.04)
 Build-conflicts: libwww-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Jonas Smedegaard <dr at jones.dk>, Rene Mayorga <rmayorga at debian.org>
-Standards-Version: 3.7.3
+Uploaders: Jonas Smedegaard <dr at jones.dk>, 
+  Rene Mayorga <rmayorga at debian.org>, 
+  Krzysztof Krzyżaniak (eloy) <eloy at debian.org>
+Standards-Version: 3.8.1
 Vcs-Svn: svn://svn.debian.org/collab-maint/deb-maint/libhtml-wikiconverter-perl/trunk
 Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/libhtml-wikiconverter-perl/trunk
 Homepage: http://diberri.dyndns.org/wikipedia/html2wiki/

Modified: trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter.pm?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter.pm (original)
+++ trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter.pm Tue May 12 10:44:40 2009
@@ -15,7 +15,7 @@
 use URI::Escape;
 use URI;
 
-our $VERSION = '0.63';
+our $VERSION = '0.68';
 our $AUTOLOAD;
 
 =head1 NAME
@@ -76,7 +76,7 @@
 Returns a converter for the specified wiki dialect. Croaks if
 C<$dialect> is not provided or its dialect module is not installed on
 your system. Additional attributes may be specified in C<%attrs>; see
-L</"ATTRIBUTES"> for a list of recognized attributes.
+L</"ATTRIBUTES"> for a complete list.
 
 =cut
 
@@ -97,7 +97,8 @@
   foreach my $dialect_class ( @dialect_classes ) {
     return $dialect_class->new( %opts ) if eval "use $dialect_class; 1" or $dialect_class->isa($pkg);
   }
-  croak "Dialect '$opts{dialect}' could not be loaded (tried @dialect_classes). Error: $@";
+  my $dc_list = join ', ', @dialect_classes;
+  croak "Dialect '$opts{dialect}' could not be loaded (tried $dc_list). Error: $@";
 }
 
 sub __setup {
@@ -195,6 +196,7 @@
 sub html2wiki {
   my $self = shift;
 
+  # Assumes that if @_ is odd-numbered, its first element is html
   my %args = @_ % 2 ? ( html => +shift, @_ ) : @_;
 
   my %common_arg_errors = ( url => 'uri', base_url => 'base_uri', wiki_url => 'wiki_uri' );
@@ -223,7 +225,7 @@
 
   my $tree = new HTML::TreeBuilder();
   $tree->store_comments(1);
-  $tree->p_strict(1);
+  $tree->p_strict( $self->p_strict );
   $tree->implicit_body_p_tag(1);
   $tree->ignore_unknown(0); # <ruby> et al
 
@@ -294,7 +296,7 @@
     # Unspecified tags have their whitespace preserved (this allows
     # 'html' and 'body' tags [among others] to keep formatting when
     # inner tags like 'pre' need to preserve whitespace).
-    my $trim = exists $rules->{trim} ? $rules->{trim} : 'none'; # can't this just be $rules->{trim} || 'none'?
+    my $trim = $rules->{trim} || 'none';
     $output =~ s/^\s+// if $trim eq 'both' or $trim eq 'leading';
     $output =~ s/\s+$// if $trim eq 'both' or $trim eq 'trailing';
 
@@ -419,7 +421,7 @@
     $self->__rm_invalid_text($node);
     $node->delete, next if $self->strip_empty_tags and !$allowedEmptyTag{$node->tag} and $self->__elem_is_empty($node);
     $self->__encode_entities($node) if $node->tag eq '~text' and $self->escape_entities;
-    $self->__rel2abs($node) if $self->base_uri and $rel2abs{$node->tag};
+    $self->__rel2abs($node) if $self->base_uri and exists $rel2abs{$node->tag};
     $self->preprocess_node($node);
   }
 
@@ -444,7 +446,7 @@
   return @tags;
 }
 
-# XXX: see http://rt.cpan.org/Ticket/Display.html?id=28402
+# (bug #28402)
 sub __default_passthrough_naked_tags { qw/ tbody thead span div font / }
 
 sub __elem_is_empty {
@@ -590,6 +592,7 @@
   $self->__rules( $self->rules );
 }
 
+# Rules for validating rules
 my %meta_rules = (
   trim        => { range => [ qw/ none both leading trailing / ] },
   line_format => { range => [ qw/ none single multi blocks / ] },
@@ -646,7 +649,7 @@
   my( $self, $uri ) = @_;
   my @wiki_uris = ref $self->wiki_uri eq 'ARRAY' ? @{$self->wiki_uri} : $self->wiki_uri;
   foreach my $wiki_uri ( @wiki_uris ) {
-    my $page = $self->__extract_wiki_page( $uri => $wiki_uri );
+    my $page = $self->__extract_wiki_page( $uri, $wiki_uri );
     return $page if $page;
   }
 
@@ -662,6 +665,9 @@
   } elsif( ref $wiki_uri eq 'CODE' ) {
     return $wiki_uri->( $self, URI->new($uri) );
   } else {
+    # Ensure $wiki_uri is absolute
+    $wiki_uri = URI->new_abs( $wiki_uri, $self->base_uri )->as_string;
+
     return undef unless index( $uri, $wiki_uri ) == 0;
     return undef unless length $uri > length $wiki_uri;
     return substr( $uri, length $wiki_uri );
@@ -723,12 +729,18 @@
 sub available_dialects {
   my @dialects;
 
+  my %seen;
   for my $inc ( @INC ) {
     my $dir = File::Spec->catfile( $inc, 'HTML', 'WikiConverter' );
     my $dh  = DirHandle->new( $dir ) or next;
     while ( my $f = $dh->read ) {
       next unless $f =~ /^(\w+)\.pm$/;
-      push @dialects, $1 unless $1 eq 'Normalizer';
+      my $dialect = $1;
+
+      next if $seen{$dialect}++;
+      next if $dialect eq 'Normalizer' or $dialect eq 'WebApp';
+
+      push @dialects, $dialect;
     }
   }
 
@@ -793,10 +805,16 @@
 
 =head2 escape_entities
 
-Potentially unsafe characters found within text nodes can be
-automatically encoded into their corresponding HTML entities, a
-feature enabled by giving the C<escape_entities> a true value.
+Passing C<escape_entities> a true value uses L<HTML::Entities> to
+encode potentially unsafe 'E<lt>', 'E<gt>', and 'E<amp>' characters.
 Defaults to true.
+
+=head2 p_strict
+
+Boolean indicating whether L<HTML::TreeBuilder> will use strict
+handling of paragraph tags when parsing HTML input. (This corresponds
+to the C<p_strict> method in the L<HTML::TreeBuilder> module.) Enabled
+by default.
 
 =head2 passthrough_naked_tags
 
@@ -855,11 +873,16 @@
 or coderef. The default is C<undef>, meaning that all links will be
 treated as external links by default.
 
-If C<wiki_uri> is a string, it is assumed that URIs to wiki pages are
-created by joining the C<wiki_uri> with the wiki page title. For
-example, the English Wikipedia might use
-C<"http://en.wikipedia.org/wiki/"> as the value of C<wiki_uri>. Ward's
-wiki might use C<"http://c2.com/cgi/wiki?">. 
+If C<wiki_uri> is a string, it is interpreted as a URI template, and
+it will be assumed that URIs to wiki pages are created by joining
+C<wiki_uri> with the wiki page title. For example, the English
+Wikipedia might use C<"http://en.wikipedia.org/wiki/"> as the value of
+C<wiki_uri>. Ward's wiki might use C<"http://c2.com/cgi/wiki?">. These
+examples use an absolute C<wiki_uri>, but a relative URI can be used
+as well; an absolute URI will be created based on the value of
+C<base_uri>. For example, the Wikipedia example above can be rewritten
+using C<base_uri> of C<"http://en.wikipedia.org"> and a C<wiki_uri> of
+C<"/wiki/">.
 
 C<wiki_uri> can also be a regexp that matches URIs to wiki pages and
 also extracts the page title from them. For example, the English
@@ -899,6 +922,7 @@
   encoding         => { type => SCALAR, default => 'utf-8' },
   escape_entities  => { type => BOOLEAN, default => 1 },
   normalize        => { type => BOOLEAN, default => 1 },
+  p_strict         => { type => BOOLEAN, default => 1 },
   preprocess       => { type => CODEREF | UNDEF, default => undef },
   strip_empty_tags => { type => BOOLEAN, default => 0 },
   slurp            => { type => BOOLEAN, default => 0 },

Modified: trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter/Normalizer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter/Normalizer.pm?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter/Normalizer.pm (original)
+++ trunk/libhtml-wikiconverter-perl/lib/HTML/WikiConverter/Normalizer.pm Tue May 12 10:44:40 2009
@@ -132,7 +132,15 @@
   { type => 'css',  name => 'text-decoration', value => 'underline', new_tag => 'u' },
   { type => 'css',  name => 'font-style', value => 'italic', new_tag => 'i' },
   { type => 'attr', name => 'align', value => 'center', tag => [ qw/ div p / ], new_tag => 'center' },
+
+#  { type => 'attr', tag =>  'font', attr => 'size', value => '*', new_tag => 'span', style => 'font-size' },
 ] }
+
+sub _new_handlers {
+  span_to_font => {
+    xpath => '//[@style[contains(., "font-size")]]',
+  },
+}
 
 sub _normalize_color {
   my( $self, $color ) = @_;

Modified: trunk/libhtml-wikiconverter-perl/t/01-wikiconverter.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-wikiconverter-perl/t/01-wikiconverter.t?rev=35245&op=diff
==============================================================================
--- trunk/libhtml-wikiconverter-perl/t/01-wikiconverter.t (original)
+++ trunk/libhtml-wikiconverter-perl/t/01-wikiconverter.t Tue May 12 10:44:40 2009
@@ -1,6 +1,6 @@
 #!perl -T
 
-package HTML::WikiConverter::MyPerfectWiki;
+package MyPerfectWiki;
 use base 'HTML::WikiConverter';
 
 sub rules {
@@ -71,7 +71,7 @@
 
 package main;
 
-use Test::More tests => 51;
+use Test::More tests => 53;
 use HTML::WikiConverter;
 
 my $have_lwp = eval "use LWP::UserAgent; 1";
@@ -153,18 +153,20 @@
 
 is( $wc4->html2wiki( html => '&lt;', escape_entities => 0 ), '<', "don't escape entities" );
 is( $wc4->html2wiki( html => '&lt;', escape_entities => 1 ), '&lt;', "escape entities" );
+is( $wc4->html2wiki( html => '&lt;' ), '&lt;', "escape_entities is enabled by default" );
 
 SKIP: {
   skip "LWP::UserAgent required for testing how content is fetched from URIs" => 4 unless $have_lwp;
-
-  is( $wc4->html2wiki( uri => 'http://diberri.dyndns.org/wikipedia/html2wiki/test.html', strip_tags => ['head'] ), '**test**', 'fetch uri, no ua' );
+  skip "Couldn't fetch test website http://www.perl.org. Perhaps you don't have internet access?" => 4 unless LWP::UserAgent->new->get('http://www.perl.org')->is_success;
+
+  is( $wc4->html2wiki( uri => 'http://diberri.dyndns.org/wikipedia/html2wiki-old/test.html', strip_tags => ['head'] ), '**test**', 'fetch uri, no ua' );
   is( $wc4->user_agent->agent, $wc4->__default_ua_string, 'using default ua' );
 
   my $ua_agent = 'html2wiki-test/0.5x';
   my $ua = new LWP::UserAgent( agent => $ua_agent );
   $wc4->user_agent($ua);
 
-  is( $wc4->html2wiki( uri => 'http://diberri.dyndns.org/wikipedia/html2wiki/test.html', strip_tags => ['head'] ), '**test**', 'fetch uri w/ ua' );
+  is( $wc4->html2wiki( uri => 'http://diberri.dyndns.org/wikipedia/html2wiki-old/test.html', strip_tags => ['head'] ), '**test**', 'fetch uri w/ ua' );
   is( $wc4->user_agent->agent, $ua_agent, 'using user-specified ua' );
 };
 
@@ -196,3 +198,5 @@
 is( $wc->html2wiki( html => qq{
 <table><tr><td><p>p1</p><p>p2</p></td></tr></table>
 } ), "p1\n\np2", 'table p1 p2' );
+
+is( $wc->html2wiki( html => '<a href="/wiki/Test">Test page</a>', base_uri => 'http://www.example.com', wiki_uri => '/wiki/' ), '[[Test|Test page]]', 'absolute wiki_uri from relative wiki_uri and base_uri' );




More information about the Pkg-perl-cvs-commits mailing list