[libtext-wikicreole-perl] 02/24: Adding patch to allow custom "bare" link handling.

gregor herrmann gregoa at debian.org
Thu Sep 7 18:17:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libtext-wikicreole-perl.

commit 667c98bdc01f0c12b31bca623236f6bbf05190d3
Author: Bernd Zeimetz <bernd at bzed.de>
Date:   Sat Jun 21 02:41:22 2008 +0200

    Adding patch to allow custom "bare" link handling.
---
 debian/patches/creole-barelink.patch | 79 ++++++++++++++++++++++++++++++++++++
 debian/patches/series                |  1 +
 2 files changed, 80 insertions(+)

diff --git a/debian/patches/creole-barelink.patch b/debian/patches/creole-barelink.patch
new file mode 100644
index 0000000..9026232
--- /dev/null
+++ b/debian/patches/creole-barelink.patch
@@ -0,0 +1,79 @@
+--- a/lib/Text/WikiCreole.pm
++++ b/lib/Text/WikiCreole.pm
+@@ -1,7 +1,8 @@
+ package Text::WikiCreole;
+ require Exporter;
+ @ISA = (Exporter);
+- at EXPORT = qw(creole_parse creole_plugin creole_link creole_tag creole_img creole_customlinks creole_customimgs);
++ at EXPORT = qw(creole_parse creole_plugin creole_tag creole_img creole_customimgs
++             creole_link creole_barelink creole_customlinks creole_custombarelinks);
+ use vars qw($VERSION);
+ use strict;
+ use warnings;
+@@ -44,6 +45,8 @@ my $bol = '(?:^|\n)'; # beginning of lin
+ my $plugin_function;
+ # user-supplied link URL parser function
+ my $link_function;
++# user-supplied bare link parser function
++my $barelink_function;
+ # user-supplied image URL parser function
+ my $img_function;
+ 
+@@ -321,9 +324,12 @@ my %chunks = (
+     curpat => '(?=(?:https?|ftp):\/\/)',
+     stops => '(?=[[:punct:]]?(?:\s|$))',
+     hint => ['h', 'f'],
+-    filter => sub { 
++    filter => sub {
+       $_[0] =~ s/^\s*//o;
+       $_[0] =~ s/\s*$//o;
++      if($barelink_function) {
++        $_[0] = &$barelink_function($_[0]);
++      }
+       return "href=\"$_[0]\">$_[0]"; },
+     open => "<a ", close=> "</a>",
+   },
+@@ -643,6 +649,22 @@ sub creole_customlinks {
+   }
+ }
+ 
++sub creole_barelink {
++  return unless defined $_[0];
++  $barelink_function = $_[0];
++}
++
++sub creole_custombarelinks {
++  $chunks{ilink}{open} = "";
++  $chunks{ilink}{close} = "";
++  $chunks{ilink}{filter} = sub {
++    if($barelink_function) {
++      $_[0] = &$barelink_function($_[0]);
++    }
++    return $_[0];
++  }
++}
++
+ sub creole_customimgs {
+   $chunks{img}{open} = "";
+   $chunks{img}{close} = "";
+@@ -756,6 +778,20 @@ reads Creole 1.0 markup and returns XHTM
+   
+     This has no effect on "bare" link markup, such as http://cpan.org.
+ 
++=head2 creole_barelink
++
++    Same purpose as creole_link, but for "bare" link markup.
++
++    sub mybarelink {
++      return "$_[0].html";
++      return $_[0];
++    }
++    creole_barelink \&mybarelink;
++
++=head2 creole_custombarelinks
++
++    Same purpose as creole_customlinks, but for "bare" link markup.
++
+ =head2 creole_img
+ 
+     Same purpose as creole_link, but for image URLs.
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..f207b92
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+creole-barelink.patch #allow custom 'bare' link handling

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtext-wikicreole-perl.git



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