r45345 - in /trunk/libtext-markdown-perl: Changes META.yml README Todo debian/changelog lib/Text/Markdown.pm

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Oct 4 13:38:21 UTC 2009


Author: jawnsy-guest
Date: Sun Oct  4 13:38:13 2009
New Revision: 45345

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

Modified:
    trunk/libtext-markdown-perl/Changes
    trunk/libtext-markdown-perl/META.yml
    trunk/libtext-markdown-perl/README
    trunk/libtext-markdown-perl/Todo
    trunk/libtext-markdown-perl/debian/changelog
    trunk/libtext-markdown-perl/lib/Text/Markdown.pm

Modified: trunk/libtext-markdown-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-markdown-perl/Changes?rev=45345&op=diff
==============================================================================
--- trunk/libtext-markdown-perl/Changes (original)
+++ trunk/libtext-markdown-perl/Changes Sun Oct  4 13:38:13 2009
@@ -1,36 +1,177 @@
-This file documents the revision history for Perl extension Text::MultiMarkdown.
-
-1.0.0   2006-08-22T00:00:00
-        - first release
-
-1.0.1   2006-10-20T00:00:00
-        - include patch from Uwe Voelker to allow setting of options in
-          markdown(); also added a test case from Uwe. Thanks, Uwe!
-          Also updated changelog references in POD somewhat.
-
-1.0.2   2007-11-24T14:00:00
-        - move to Module::Install and clean various things up, mostly to make
-          CPANTS happy.
-
-1.0.3   2007-11-24T20:22:00
-        - way to keep me accountable, CPANTESTERS! Maybe I shouldn't have
-          Test::Pod::Coverage enabled unless it actually checks out. Added some
-          fairly useless stubbed METHODS to POD and moved POD around a bit.
-          
-1.0.4   2008-01-02T02:03:50
-        - Refactor so that the processor instance has the same set of        
-          persistent options as on the ->markdown method itself.
-        - Change all functions to be instance methods, moved a chunk of the 
-          global data to the instance. The rest will follow shortly.
-        - The test suite now tests a reasonable set of the Markdown and 
-          MultiMarkdown syntaxes.
-        - All known options and metadata keys have been documented.
-        
-1.0.5   2008-01-04T18:07:57
-        - Add Markdown and MultiMarkdown test suites.
-        - Fix a big bug introduced in 1.0.4 in citations
-        - Fix footnotes (and other small things) to match the test suite
-        
+This file documents the revision history for Perl extension Text::Markdown.
+
+1.0.26 2009-10-04T00:37:00
+        - Minor POD changes (typos, wrapping)
+        - Added note about and test for output always ending in exactly one newline (dandv)
+        - Fix RT#48943 + tests (genehack)
+        - Support for optionally interpreting markdown in HTML block elements
+          using the markdown="1" attribute (GitHub issue #1; dandv)
+
+1.0.25 2009-08-25T09:31:30
+        - Remove MultiMarkdown from the Text::Markdown distribution
+        - Change repository and bugtracker metadata to github.
+        - Update File::Slurp dependency, fixing RT#43888.
+
+1.0.24 2008-11-16T14:33:30
+        - Add trust_list_start_value patch from Ricardo Signes (RT#40814)
+          to enable <li value='X'> output for list numbering.
+          This feature is disabled by default.
+
+1.0.23 2008-11-02T18:24:30
+        - Ship a release with the correct contents so that the tests pass.
+
+1.0.22 2008-10-23T18:24:44
+        - RT#37909 - Fix + in email addresses.
+        - RT#40303 - Fix use in Mason by adding "use re 'eval'" to both files.
+        - Add SVN repository to Makefile.PL
+        - Remove META.yml from source control so it is regenerated 
+          automatically.
+
+1.0.21 2008-07-24T08:33:00
+        - Fix hard tabs in Changelog
+        - Add unit test for core dumps issue from RT#36203
+        - Fix POD spelling.
+        - Fix warning from RT#34856.
+        - Add test for another tab width issue (related to <hr> generation)
+          from RT#37769. Fix this issue.
+        - More test additions and more splitting the test suites into MDTest 
+          modules.
+
+1.0.20 2008-07-11T23:30:00
+        - Update README.txt
+        - Allow scripts to be used on multiple input files at once (processing 
+          in command line order)
+        - Update footnote behavior of Text::MutltiMarkdown to be consistent 
+          with the latest version of MultiMarkdown
+        - Added tests for the new footnote functionality.
+        - Added tests for all the MDTest corner cases brought up on the list. 
+          Noted why / how I differ from original Markdown.
+        - Moved all the document tests to MDTest format. I have made MDTest 
+          test suites for Text::Markdown and Text::MultiMarkdown, containing 
+          **only** the bug fixes and behavior changes I've made, I've imported 
+          the Markdown test suite from MDTest1.1, and the MultiMarkdown test
+          suite.
+        - RT#36537 doc patch to add POD to the scripts from Debian's Gunnar 
+          Wolf.
+        - Mutilate the list processing somewhat to reduce the compilation
+          of recursive regexes, and so stop perl (<5.10) crapping itself
+          on lots of input. This isn't the full fix - really shouldn't be
+          using recursive regexes at all. RT#37297
+
+1.0.19 2008-04-22T18:34:00
+        - Remove auto_install from Makefile.PL, this is a deprecated feature 
+          and it shouldn't be being used at all.
+
+1.0.18 2008-04-20T18:54:50
+        - Clean up local stuff for settings.
+        - Do a little cleanup of intialisation (more needed)
+        - Remove copy pasted regexes from Text::MultiMarkdown
+        - Fix bug with line breaks in links - http://bugs.debian.org/459885,
+          thanks to patches and test input / output provided by Adeodato Simó.
+          (See t/37anchormultilinebugs.t)
+        - Incorperated MDTest1.1's tests, and made most of the Text-Markdown
+          and Text-MultiMarkdown tests in MDTest format.
+        - Add and document an accessor for the parsed markdown URLs.
+        - Fix html4tags option in Markdown.pl and MultiMarkdown.pl
+
+1.0.17 2008-03-17T01:54:00  
+        - Add Markdown.pl and MultiMarkdown.pl, which work the same way as the 
+          original Markdown.pl. These scripts *are not* installed by default, 
+          but you will be prompted to install them when you run Makefile.PL
+           
+        - Make _DeTab significantly quicker. Text::Balanced is still the main
+          performance sore point however. :(
+        
+        - Re-organise the module code so that Text::Markdown is a standalone 
+          module which does not require Text::MultiMarkdown.     
+          Text::MultiMarkdown now inherits from Text::Markdown and adds the
+          additional MultiMarkdown functionality. This is a *large* change to
+          the module's internals, but is much more in the spirit of the 
+          original Markdown project (and should silence most complaints about 
+          how the code works, and possible even stop John Gruber hating my 
+          guts).
+          
+          If you were using Text::Markdown previously, but relying on an 
+          implicit MultiMarkdown feature, this *could be a breaking change*.
+        
+          Detailed description of any possible user visible changes below:
+          
+          - Text::Markdown will no longer supports the additional attribute 
+            specification for images and links feature, which was not in 
+            original Markdown, but were previously supported after
+            the code merge of Text::Markdown and Text::MultiMarkdown.
+ 
+            If you are relying on this features, it is recommended that you 
+            use Text::MultiMarkdown (configured as you prefer), as this is 
+            not a supported feature in the original Markdown.
+ 
+          - Text::MultiMarkdown has changed the order of attributes in image 
+            tags, the id attribute is moved from the first to the last 
+            attribute (barring user supplied attributes). An example of the 
+            expected change is included below:
+ 
+            Old output:  <img id="image" src="http://path.to/image" alt="image" title="Image title" width="40px" height="400px" />
+ 
+            New output: <img src="http://path.to/image" alt="image" title="Image title" id="image" width="40px" height="400px" />
+          
+            This is due to the code re-organisation, moving the id attribute 
+            around shouldn't affect anything that isn't relying on the 
+            attribute ordering (which is meant to be unimportant in HTML), and 
+            allows for simplification of the unified code.
+
+1.0.16 2008-02-25T14:24:00
+        - Fix bugs with tab_width in constructor / as an option.
+        - Fix bugs with tab width in pre/code blocks.
+
+1.0.15 2008-02-23T11:13:07
+        - Start using ShipIt to package the distribution.
+
+1.0.14 2008-02-21T22:41:33
+        - Fix a bug in the packaging of the last version.
+        - Add links to other implementations and some notes about them.
+        - Add a (failing) unit test for some unexpected behavior reported on 
+          the list.
+
+1.0.13 2008-02-19T23:54:33
+        - Due to the UFT8 support this module no longer works on perl <
+          5.8, note this in the Makefile.PL and modules.
+        - I managed to ship a module without Makefile.PL, WTF? Really
+          need to start using ShipIt.
+   
+1.0.12 2008-02-18T22:00:00
+        - Text::Markdown - borgborgborgborgborg.
+        - Added additional POD documentation.
+        - Cleaned up some tests, and some additional test cases.
+        - Options to turn off all the extra features introduced in 
+          MultiMarkdown.
+
+1.0.11 2008-01-24T00:12:00
+        - Fix syntax error in one of the tests. Note to self - just fixing 
+          that warning in the test case, then shipping without retesting, NOT 
+          SMART!
+          
+1.0.10 2008-01-23T15:40:00
+        - Fix bug with links processing in HTML blocks.
+        
+1.0.9  2008-01-22T20:28:00
+        - Ship non-broken dist at CPAN (oops, rushing!)
+
+1.0.8  2008-01-22T19:20:00
+        - Do not encode amps or angle brackets in HTML comments + test case. 
+        - Do not emit title attribute in <img> tags unless we have contents 
+          for it. This was a 'feature' of original Markdown where I've decided 
+          to go with what php-markdown does (tests updated).
+        - Added php-markdown tests (most/all of the regular tests pass except 
+          the email obfu one).
+        - Added php-markdown extra tests (all fail).
+        - Added python markdown tests (mostly pass, but marked broken).
+        - Add a way of stopping inline HTML blocks from suppressing markdown    
+          processing. Feature request from #catalyst-dev 
+
+
+1.0.7   2008-01-07T16:31:00
+        - Encode isn't in core in all perls, add it to Makefile.PL
+
 1.0.6   2008-01-06T13:36:00
         - Merge latest Markdown test suite I can find, and make it all pass, 
           pulling in code from Markdown 1.0.2b8. Things fixed:
@@ -46,166 +187,33 @@
         - Fix unicode issues from CPAN.org's RT#27482
         - Remove call to srand, it's not smart to do this more than once.
         
-1.0.7   2008-01-07T16:31:00
-        - Encode isn't in core in all perls, add it to Makefile.PL
-
-1.0.8  2008-01-22T19:20:00
-        - Do not encode amps or angle brackets in HTML comments + test case. 
-        - Do not emit title attribute in <img> tags unless we have contents 
-          for it. This was a 'feature' of original Markdown where I've decided 
-          to go with what php-markdown does (tests updated).
-        - Added php-markdown tests (most/all of the regular tests pass except 
-          the email obfu one).
-        - Added php-markdown extra tests (all fail).
-        - Added python markdown tests (mostly pass, but marked broken).
-        - Add a way of stopping inline HTML blocks from suppressing markdown    
-          processing. Feature request from #catalyst-dev 
-
-1.0.9  2008-01-22T20:28:00
-        - Ship non-broken dist at CPAN (oops, rushing!)
-
-1.0.10 2008-01-23T15:40:00
-        - Fix bug with links processing in HTML blocks.
-
-1.0.11 2008-01-24T00:12:00
-        - Fix syntax error in one of the tests. Note to self - just fixing 
-          that warning in the test case, then shipping without retesting, NOT 
-          SMART!
-          
-1.0.12 2008-02-18T22:00:00
-        - Text::Markdown - borgborgborgborgborg.
-        - Added additional POD documentation.
-        - Cleaned up some tests, and some additional test cases.
-        - Options to turn off all the extra features introduced in 
-          MultiMarkdown.
-        
-1.0.13 2008-02-19T23:54:33
-       - Due to the UFT8 support this module no longer works on perl <
-         5.8, note this in the Makefile.PL and modules.
-       - I managed to ship a module without Makefile.PL, WTF? Really
-         need to start using ShipIt.
-
-1.0.14 2008-02-21T22:41:33
-       - Fix a bug in the packaging of the last version.
-       - Add links to other implementations and some notes about them.
-       - Add a (failing) unit test for some unexpected behavior reported on 
-         the list.
-
-1.0.15 2008-02-23T11:13:07
-       - Start using ShipIt to package the distribution.
-
-1.0.16 2008-02-25T14:24:00
-       - Fix bugs with tab_width in constructor / as an option.
-       - Fix bugs with tab width in pre/code blocks.
-       
-1.0.17 2008-03-17T01:54:00  
-       - Add Markdown.pl and MultiMarkdown.pl, which work the same way as the 
-         original Markdown.pl. These scripts *are not* installed by default, 
-         but you will be prompted to install them when you run Makefile.PL
-          
-       - Make _DeTab significantly quicker. Text::Balanced is still the main
-         performance sore point however. :(
-       
-       - Re-organise the module code so that Text::Markdown is a standalone 
-         module which does not require Text::MultiMarkdown.     
-         Text::MultiMarkdown now inherits from Text::Markdown and adds the
-         additional MultiMarkdown functionality. This is a *large* change to
-         the module's internals, but is much more in the spirit of the 
-         original Markdown project (and should silence most complaints about 
-         how the code works, and possible even stop John Gruber hating my 
-         guts).
-         
-         If you were using Text::Markdown previously, but relying on an 
-         implicit MultiMarkdown feature, this *could be a breaking change*.
-       
-         Detailed description of any possible user visible changes below:
-         
-         - Text::Markdown will no longer supports the additional attribute 
-           specification for images and links feature, which was not in 
-           original Markdown, but were previously supported after
-           the code merge of Text::Markdown and Text::MultiMarkdown.
-
-           If you are relying on this features, it is recommended that you 
-           use Text::MultiMarkdown (configured as you prefer), as this is 
-           not a supported feature in the original Markdown.
-
-         - Text::MultiMarkdown has changed the order of attributes in image 
-           tags, the id attribute is moved from the first to the last 
-           attribute (barring user supplied attributes). An example of the 
-           expected change is included below:
-
-           Old output:  <img id="image" src="http://path.to/image" alt="image" title="Image title" width="40px" height="400px" />
-
-           New output: <img src="http://path.to/image" alt="image" title="Image title" id="image" width="40px" height="400px" />
-         
-           This is due to the code re-organisation, moving the id attribute 
-           around shouldn't affect anything that isn't relying on the 
-           attribute ordering (which is meant to be unimportant in HTML), and 
-           allows for simplification of the unified code.
-
-1.0.18 2008-04-20T18:54:50
-        - Clean up local stuff for settings.
-        - Do a little cleanup of intialisation (more needed)
-        - Remove copy pasted regexes from Text::MultiMarkdown
-        - Fix bug with line breaks in links - http://bugs.debian.org/459885,
-          thanks to patches and test input / output provided by Adeodato Simó.
-          (See t/37anchormultilinebugs.t)
-        - Incorperated MDTest1.1's tests, and made most of the Text-Markdown
-          and Text-MultiMarkdown tests in MDTest format.
-        - Add and document an accessor for the parsed markdown URLs.
-        - Fix html4tags option in Markdown.pl and MultiMarkdown.pl
-
-1.0.19 2008-04-22T18:34:00
-        - Remove auto_install from Makefile.PL, this is a deprecated feature 
-          and it shouldn't be being used at all.
-
-1.0.20 2008-07-11T23:30:00
-        - Update README.txt
-        - Allow scripts to be used on multiple input files at once (processing 
-          in command line order)
-        - Update footnote behavior of Text::MutliMarkdown to be consistent 
-          with the latest version of MultiMarkdown
-        - Added tests for the new footnote functionality.
-        - Added tests for all the MDTest corner cases brought up on the list. 
-          Noted why / how I differ from original Markdown.
-        - Moved all the document tests to MDTest format. I have made MDTest 
-          test suites for Text::Markdown and Text::MultiMarkdown, containing 
-          **only** the bug fixes and behavior changes I've made, I've imported 
-          the Markdown test suite from MDTest1.1, and the MultiMarkdown test
-          suite.
-        - RT#36537 doc patch to add POD to the scripts from Debian's Gunnar 
-          Wolf.
-        - Mutilate the list processing somewhat to reduce the compilation
-          of recursive regexes, and so stop perl (<5.10) crapping itself
-          on lots of input. This isn't the full fix - really shouldn't be
-          usng recursive regexes at all. RT#37297
-
-1.0.21 2008-07-24T08:33:00
-        - Fix hard tabs in Changelog
-        - Add unit test for core dumps issue from RT#36203
-        - Fix POD spelling.
-        - Fix warning from RT#34856.
-        - Add test for another tab width issue (related to <hr> generation)
-          from RT#37769. Fix this issue.
-        - More test additions and more splitting the test suites into MDTest 
-          modules.
-
-1.0.22 2008-10-23T18:24:44
-        - RT#37909 - Fix + in email addresses.
-        - RT#40303 - Fix use in Mason by adding "use re 'eval'" to both files.
-        - Add SVN repository to Makefile.PL
-        - Remove META.yml from source control so it is regenerated 
-          automatically.
-
-1.0.23 2008-11-02T18:24:30
-        - Ship a release with the correct contents so that the tests pass.
-
-1.0.24 2008-11-16T14:33:30
-        - Add trust_list_start_value patch from Ricardo Signes (RT#40814)
-          to enable <li value='X'> output for list numbering.
-          This feature is disabled by default.
-
-1.0.25 2009-08-25T09:31:30
-        - Remove MultiMarkdown from the Text::Markdown distribution
-        - Change repository and bugtracker metadata to github.
-
+1.0.5   2008-01-04T18:07:57
+        - Add Markdown and MultiMarkdown test suites.
+        - Fix a big bug introduced in 1.0.4 in citations
+        - Fix footnotes (and other small things) to match the test suite
+        
+1.0.4   2008-01-02T02:03:50
+        - Refactor so that the processor instance has the same set of        
+          persistent options as on the ->markdown method itself.
+        - Change all functions to be instance methods, moved a chunk of the 
+          global data to the instance. The rest will follow shortly.
+        - The test suite now tests a reasonable set of the Markdown and 
+          MultiMarkdown syntaxes.
+        - All known options and metadata keys have been documented.
+        
+1.0.3   2007-11-24T20:22:00
+        - way to keep me accountable, CPANTESTERS! Maybe I shouldn't have
+          Test::Pod::Coverage enabled unless it actually checks out. Added some
+          fairly useless stubbed METHODS to POD and moved POD around a bit.
+          
+1.0.2   2007-11-24T14:00:00
+        - move to Module::Install and clean various things up, mostly to make
+          CPANTS happy.
+
+1.0.1   2006-10-20T00:00:00
+        - include patch from Uwe Voelker to allow setting of options in
+          markdown(); also added a test case from Uwe. Thanks, Uwe!
+          Also updated changelog references in POD somewhat.
+
+1.0.0   2006-08-22T00:00:00
+        - first release

Modified: trunk/libtext-markdown-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-markdown-perl/META.yml?rev=45345&op=diff
==============================================================================
--- trunk/libtext-markdown-perl/META.yml (original)
+++ trunk/libtext-markdown-perl/META.yml Sun Oct  4 13:38:13 2009
@@ -32,4 +32,4 @@
   bugtracker: http://github.com/bobtfish/text-markdown/issues
   license: http://opensource.org/licenses/bsd-license.php
   repository: http://github.com/bobtfish/text-markdown/
-version: 1.0.25
+version: 1.0.26

Modified: trunk/libtext-markdown-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-markdown-perl/README?rev=45345&op=diff
==============================================================================
--- trunk/libtext-markdown-perl/README (original)
+++ trunk/libtext-markdown-perl/README Sun Oct  4 13:38:13 2009
@@ -38,8 +38,30 @@
 
         http://daringfireball.net/projects/markdown/
 
+    Note that Text::Markdown ensures that the output always ends with
+    *one* newline. The fact that multiple newlines are collapsed into one
+    makes sense, because this is the behavior of HTML towards whispace. The
+    fact that there's always a newline at the end makes sense again, given
+    that the output will always be nested in a block-level element (as
+    opposed to an inline element). That block element can be a <p> (most
+    often), or a <table>.
+    
+    Markdown is *not* interpreted in HTML block-level elements, in order for
+    chunks of pasted HTML (e.g. JavaScript widgets, web counters) to not be
+    magically (mis)interpreted. For selective processing of Markdown in some,
+    but not other, HTML block elements, add a "markdown" attribute to the block
+    element and set its value to "1", "on" or "yes":
+    
+        <div markdown="1" class="navbar">
+        * Home
+        * About
+        * Contact
+        <div>
+    
+    The extra "markdown" attribute will be stripped when generating the output.
+    
 OPTIONS
-    Text::Markdown supports a number of options to it's processor which
+    Text::Markdown supports a number of options to its processor which
     control the behaviour of the output document.
 
     These options can be supplied to the constructor, on in a hash with the
@@ -55,11 +77,6 @@
     tab_width
         Controls indent width in the generated markup, defaults to 4
 
-    markdown_in_html_blocks
-        Controls if Markdown is processed when inside HTML blocks. Defaults
-        to 0.
-
-METHODS
 METHODS
   new
     A simple constructor, see the SYNTAX and OPTIONS sections for more
@@ -124,15 +141,17 @@
 AUTHOR
         John Gruber
         http://daringfireball.net/
-
+    
         PHP port and other contributions by Michel Fortin
         http://michelf.com/
-
+    
         MultiMarkdown changes by Fletcher Penney
         http://fletcher.freeshell.org/
-
+    
         CPAN Module Text::MultiMarkdown (based on Text::Markdown by Sebastian
         Riedel) originally by Darren Kulp (http://kulp.ch/)
+        
+        Support for markdown="1" by Dan Dascalescu (http://dandascalescu.com)
     
         This module is maintained by: Tomas Doran http://www.bobtfish.net/
 

Modified: trunk/libtext-markdown-perl/Todo
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-markdown-perl/Todo?rev=45345&op=diff
==============================================================================
--- trunk/libtext-markdown-perl/Todo (original)
+++ trunk/libtext-markdown-perl/Todo Sun Oct  4 13:38:13 2009
@@ -1,6 +1,6 @@
 Todo pre 1.0.23:
     . Tests for $footnote =~ s/^glossary:\s*//i
-	. Tests for $footnote_closing_tag
+    . Tests for $footnote_closing_tag
     . Add an option to Text::Markdown to have original brand markdown style 
       emphasis within words support.
     . Re-merge Movable Type and Bloxom compatibility to the scripts, and add 

Modified: trunk/libtext-markdown-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-markdown-perl/debian/changelog?rev=45345&op=diff
==============================================================================
--- trunk/libtext-markdown-perl/debian/changelog (original)
+++ trunk/libtext-markdown-perl/debian/changelog Sun Oct  4 13:38:13 2009
@@ -1,8 +1,12 @@
-libtext-markdown-perl (1.0.25-2) UNRELEASED; urgency=low
+libtext-markdown-perl (1.0.26-1) UNRELEASED; urgency=low
 
+  [ Jonathan Yu ]
+  * New upstream release
+
+  [ Ryan Niebur ]
   * Update jawnsy's email address
 
- -- Ryan Niebur <ryanryan52 at gmail.com>  Tue, 01 Sep 2009 21:19:55 -0700
+ -- Jonathan Yu <jawnsy at cpan.org>  Sun, 04 Oct 2009 05:52:03 -0400
 
 libtext-markdown-perl (1.0.25-1) unstable; urgency=low
 

Modified: trunk/libtext-markdown-perl/lib/Text/Markdown.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-markdown-perl/lib/Text/Markdown.pm?rev=45345&op=diff
==============================================================================
--- trunk/libtext-markdown-perl/lib/Text/Markdown.pm (original)
+++ trunk/libtext-markdown-perl/lib/Text/Markdown.pm Sun Oct  4 13:38:13 2009
@@ -9,7 +9,7 @@
 use Carp        qw(croak);
 use base        'Exporter';
 
-our $VERSION   = '1.0.25';
+our $VERSION   = '1.0.26';
 our @EXPORT_OK = qw(markdown);
 
 =head1 NAME
@@ -56,12 +56,36 @@
 
     http://daringfireball.net/projects/markdown/
 
+Note that L<Text::Markdown> ensures that the output always ends with
+B<one> newline. The fact that multiple newlines are collapsed into one
+makes sense, because this is the behavior of HTML towards whispace. The
+fact that there's always a newline at the end makes sense again, given
+that the output will always be nested in a B<block>-level element (as
+opposed to an inline element). That block element can be a C<< <p> >>
+(most often), or a C<< <table> >>.
+
+Markdown is B<not> interpreted in HTML block-level elements, in order for
+chunks of pasted HTML (e.g. JavaScript widgets, web counters) to not be
+magically (mis)interpreted. For selective processing of Markdown in some,
+but not other, HTML block elements, add a C<markdown> attribute to the block
+element and set its value to C<1>, C<on> or C<yes>:
+
+    <div markdown="1" class="navbar">
+    * Home
+    * About
+    * Contact
+    <div>
+
+The extra C<markdown> attribute will be stripped when generating the output.
+
 =head1 OPTIONS
 
-Text::Markdown supports a number of options to its processor which control the behaviour of the output document.
-
-These options can be supplied to the constructor, or in a hash within individual calls to the markdown() method.
-See the synopsis for examples of both styles.
+Text::Markdown supports a number of options to its processor which control
+the behaviour of the output document.
+
+These options can be supplied to the constructor, or in a hash within
+individual calls to the L</markdown> method. See the SYNOPSIS for examples
+of both styles.
 
 The options for the processor are:
 
@@ -78,12 +102,6 @@
 
 Controls indent width in the generated markup. Defaults to 4.
 
-=item markdown_in_html_blocks
-
-Controls if Markdown is processed when inside HTML blocks. Defaults to 0 in
-order to not inadvertently parse as Markdown chunks of HTML that the user may
-have pasted in their document (e.g. web counters in a wiki page).
-
 =item trust_list_start_value
 
 If true, ordered lists will use the first number as the starting point for
@@ -100,8 +118,6 @@
 (Note that in the above, quux will be numbered 4.)
 
 =back
-
-=head1 METHODS
 
 =cut
 
@@ -151,9 +167,6 @@
 
     $p{empty_element_suffix} ||= ' />'; # Change to ">" for HTML output
 
-    # Is markdown processed in HTML blocks? See t/15inlinehtmldonotturnoffmarkdown.t
-    $p{markdown_in_html_blocks} = $p{markdown_in_html_blocks} ? 1 : 0;
-
     $p{trust_list_start_value} = $p{trust_list_start_value} ? 1 : 0;
 
     my $self = { params => \%p };
@@ -218,12 +231,12 @@
 
     $text = $self->_CleanUpDoc($text);
 
-    # Turn block-level HTML elements into hash entries if we are not supposed to parse the Markdown in them
-    $text = $self->_HashHTMLBlocks($text) unless $self->{markdown_in_html_blocks};
+    # Turn block-level HTML elements into hash entries, and interpret markdown in them if they have a 'markdown="1"' attribute
+    $text = $self->_HashHTMLBlocks($text, {interpret_markdown_on_attribute => 1});
 
     $text = $self->_StripLinkDefinitions($text);
 
-    $text = $self->_RunBlockGamut($text);
+    $text = $self->_RunBlockGamut($text, {wrap_in_p_tags => 1});
 
     $text = $self->_UnescapeSpecialChars($text);
 
@@ -234,10 +247,12 @@
 
 =head2 urls
 
-Returns a reference to a hash with the key being the markdown reference and the value being the URL.
-
-Useful for building scripts which preprocess a list of links before the main content. See t/05options.t
-for an example of this hashref being passed back into the markdown method to create links.
+Returns a reference to a hash with the key being the markdown reference
+and the value being the URL.
+
+Useful for building scripts which preprocess a list of links before the
+main content. See F<t/05options.t> for an example of this hashref being
+passed back into the markdown method to create links.
 
 =cut
 
@@ -320,10 +335,10 @@
 }
 
 sub _HashHTMLBlocks {
-    my ($self, $text) = @_;
+    my ($self, $text, $options) = @_;
     my $less_than_tab = $self->{tab_width} - 1;
 
-    # Hashify HTML blocks:
+    # Hashify HTML blocks (protect from further interpretation by encoding to an md5):
     # We only want to do this for block-level HTML tags, such as headers,
     # lists, and tables. That's because we still want to wrap <p>s around
     # "paragraphs" that are wrapped in non-block-level tags, such as anchors,
@@ -347,26 +362,44 @@
                                 ".+?"       # "Attribute value"
                              |
                                 '.+?'       # 'Attribute value'
+                             |
+                                [^\s]+?      # AttributeValue (HTML5)
                             )
                         )*                  # Zero or more
                     }x;
 
     my $empty_tag = qr{< \w+ $tag_attrs \s* />}oxms;
     my $open_tag =  qr{< $block_tags $tag_attrs \s* >}oxms;
-    my $close_tag = undef;    # let Text::Balanced handle this
+    my $close_tag = undef;       # let Text::Balanced handle this
+    my $prefix_pattern = undef;  # Text::Balanced
+    my $markdown_attr = qr{ \s* markdown \s* = \s* (['"]) (.*?) \1 }xs;
 
     use Text::Balanced qw(gen_extract_tagged);
-    my $extract_block = gen_extract_tagged($open_tag, $close_tag, undef, { ignore => [$empty_tag] });
+    my $extract_block = gen_extract_tagged($open_tag, $close_tag, $prefix_pattern, { ignore => [$empty_tag] });
 
     my @chunks;
-    # parse each line...
+    # parse each line, looking for block-level HTML tags
     while ($text =~ s{^(([ ]{0,$less_than_tab}<)?.*\n)}{}m) {
         my $cur_line = $1;
         if (defined $2) {
             # current line could be start of code block
 
-            my ($tag, $remainder) = $extract_block->($cur_line . $text);
+            my ($tag, $remainder, $prefix, $opening_tag, $text_in_tag, $closing_tag) = $extract_block->($cur_line . $text);
             if ($tag) {
+                if ($options->{interpret_markdown_on_attribute} and $opening_tag =~ s/$markdown_attr//i) {
+                    my $markdown = $2;
+                    if ($markdown =~ /^(1|on|yes)$/) {
+                        # interpret markdown and reconstruct $tag to include the interpreted $text_in_tag
+                        my $wrap_in_p_tags = $opening_tag =~ /^<(div|iframe)/;
+                        $tag = $prefix . $opening_tag . "\n"
+                          . $self->_RunBlockGamut($text_in_tag, {wrap_in_p_tags => $wrap_in_p_tags})
+                          . "\n" . $closing_tag
+                        ;
+                    } else {
+                        # just remove the markdown="0" attribute
+                        $tag = $prefix . $opening_tag . $text_in_tag . $closing_tag;
+                    }
+                }
                 my $key = _md5_utf8($tag);
                 $self->{_html_blocks}{$key} = $tag;
                 push @chunks, "\n\n" . $key . "\n\n";
@@ -383,17 +416,9 @@
         }
 
     }
-    push @chunks, $text; # Whatever is left.
+    push @chunks, $text;  # whatever is left
 
     $text = join '', @chunks;
-
-    # Special case just for <hr />. It was easier to make a special case than
-    # to make the other regex more complicated.
-    $text = $self->_HashHR($text);
-
-    $text = $self->_HashHTMLComments($text);
-
-    $text = $self->_HashPHPASPBlocks($text);
 
     return $text;
 }
@@ -490,7 +515,7 @@
 # These are all the transformations that form block-level
 # tags like paragraphs, headers, and list items.
 #
-    my ($self, $text) = @_;
+    my ($self, $text, $options) = @_;
 
     # Do headers first, as these populate cross-refs
     $text = $self->_DoHeaders($text);
@@ -513,7 +538,15 @@
     # <p> tags around block-level tags.
     $text = $self->_HashHTMLBlocks($text);
 
-    $text = $self->_FormParagraphs($text);
+    # Special case just for <hr />. It was easier to make a special case than
+    # to make the other regex more complicated.
+    $text = $self->_HashHR($text);
+
+    $text = $self->_HashHTMLComments($text);
+
+    $text = $self->_HashPHPASPBlocks($text);
+
+    $text = $self->_FormParagraphs($text, {wrap_in_p_tags => $options->{wrap_in_p_tags}});
 
     return $text;
 }
@@ -707,8 +740,8 @@
         return $whole_match;
     }
 
-    $url =~ s! \* !$g_escape_table{'*'}!gox;     # We've got to encode these to avoid
-    $url =~ s!  _ !$g_escape_table{'_'}!gox;     # conflicting with italics/bold.
+    $url =~ s! \* !$g_escape_table{'*'}!gox;    # We've got to encode these to avoid
+    $url =~ s!  _ !$g_escape_table{'_'}!gox;    # conflicting with italics/bold.
     $url =~ s{^<(.*)>$}{$1};                    # Remove <>'s surrounding URL, if present
 
     $result = qq{<a href="$url"};
@@ -1043,7 +1076,7 @@
         my $leading_space = $2;
 
         if ($leading_line or ($item =~ m/\n{2,}/)) {
-            $item = $self->_RunBlockGamut($self->_Outdent($item));
+            $item = $self->_RunBlockGamut($self->_Outdent($item), {wrap_in_p_tags => 1});
         }
         else {
             # Recursion for sub-lists:
@@ -1108,7 +1141,7 @@
         my $leading_space = $2;
 
         if ($leading_line or ($item =~ m/\n{2,}/)) {
-            $item = $self->_RunBlockGamut($self->_Outdent($item));
+            $item = $self->_RunBlockGamut($self->_Outdent($item), {wrap_in_p_tags => 1});
         }
         else {
             # Recursion for sub-lists:
@@ -1126,7 +1159,11 @@
 
 sub _DoCodeBlocks {
 #
-#   Process Markdown `<pre><code>` blocks.
+# Process Markdown code blocks (indented with 4 spaces or 1 tab):
+# * outdent the spaces/tab
+# * encode <, >, & into HTML entities
+# * escape Markdown special characters into MD5 hashes
+# * trim leading and trailing newlines
 #
 
     my ($self, $text) = @_;
@@ -1135,19 +1172,19 @@
         (?:\n\n|\A)
         (                # $1 = the code block -- one or more lines, starting with a space/tab
           (?:
-            (?:[ ]{$self->{tab_width}} | \t)  # Lines must start with a tab or a tab-width of spaces
+            (?:[ ]{$self->{tab_width}} | \t)   # Lines must start with a tab or a tab-width of spaces
             .*\n+
           )+
         )
         ((?=^[ ]{0,$self->{tab_width}}\S)|\Z)    # Lookahead for non-space at line-start, or end of doc
     }{
         my $codeblock = $1;
-        my $result; # return value
+        my $result;  # return value
 
         $codeblock = $self->_EncodeCode($self->_Outdent($codeblock));
         $codeblock = $self->_Detab($codeblock);
-        $codeblock =~ s/\A\n+//; # trim leading newlines
-        $codeblock =~ s/\n+\z//; # trim trailing newlines
+        $codeblock =~ s/\A\n+//;  # trim leading newlines
+        $codeblock =~ s/\n+\z//;  # trim trailing newlines
 
         $result = "\n\n<pre><code>" . $codeblock . "\n</code></pre>\n\n";
 
@@ -1285,7 +1322,7 @@
             my $bq = $1;
             $bq =~ s/^[ \t]*>[ \t]?//gm;    # trim one level of quoting
             $bq =~ s/^[ \t]+$//mg;          # trim whitespace-only lines
-            $bq = $self->_RunBlockGamut($bq);      # recurse
+            $bq = $self->_RunBlockGamut($bq, {wrap_in_p_tags => 1});      # recurse
 
             $bq =~ s/^/  /mg;
             # These leading spaces screw with <pre> content, so we need to fix that:
@@ -1309,7 +1346,7 @@
 #   Params:
 #       $text - string to process with html <p> tags
 #
-    my ($self, $text) = @_;
+    my ($self, $text, $options) = @_;
 
     # Strip leading and trailing lines:
     $text =~ s/\A\n+//;
@@ -1323,8 +1360,10 @@
     foreach (@grafs) {
         unless (defined( $self->{_html_blocks}{$_} )) {
             $_ = $self->_RunSpanGamut($_);
-            s/^([ \t]*)/<p>/;
-            $_ .= "</p>";
+            if ($options->{wrap_in_p_tags}) {
+                s/^([ \t]*)/<p>/;
+                $_ .= "</p>";
+            }
         }
     }
 
@@ -1577,7 +1616,7 @@
 =item C - <http://www.pell.portland.or.us/~orc/Code/discount>
 
 Discount - Original Markdown, but in C. Fastest implementation available, and passes MDTest.
-Adds it's own set of custom features.
+Adds its own set of custom features.
 
 =item python - <http://www.freewisdom.org/projects/python-markdown/>
 
@@ -1632,6 +1671,8 @@
 
     CPAN Module Text::MultiMarkdown (based on Text::Markdown by Sebastian
     Riedel) originally by Darren Kulp (http://kulp.ch/)
+    
+    Support for markdown="1" by Dan Dascalescu (http://dandascalescu.com)
 
     This module is maintained by: Tomas Doran http://www.bobtfish.net/
 




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