head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.10 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.8 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.6 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.4 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.2 pkgsrc-2009Q4-base:1.2 pkgsrc-2009Q1:1.1.0.8 pkgsrc-2009Q1-base:1.1 pkgsrc-2008Q4:1.1.0.6 pkgsrc-2008Q4-base:1.1 pkgsrc-2008Q3:1.1.0.4 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.2 cube-native-xorg-base:1.1; locks; strict; comment @# @; 1.2 date 2009.05.21.13.42.30; author sno; state dead; branches; next 1.1; 1.1 date 2008.08.01.18.59.02; author schmonz; state Exp; branches; next ; desc @@ 1.2 log @pkgsrc changes: - Updating package for p5 module Text::WikiCreole from 0.05nb2 to 0.07 - Setting gnu-gpl-v2 as license - removing patch to add creole_link creole_barelink (applied upstream) Upstream changes: 0.07 10/5/2008 Bug fix: Italics around links rendered incorrectly 0.06 10/5/2008 Bug fix: & not converted to & where appropriate Feature addition: creole_barelink() and creole_custombarelinks() functions for customized handling of http://google.com style links courtesy of Bernd Zeimetz @ text @$NetBSD: patch-aa,v 1.1 2008/08/01 18:59:02 schmonz Exp $ --- lib/Text/WikiCreole.pm.orig 2007-10-11 17:56:06.000000000 -0400 +++ lib/Text/WikiCreole.pm @@@@ -1,7 +1,8 @@@@ package Text::WikiCreole; require Exporter; @@ISA = (Exporter); -@@EXPORT = qw(creole_parse creole_plugin creole_link creole_tag creole_img creole_customlinks creole_customimgs); +@@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 => " "", }, @@@@ -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. @ 1.1 log @Add patch from Debian package to provide creole_custombarelinks(). Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD$ @