texinfo-commits
[Top][All Lists]
Advanced

[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: Mon, 09 May 2011 19:30:18 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/05/09 19:30:17

Modified files:
        tp/Texinfo/Convert: HTML.pm 

Log message:
        Handle preformatted commands formatting.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.56&r2=1.57

Patches:
Index: HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- HTML.pm     9 May 2011 17:53:08 -0000       1.56
+++ HTML.pm     9 May 2011 19:30:17 -0000       1.57
@@ -744,6 +744,7 @@
   'NODE_NAME_IN_MENU'    => 1,
   'NODE_NAME_IN_INDEX'   => 1,
   'SHORT_REF'            => 1,
+  'COMPLEX_FORMAT_IN_TABLE' => 0,
   'WORDS_IN_PAGE'        => 300,
   'SECTION_BUTTONS'      => [[ 'NodeNext', \&_default_node_direction ],
                              [ 'NodePrev', \&_default_node_direction ],
@@ -1633,6 +1634,35 @@
   $default_commands_conversion{$command} = \&_convert_raw_command;
 }
 
+my %indented_preformatted_commands;
+foreach my $indented_format ('example', 'display', 'lisp') {
+  $indented_preformatted_commands{$indented_format} = 1;
+  $indented_preformatted_commands{"small$indented_format"} = 1;
+}
+
+sub _convert_preformatted_commands($$$$)
+{
+  my $self = shift;
+  my $cmdname = shift;
+  my $command = shift;
+  my $content = shift;
+
+  if ($self->get_conf('COMPLEX_FORMAT_IN_TABLE')) {
+    if ($indented_preformatted_commands{$cmdname}) {
+      return '<table><tr><td>&nbsp;</td><td>'.$content."</td></tr></table>\n";
+    } else {
+      return $content."\n";
+    }
+  } else {
+    return $self->attribute_class('div', 
$cmdname).">\n".$content.'</div>'."\n";
+  }
+}
+
+foreach my $preformatted_command (keys(%preformatted_commands)) {
+  $default_commands_conversion{$preformatted_command} 
+  = \&_convert_preformatted_commands;
+}
+
 sub _convert_verbatim_command($$$$)
 {
   my $self = shift;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]