Subject: | Allow http:// link without [] |
The patch adds support for plain unlabelled http://example.com links in WikiFormat (without [] around the link). It's a standard thing to have in a Wiki.
see
http://c2.com/cgi-bin/wiki?TextFormattingRules
Version 0.03
This is perl, v5.6.1 built for i386-linux
Linux sandbox 2.2.17 #1 Sun Jun 25 09:24:41 EST 2000 i686 unknown unknown GNU/Linux
--- SAX.pm.orig 2003-01-03 16:27:25.000000000 -0800
+++ SAX.pm 2003-04-12 13:36:43.000000000 -0700
@@ -108,7 +108,7 @@
foreach my $line (split(/\n/, $text)) {
if ($line =~ /$indent(.*)$/) {
my $match = $1;
- if ($match =~ /([\dA-Za-z]+)\.\s*(.*)$/) {
+ if ($match =~ /([0-9]+)\.\s*(.*)$/) { #[\dA-Za-z]+
# ordered list
my $value = $1;
my $data = $2;
@@ -199,11 +199,13 @@
sub _format_line {
my ($self, $text, $strong, $emphasized, $line, $link, $data) = @_;
-
+
+ #---- horizontal line
if ($text =~ s/^-{4,}//) {
$line->();
}
-
+
+ #'''strong''', ''emphasized''
if ($text =~ s/^(.*?)('')/$2/) {
$self->_format_line($1, $strong, $emphasized, $line, $link, $data);
if ($text =~ s/^'''(.*?)'''//) {
@@ -217,10 +219,17 @@
$data->($1);
}
}
+ #[name|link]
elsif ($text =~ s/^(.*?)\[([^\]]+)\]//) {
$self->_format_line($1, $strong, $emphasized, $line, $link, $data);
$link->($2);
}
+ #plain http
+ elsif ($text =~ s/^(.*?)(http:\/\/\S+)\s*//) {
+ $self->_format_line($1, $strong, $emphasized, $line, $link, $data);
+ $link->($2);
+ }
+ #CamelCase link
elsif ($text =~ s|^(.*?)(?<!["/>=])\b([A-Za-z]+(?:[A-Z]\w+)+)||) {
$data->($1);
$link->($2);