Subject: | Pass tags hash to extended links function. |
This is useful, for instance if the link func wants to call format_line
to format the link title.
The attached patch is intended to be applied on top of the patches for
21269 & 21330.
Subject: | text-wikiformat-tagstodelimfuncs.diff |
Index: Changes
===================================================================
RCS file: /cvsroot/Text-MediawikiFormat/Changes,v
retrieving revision 1.3
diff -u -p -r1.3 Changes
--- Changes 7 Sep 2006 20:58:41 -0000 1.3
+++ Changes 8 Sep 2006 16:39:11 -0000
@@ -1,4 +1,5 @@
0.79
+ - the $tags{link} func is now passed the tags hash.
- extended_link_delimiters may now be specified as a regex.
- merge_hash() now copies hashes.
- several nesting bugs fixed.
Index: lib/Text/MediawikiFormat.pm
===================================================================
RCS file: /cvsroot/Text-MediawikiFormat/lib/Text/MediawikiFormat.pm,v
retrieving revision 1.5
diff -u -p -r1.5 MediawikiFormat.pm
--- lib/Text/MediawikiFormat.pm 8 Sep 2006 14:58:28 -0000 1.5
+++ lib/Text/MediawikiFormat.pm 8 Sep 2006 16:39:11 -0000
@@ -418,15 +418,16 @@ sub find_extended_links
while (my @pieces = find_innermost_balanced_pair ($text, $start, $end))
{
my ($tag, $before, $after) = map { defined $_ ? $_ : '' } @pieces;
- my $extended = $tags->{link}->( $tag, $opts ) || '';
+ my $extended = $tags->{link}->( $tag, $opts, $tags )
+ || '';
$text = $before . $extended . $after;
}
}
else
{
# Regexp
- $text =~ s/$tags->{extended_link_delimiters}/$tags->{link}->($1,
- $opts)/ge;
+ $text =~ s/$tags->{extended_link_delimiters}/$tags->{link}->($1, $opts,
+ $tags)/ge;
}
return $text;