[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo/Convert HTML.pm
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo/Convert HTML.pm |
Date: |
Thu, 14 Apr 2011 18:15:00 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/04/14 18:15:00
Modified files:
tp/Texinfo/Convert: HTML.pm
Log message:
Handle @url and @uref.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.21&r2=1.22
Patches:
Index: HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- HTML.pm 13 Apr 2011 22:49:17 -0000 1.21
+++ HTML.pm 14 Apr 2011 18:14:59 -0000 1.22
@@ -338,6 +338,8 @@
my %default_commands_args = (
'email' => [['code'], ['normal']],
'anchor' => [['string']],
+ 'uref' => [['codestring'], ['normal'], ['normal']],
+ 'url' => [['codestring'], ['normal'], ['normal']],
);
# Default for the function references used for the formatting
@@ -526,8 +528,6 @@
delete $style_commands_formatting{'preformatted'}->{'sc'};
# 'key', {'begin' => '<', 'end' => '>'},
-# 'uref', {'function' => \&html_default_uref},
-# 'url', {'function' => \&html_default_uref},
# 'indicateurl', {'begin' => '<<code>', 'end' => '</code>>'},
sub _parse_attribute($)
@@ -602,6 +602,30 @@
$default_commands_conversion{'email'} = \&expand_email;
+sub expand_uref($$$$)
+{
+ my $self = shift;
+ my $cmdname = shift;
+ my $command = shift;
+ my $args = shift;
+
+ my $url_arg = shift @$args;
+ my $text_arg = shift @$args;
+ my $replacement_arg = shift @$args;
+
+ my $url = $url_arg->{'codestring'} if defined($url_arg);
+ my $text = $text_arg->{'normal'} if defined($text_arg);
+ my $replacement = $replacement_arg->{'normal'} if defined($replacement_arg);
+
+ $text = $replacement if (defined($replacement) and $replacement ne '');
+ $text = $url if (!defined($text) or $text eq '');
+ return $text if (!defined($url) or $url eq '');
+ return "<a href=\"$url\">$text</a>";
+}
+
+$default_commands_conversion{'uref'} = \&expand_uref;
+$default_commands_conversion{'url'} = \&expand_url;
+
#sub expand_math($$$$)
#{
# my $self = shift;
@@ -2427,7 +2451,17 @@
$arg_formatted->{'normal'} = $self->_convert($arg);
} elsif ($arg_type eq 'code') {
$self->{'context'}->[-1]->{'code'}++;
- $arg_formatted->{'code'} = $self->_convert($arg);
+ $arg_formatted->{$arg_type} = $self->_convert($arg);
+ $self->{'context'}->[-1]->{'code'}--;
+ } elsif ($arg_type eq 'string') {
+ $self->{'context'}->[-1]->{$arg_type}++;
+ $arg_formatted->{$arg_type} = $self->_convert($arg);
+ $self->{'context'}->[-1]->{$arg_type}--;
+ } elsif ($arg_type eq 'codestring') {
+ $self->{'context'}->[-1]->{'code'}++;
+ $self->{'context'}->[-1]->{'string'}++;
+ $arg_formatted->{$arg_type} = $self->_convert($arg);
+ $self->{'context'}->[-1]->{'string'}--;
$self->{'context'}->[-1]->{'code'}--;
}
}
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/02
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/03
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/03
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/13
- texinfo/tp/Texinfo/Convert HTML.pm,
Patrice Dumas <=
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/17
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/17
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/18
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/24
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/25
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/29
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/30
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/30
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/30
- texinfo/tp/Texinfo/Convert HTML.pm, Patrice Dumas, 2011/04/30