texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo/tp Texinfo/Convert/HTML.pm init/cvs.init


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/HTML.pm init/cvs.init
Date: Sun, 16 Oct 2011 18:43:18 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/10/16 18:43:18

Modified files:
        tp/Texinfo/Convert: HTML.pm 
Added files:
        tp/init        : cvs.init 

Log message:
        Allow to customize the types considered to be in code style.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.185&r2=1.186
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/cvs.init?cvsroot=texinfo&rev=1.1

Patches:
Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -b -r1.185 -r1.186
--- Texinfo/Convert/HTML.pm     16 Oct 2011 08:50:36 -0000      1.185
+++ Texinfo/Convert/HTML.pm     16 Oct 2011 18:43:18 -0000      1.186
@@ -999,6 +999,11 @@
   $css_map{"div.small$indented_format"} = 'margin-left: 3.2em';
 }
 
+# types that are in code style in the default case
+my %default_code_types = (
+ '_code' => 1,
+);
+
 # default specification of arguments formatting
 my %default_commands_args = (
   'email' => [['code', 'codestring'], ['normal']],
@@ -4220,6 +4225,16 @@
           = $default_types_conversion{$type};
     }
   }
+  # FIXME API with a function call?
+  foreach my $type (keys(%default_code_types)) {
+    $self->{'code_types'}->{$type} = $default_code_types{$type};
+  }
+  if ($Texinfo::Config::texinfo_code_types) {
+    foreach my $type (keys(%$Texinfo::Config::texinfo_code_types)) {
+      $self->{'code_types'}->{$type}
+        = $Texinfo::Config::texinfo_code_types->{$type};
+    }
+  }
 
   # FIXME put value in a category in Texinfo::Common?
   foreach my $command (keys(%misc_commands), keys(%brace_commands),
@@ -4749,7 +4764,6 @@
   if (!defined($filename)) {
     cluck("_set_element_file: filename not defined\n");
   }
-# FIXME directory should be the file name!
   $element->{'filename'} = $filename;
   if (defined($self->{'destination_directory'})) {
     $element->{'out_filename'} = $self->{'destination_directory'} . $filename;
@@ -6802,10 +6816,6 @@
       
$self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'paragraph_number'}++;
     } elsif ($root->{'type'} eq 'preformatted') {
       
$self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'preformatted_number'}++;
-    } elsif ($root->{'type'} eq '_code') {
-      $self->{'document_context'}->[-1]->{'code'}++;
-    } elsif ($root->{'type'} eq '_string') {
-      $self->{'document_context'}->[-1]->{'string'}++;
     } elsif ($root->{'type'} eq 'element') { 
       $self->{'current_element'} = $root;
       $self->{'current_filename'} = $root->{'filename'};
@@ -6813,6 +6823,12 @@
       push @{$self->{'document_context'}->[-1]->{'preformatted_classes'}},
         $pre_class_types{$root->{'type'}};
     }
+    if ($self->{'code_types'}->{$root->{'type'}}) {
+      $self->{'document_context'}->[-1]->{'code'}++;
+    }
+    if ($root->{'type'} eq '_string') {
+      $self->{'document_context'}->[-1]->{'string'}++;
+    }
     my $content_formatted;
     if ($root->{'type'} eq 'definfoenclose_command') {
       if ($root->{'args'}) {
@@ -6831,11 +6847,13 @@
     } elsif (defined($content_formatted)) {
       $result = $content_formatted;
     }
-    if ($root->{'type'} eq '_code') {
+    if ($self->{'code_types'}->{$root->{'type'}}) {
       $self->{'document_context'}->[-1]->{'code'}--;
-    } elsif ($root->{'type'} eq '_string') {
+    } 
+    if ($root->{'type'} eq '_string') {
       $self->{'document_context'}->[-1]->{'string'}--;
-    } elsif ($root->{'type'} eq 'element') { 
+    }
+    if ($root->{'type'} eq 'element') { 
       delete $self->{'current_element'};
       delete $self->{'current_filename'};
     } elsif ($pre_class_types{$root->{'type'}}) {

Index: init/cvs.init
===================================================================
RCS file: init/cvs.init
diff -N init/cvs.init
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ init/cvs.init       16 Oct 2011 18:43:18 -0000      1.1
@@ -0,0 +1,3 @@
+use vars qw($texinfo_code_types);
+
+$texinfo_code_types->{'menu_comment'} = 1;



reply via email to

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