r44902 - in /branches/upstream/libhtml-wikiconverter-markdown-perl: 0.05/ current/Changes current/MANIFEST current/META.yml current/Makefile.PL current/README current/lib/HTML/WikiConverter/Markdown.pm current/t/01-markdown.t current/t/markdown.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Sep 27 02:37:54 UTC 2009
Author: jawnsy-guest
Date: Sun Sep 27 02:37:49 2009
New Revision: 44902
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=44902
Log:
Revert eloy's half-upgrade (hope he doesn't mind, but it's been 4 months, and ghostbar is anxious to do the upgrade himself)
Added:
branches/upstream/libhtml-wikiconverter-markdown-perl/current/t/markdown.t
- copied unchanged from r35240, branches/upstream/libhtml-wikiconverter-markdown-perl/current/t/markdown.t
Removed:
branches/upstream/libhtml-wikiconverter-markdown-perl/0.05/
branches/upstream/libhtml-wikiconverter-markdown-perl/current/t/01-markdown.t
Modified:
branches/upstream/libhtml-wikiconverter-markdown-perl/current/Changes
branches/upstream/libhtml-wikiconverter-markdown-perl/current/MANIFEST
branches/upstream/libhtml-wikiconverter-markdown-perl/current/META.yml
branches/upstream/libhtml-wikiconverter-markdown-perl/current/Makefile.PL
branches/upstream/libhtml-wikiconverter-markdown-perl/current/README
branches/upstream/libhtml-wikiconverter-markdown-perl/current/lib/HTML/WikiConverter/Markdown.pm
Modified: branches/upstream/libhtml-wikiconverter-markdown-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-wikiconverter-markdown-perl/current/Changes?rev=44902&op=diff
==============================================================================
--- branches/upstream/libhtml-wikiconverter-markdown-perl/current/Changes (original)
+++ branches/upstream/libhtml-wikiconverter-markdown-perl/current/Changes Sun Sep 27 02:37:49 2009
@@ -1,18 +1,4 @@
# Revision history for HTML::WikiConverter::Markdown
-
-date: 2009-03-16
-version: 0.05
-changes:
- - requires HTML::WikiConverter 0.67
- - (bug #43997) properly handles multiline code blocks
-
-date: 2009-03-13
-version: 0.04
-changes:
- - correct handling of blockquotes containing only phrasal elements
- - (bug #43988) properly escape backticks within code tags
- - (bug #43993) don't escape underscores within code tags
- - (bug #43996) decode specific html entities within code tags
date: 2008-11-14
version: 0.03
Modified: branches/upstream/libhtml-wikiconverter-markdown-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-wikiconverter-markdown-perl/current/MANIFEST?rev=44902&op=diff
==============================================================================
--- branches/upstream/libhtml-wikiconverter-markdown-perl/current/MANIFEST (original)
+++ branches/upstream/libhtml-wikiconverter-markdown-perl/current/MANIFEST Sun Sep 27 02:37:49 2009
@@ -6,7 +6,7 @@
lib/HTML/WikiConverter/Markdown.pm
t/00-load.t
t/boilerplate.t
-t/01-markdown.t
+t/markdown.t
t/pod-coverage.t
t/pod.t
t/runtests.pl
Modified: branches/upstream/libhtml-wikiconverter-markdown-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-wikiconverter-markdown-perl/current/META.yml?rev=44902&op=diff
==============================================================================
--- branches/upstream/libhtml-wikiconverter-markdown-perl/current/META.yml (original)
+++ branches/upstream/libhtml-wikiconverter-markdown-perl/current/META.yml Sun Sep 27 02:37:49 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: HTML-WikiConverter-Markdown
-version: 0.05
+version: 0.03
abstract: Convert HTML to Markdown markup
author:
- David J. Iberri <diberri at cpan.org>
@@ -10,7 +10,7 @@
ExtUtils::MakeMaker: 0
requires:
HTML::Tagset: 0
- HTML::WikiConverter: 0.67
+ HTML::WikiConverter: 0.63
Params::Validate: 0
Test::More: 0
URI: 0
Modified: branches/upstream/libhtml-wikiconverter-markdown-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-wikiconverter-markdown-perl/current/Makefile.PL?rev=44902&op=diff
==============================================================================
--- branches/upstream/libhtml-wikiconverter-markdown-perl/current/Makefile.PL (original)
+++ branches/upstream/libhtml-wikiconverter-markdown-perl/current/Makefile.PL Sun Sep 27 02:37:49 2009
@@ -11,7 +11,7 @@
PL_FILES => {},
PREREQ_PM => {
'Test::More' => 0,
- 'HTML::WikiConverter' => 0.67, # for p_strict attribute
+ 'HTML::WikiConverter' => 0.63,
'HTML::Tagset' => 0,
'Params::Validate' => 0,
'URI' => 0,
Modified: branches/upstream/libhtml-wikiconverter-markdown-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-wikiconverter-markdown-perl/current/README?rev=44902&op=diff
==============================================================================
--- branches/upstream/libhtml-wikiconverter-markdown-perl/current/README (original)
+++ branches/upstream/libhtml-wikiconverter-markdown-perl/current/README Sun Sep 27 02:37:49 2009
@@ -1,8 +1,8 @@
HTML::WikiConverter::Markdown
=============================
-This module adds HTML-to-Markdown conversion to the
-HTML::WikiConverter module.
+This module adds HTML->Markdown conversion to the HTML::WikiConverter
+module.
SYNOPSIS
@@ -19,6 +19,12 @@
There's also a web interface if you're so inclined:
http://diberri.dyndns.org/wikipedia/html2wiki/
+
+DEPENDENCIES
+
+ * HTML::WikiConverter version 0.60
+ * HTML::Tagset
+ * URI
INSTALLATION
@@ -51,7 +57,7 @@
COPYRIGHT AND LICENCE
-Copyright (c) David J. Iberri
+Copyright (C) 2006 David J. Iberri
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: branches/upstream/libhtml-wikiconverter-markdown-perl/current/lib/HTML/WikiConverter/Markdown.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-wikiconverter-markdown-perl/current/lib/HTML/WikiConverter/Markdown.pm?rev=44902&op=diff
==============================================================================
--- branches/upstream/libhtml-wikiconverter-markdown-perl/current/lib/HTML/WikiConverter/Markdown.pm (original)
+++ branches/upstream/libhtml-wikiconverter-markdown-perl/current/lib/HTML/WikiConverter/Markdown.pm Sun Sep 27 02:37:49 2009
@@ -4,10 +4,9 @@
use strict;
use base 'HTML::WikiConverter';
-our $VERSION = '0.05';
+our $VERSION = '0.03';
use Params::Validate ':types';
-use HTML::Entities;
use HTML::Tagset;
use URI;
@@ -95,15 +94,9 @@
image_tag_fallback => { default => 1, type => BOOLEAN },
unordered_list_style => { default => 'asterisk', type => SCALAR },
ordered_list_style => { default => 'sequential', type => SCALAR },
-
- # Requires H::WC version 0.67
- p_strict => { default => 0 },
} }
my @common_attrs = qw/ id class lang dir title style /;
-
-# Hack to accommodate bug #43997 - multiline code blocks
-my $code_block_prefix = 'bqwegsdfbwegadfbnsdfbahwerfgkjnsdfbohqw34t927398y5jnwrteb8uq34inb';
sub rules {
my $self = shift;
@@ -121,8 +114,7 @@
em => { alias => 'i' },
b => { start => '**', end => '**' },
strong => { alias => 'b' },
- code => { start => \&_code_delim, end => \&_code_delim },
- code_block => { line_prefix => $code_block_prefix, block => 1 },
+ code => { start => '`', end => '`' },
a => { replace => \&_link },
img => { replace => \&_img },
@@ -266,131 +258,36 @@
my( $self, $node ) = @_;
return unless $node->tag and $node->parent and $node->parent->tag;
- if( $node->tag eq 'blockquote' ) {
- my @non_phrasal_children = grep { ! $self->_is_phrase_tag($_->tag) } $node->content_list;
- unless( @non_phrasal_children ) { # ie, we have things like <blockquote>blah blah blah</blockquote>, without a <p> or something
- $self->_envelop_children( $node, HTML::Element->new('p') );
- }
+ if( $node->parent->tag eq 'blockquote' and $self->_is_phrase_tag($node->tag) ) {
+ $self->_envelop_elem( $node, HTML::Element->new('p') );
} elsif( $node->tag eq '~text' ) {
$self->_escape_text($node);
-
- # bug #43998
- $self->_decode_entities_in_code($node)
- if $node->parent->tag eq 'code' or $node->parent->tag eq 'code_block';
- }
-}
-
-sub preprocess_tree {
- my( $self, $root ) = @_;
- foreach my $node ( $root->descendants ) {
- # bug #43997 - multiline code blocks
- if( $self->_text_is_within_code_pre($node) ) {
- $self->_convert_to_code_block($node);
- }
- }
-}
-
-sub _text_is_within_code_pre {
- my( $self, $node ) = @_;
- return unless $node->parent->parent and $node->parent->parent->tag;
-
- # Must be <code><pre>...</pre></code> (or <pre><code>...</code></pre>)
- my $code_pre = $node->parent->tag eq 'code' && $node->parent->parent->tag eq 'pre';
- my $pre_code = $node->parent->tag eq 'pre' && $node->parent->parent->tag eq 'code';
- return unless $code_pre or $pre_code;
-
- # Can't be any other nodes in a code block
- return if $node->left or $node->right;
- return if $node->parent->left or $node->parent->right;
-
- return 1;
-}
-
-sub _convert_to_code_block {
- my( $self, $node ) = @_;
- $node->parent->parent->replace_with_content->delete;
- $node->parent->tag( "code_block" );
-}
-
-sub _envelop_children {
- my( $self, $node, $new_child ) = @_;
-
- my @children = $node->detach_content;
- $node->push_content($new_child);
- $new_child->push_content(@children);
-}
-
-# special handling for: ` _ # . [ !
-my @escapes = qw( \\ * { } _ ` );
-
-my %backslash_escapes = (
- '\\' => [ '0923fjhtml2wikiescapedbackslash', "\\\\" ],
- '*' => [ '0923fjhtml2wikiescapedasterisk', "\\*" ],
- '{' => [ '0923fjhtml2wikiescapedopenbrace', "\\{" ],
- '}' => [ '0923fjhtml2wikiescapedclosebrace', "\\}" ],
- '_' => [ '0923fjhtml2wikiescapedunderscore', "\\_" ],
- '`' => [ '0923fjhtml2wikiescapedbacktick', "\\`" ],
-);
+ }
+}
+
+sub _envelop_elem {
+ my( $self, $node, $new_parent ) = @_;
+ my $h = $node->replace_with($new_parent);
+ $new_parent->push_content($h);
+}
+
+my @escapes = qw( \\ \` * _ { } ); # '#', '.', '[', and '!' are handled specially
sub _escape_text {
my( $self, $node ) = @_;
my $text = $node->attr('text') || '';
-
- #
- # (bug #43998)
- # Only backslash-escape backticks that don't occur within <code>
- # tags. Those within <code> tags are left alone and the backticks to
- # signal a <code> tag get upgraded to a double-backtick by
- # _code_delim().
- #
- # (bug #43993)
- # Likewise, only backslash-escape underscores that occur outside
- # <code> tags.
- #
-
- my $inside_code = $node->look_up( _tag => 'code' ) || $node->look_up( _tag => 'code_block' );
-
- if( not $inside_code ) {
- my $escapes = join '', @escapes;
- $text =~ s/([\Q$escapes\E])/$backslash_escapes{$1}->[0]/g;
- $text =~ s/^([\d]+)\./$1\\./;
- $text =~ s/^\#/\\#/;
- $text =~ s/\!\[/\\![/g;
- $text =~ s/\]\[/]\\[/g;
-
- $node->attr( text => $text );
- }
-}
-
-# bug #43998
-sub _code_delim {
- my( $self, $node, $rules ) = @_;
- my $contents = $self->get_elem_contents($node);
- return $contents =~ /\`/ ? '``' : '`';
-}
-
-# bug #43996
-sub _decode_entities_in_code {
- my( $self, $node ) = @_;
- my $text = $node->attr('text') || '';
- return unless $text;
-
- HTML::Entities::_decode_entities( $text, { 'amp' => '&', 'lt' => '<', 'gt' => '>' } );
+ my $escapes = join '', @escapes;
+ $text =~ s/([\Q$escapes\E])/\\$1/g;
+ $text =~ s/^([\d]+)\./$1\\./;
+ $text =~ s/^\#/\\#/;
+ $text =~ s/\!\[/\\![/g;
+ $text =~ s/\]\[/]\\[/g;
$node->attr( text => $text );
}
sub postprocess_output {
my( $self, $outref ) = @_;
- $$outref =~ s/\Q$code_block_prefix\E/ /gm;
- $self->_unescape_text($outref);
$self->_add_references($outref);
-}
-
-sub _unescape_text {
- my( $self, $outref ) = @_;
- foreach my $escape ( values %backslash_escapes ) {
- $$outref =~ s/$escape->[0]/$escape->[1]/g;
- }
}
sub _add_references {
More information about the Pkg-perl-cvs-commits
mailing list