texinfo-commits
[Top][All Lists]
Advanced

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

[6107] alphabetizing, formatting, etc.; no functional changes


From: karl
Subject: [6107] alphabetizing, formatting, etc.; no functional changes
Date: Sun, 08 Feb 2015 17:09:43 +0000

Revision: 6107
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6107
Author:   karl
Date:     2015-02-08 17:09:42 +0000 (Sun, 08 Feb 2015)
Log Message:
-----------
alphabetizing, formatting, etc.; no functional changes

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/DocBook.pm

Property Changed:
----------------
    trunk/tp/Texinfo/Convert/DocBook.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-02-07 11:21:33 UTC (rev 6106)
+++ trunk/ChangeLog     2015-02-08 17:09:42 UTC (rev 6107)
@@ -1,3 +1,8 @@
+2015-02-08  Karl Berry  <address@hidden>
+
+       * tp/Texinfo/Convert/DocBook.pm: alphabetize, format, debugging;
+       no functional changes.
+
 2015-02-07  Gavin Smith  <address@hidden>
 
        * info/session.c (incremental_search): For searches uses regex, 
@@ -12,6 +17,7 @@
 
 2015-02-06  Karl Berry  <address@hidden>
 
+       * doc/texinfo.texi: let's mark the info quote proposal explicitly
        * texindex/Makefile.am (ti.info, ti.html): let's generate files by
        these names, since it is not a user manual, hence not intended to be
        installed in the Info directory.  @setfilename remains texindex

Modified: trunk/tp/Texinfo/Convert/DocBook.pm
===================================================================
--- trunk/tp/Texinfo/Convert/DocBook.pm 2015-02-07 11:21:33 UTC (rev 6106)
+++ trunk/tp/Texinfo/Convert/DocBook.pm 2015-02-08 17:09:42 UTC (rev 6107)
@@ -1,6 +1,7 @@
+# $Id$
 # DocBook.pm: output tree as DocBook.
 #
-# Copyright 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+# Copyright 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -53,15 +54,15 @@
 @EXPORT = qw(
 );
 
-$VERSION = '5.1.90';
+$VERSION = '5.1.91';
 
+my $nbsp = '&#'.hex('00A0').';';
 my $mdash = '&#'.hex('2014').';';
 my $ndash = '&#'.hex('2013').';';
 my $ldquo = '&#'.hex('201C').';';
 my $rdquo = '&#'.hex('201D').';';
+my $lsquo = '&#'.hex('2018').';';
 my $rsquo = '&#'.hex('2019').';';
-my $lsquo = '&#'.hex('2018').';';
-my $nbsp = '&#'.hex('00A0').';';
 
 my %defaults = (
   #'ENABLE_ENCODING'      => 0,
@@ -81,13 +82,14 @@
   = ('eps', 'gif', 'jpg', 'jpeg', 'pdf', 'png', 'svg');
 
 my %docbook_special_quotations;
-foreach my $special_quotation ('note', 'caution', 'important', 'tip', 
'warning') {
+foreach my $special_quotation (
+    'caution', 'important', 'note', 'tip', 'warning') {
   $docbook_special_quotations{$special_quotation} = 1;
 }
 
 # For '*', there is no line break in DocBook, except in cmdsynopsis (in this
-# case it is <sbr>.  But currently we don't use cmdsynopsis, and it is unlikely
-# that cmdsynopsis is ever used.
+# case it is <sbr>).  But currently we don't use cmdsynopsis, and it is
+# unlikely we ever will.
 my %docbook_specific_formatting = (
   'TeX' => '&tex;',
   'LaTeX' => '&latex;',
@@ -135,24 +137,23 @@
       'emph'        => 'emphasis',
       'env'         => 'envar',
       'file'        => 'filename',
-      'headitemfont' => 'emphasis role="bold"', # not really that, in fact it 
is 
-                             # in <th> rather than <td>
+      'footnote'    => 'footnote',
+      'headitemfont' => 'emphasis role="bold"', # actually <th> instead of <td>
       'i'           => 'emphasis',
       'indicateurl' => 'literal',
-      'sansserif'   => '',
       'kbd'         => 'userinput',
       'key'         => 'keycap',
+      'math'        => 'mathphrase',
       'option'      => 'option',
       'r'           => '',
       'samp'        => 'literal',
+      'sansserif'   => '',
       'strong'      => 'emphasis role="bold"',
       'sub'         => 'subscript',
       'sup'         => 'superscript',
       't'           => 'literal',
       'var'         => 'replaceable',
       'verb'        => 'literal',
-      'footnote'    => 'footnote',
-      'math'        => 'mathphrase',
 );
 
 # this weird construct does like uniq, it avoids duplicates.
@@ -161,7 +162,7 @@
 my @all_style_commands = keys %{{ map { $_ => 1 }
     (keys(%Texinfo::Common::style_commands), keys(%style_attribute_commands),
      'w', 'dmn', 'titlefont') }};
-# 'w' is special
+# special string for 'w'.
 my $w_command_mark = '<!-- /@w -->';
 
 my %style_commands_formatting;
@@ -193,8 +194,8 @@
 }
 
 my %docbook_global_commands = (
+  'documentencoding' => 1,
   'documentlanguage' => 1,
-  'documentencoding' => 1,
 );
 
 sub converter_global_commands($)
@@ -207,15 +208,15 @@
 my %regular_font_style_commands = 
%Texinfo::Common::regular_font_style_commands;
 
 my %defcommand_name_type = (
+ 'defcv'     => 'property',
  'deffn'     => 'function',
- 'defvr'     => 'varname',
+ 'defop'     => 'methodname',
+ 'deftp'     => 'structname',
+ 'deftypecv' => 'property',
  'deftypefn' => 'function',
  'deftypeop' => 'methodname',
  'deftypevr' => 'varname',
- 'defcv'     => 'property',
- 'deftypecv' => 'property',
- 'defop'     => 'methodname',
- 'deftp'     => 'structname',
+ 'defvr'     => 'varname',
 );
 
 my %def_argument_types_docbook = (
@@ -227,16 +228,18 @@
 
 
 my %ignored_types;
-foreach my $type ('empty_line_after_command',
+foreach my $type (
+           'empty_line_after_command',
+            'empty_space_at_end_def_bracketed',
+            'empty_spaces_after_close_brace', 
+            'empty_spaces_after_command', 
+            'empty_spaces_before_argument',
+            'empty_spaces_before_paragraph',
+            'menu_entry_leading_text',
+            'menu_entry_separator',
             'preamble',
             'preamble_before_setfilename',
-            'empty_spaces_after_command', 
             'spaces_at_end',
-            'empty_spaces_before_argument', 'empty_spaces_before_paragraph',
-            'empty_spaces_after_close_brace', 
-            'empty_space_at_end_def_bracketed',
-            'menu_entry_separator',
-            'menu_entry_leading_text',
   ) {
   $ignored_types{$type} = 1;
 }
@@ -276,6 +279,7 @@
   return %defaults;
 }
 
+
 sub converter_initialize($)
 {
   my $self = shift;
@@ -449,8 +453,7 @@
   my $element = shift;
   return ('', '') if (!defined($element));
   my $attributes = '';
-  if ($element =~ /^(\w+)(\s+.*)/)
-  {
+  if ($element =~ /^(\w+)(\s+.*)/) {
     $element = $1;
     $attributes = $2;
   }
@@ -467,6 +470,7 @@
   return $result;
 }
 
+
 sub _convert($$;$);
 
 sub _convert($$;$)
@@ -474,13 +478,13 @@
   my $self = shift;
   my $root = shift;
 
-  if (0) {
   #if (1) {
-    print STDERR "root\n";
-    print STDERR "  Command: $root->{'cmdname'}\n" if ($root->{'cmdname'});
-    print STDERR "  Type: $root->{'type'}\n" if ($root->{'type'});
-    print STDERR "  Text: $root->{'text'}\n" if (defined($root->{'text'}));
-    #print STDERR "  Special def_command: $root->{'extra'}->{'def_command'}\n"
+  if (0) { # too verbose even for debugging, but for the bottom line ...
+    warn "root\n";
+    warn "  Command: $root->{'cmdname'}\n" if ($root->{'cmdname'});
+    warn "  Type: $root->{'type'}\n" if ($root->{'type'});
+    warn "  Text: $root->{'text'}\n" if (defined($root->{'text'}));
+    #warn "  Special def_command: $root->{'extra'}->{'def_command'}\n"
     #  if (defined($root->{'extra'}) and $root->{'extra'}->{'def_command'});
   }
 
@@ -507,11 +511,16 @@
         $result =~ s/--/$ndash/g;
       }
     }
+    #warn "had text `$root->{'text'}', returning $result\n";
     return $result;
   }
+
+  #warn " onto main conditional\n";
   my @close_elements;
   if ($root->{'cmdname'}) {
+    #warn "  got cmdname $root->{'cmdname'}\n";
     if (defined($docbook_commands_formatting{$root->{'cmdname'}})) {
+      #warn "  has commands_formatting \n";
       my $command;
       if ($root->{'cmdname'} eq 'click' 
           and $root->{'extra'} 
@@ -551,8 +560,9 @@
        #   $result .= $self->_convert({'contents'
        # => 
$root->{'parent'}->{'extra'}->{'block_command_line_contents'}->[0]})
        #     ." ";
-          $self->{'pending_prepend'} = $self->_convert({'contents'
-       => $root->{'parent'}->{'extra'}->{'block_command_line_contents'}->[0]}) 
." ";
+          $self->{'pending_prepend'} = $self->_convert(
+            {'contents' => $root->{'parent'}->{'extra'}
+                           ->{'block_command_line_contents'}->[0]}) . " ";
         }
         push @close_elements, 'listitem';
       } elsif (($root->{'cmdname'} eq 'item' or $root->{'cmdname'} eq 'itemx')
@@ -593,7 +603,9 @@
         $end_line = '';
       }
       return $self->_index_entry($root).${end_line};
+
     } elsif (exists($docbook_misc_commands{$root->{'cmdname'}})) {
+      #warn "  is dbk misc command\n";
       if ($docbook_global_commands{$root->{'cmdname'}}) {
         $self->_informative_command($root);
         return '';
@@ -716,9 +728,9 @@
           return '';
         }
       }
+
     } elsif ($root->{'type'}
              and $root->{'type'} eq 'definfoenclose_command') {
-
       my $in_monospace_not_normal;
       if (defined($default_args_code_style{$root->{'cmdname'}})
           and $default_args_code_style{$root->{'cmdname'}}->[0]) {
@@ -734,8 +746,11 @@
                 .$self->xml_protect_text($root->{'extra'}->{'end'});
       pop @{$self->{'document_context'}->[-1]->{'monospace'}}
         if (defined($in_monospace_not_normal));
+
+
     } elsif ($root->{'args'}
              and exists($Texinfo::Common::brace_commands{$root->{'cmdname'}})) 
{
+      #debug_list (" brace command with args", $root->{'args'});
       if ($style_commands_formatting{$root->{'cmdname'}}) {
         if ($Texinfo::Common::context_brace_commands{$root->{'cmdname'}}) {
           push @{$self->{'document_context'}}, {'monospace' => [0], 
'upper_case' => [0]};
@@ -1082,17 +1097,23 @@
         if ($root->{'cmdname'} eq 'inlineraw') {
           pop @{$self->{'document_context'}};
         }
+        #warn "  returning braced cmd result $result\n";
         return $result;
       } else {
         # ignored brace command
+        #warn "  returning empty string for ignored braced cmd\n";
         return '';
       }
+
+
     # special case to ensure that @w leads to something even if empty
     } elsif ($root->{'cmdname'} eq 'w') {
       return $w_command_mark;
+
     } elsif (exists($Texinfo::Common::block_commands{$root->{'cmdname'}})) {
       if ($self->{'context_block_commands'}->{$root->{'cmdname'}}) {
-        push @{$self->{'document_context'}}, {'monospace' => [0], 'upper_case' 
=> [0]};
+        push (@{$self->{'document_context'}},
+              {'monospace' => [0], 'upper_case' => [0]});
       }
       my @attributes;
       my $appended = '';
@@ -1210,7 +1231,11 @@
       $result .= $appended if (defined($appended));
     }
   }
+  #warn " end of cmdname\n";
+
+
   if ($root->{'type'}) {
+    #warn " have type $root->{'type'}\n"; 
     if (exists($docbook_preformatted_formats{$root->{'type'}})) {
       push @{$self->{'document_context'}->[-1]->{'preformatted_stack'}}, 
          $docbook_preformatted_formats{$root->{'type'}};
@@ -1243,7 +1268,7 @@
             $result .= 
"<$defcommand_name_type{$main_command}>$content</$defcommand_name_type{$main_command}>";
           } else {
             if (!defined($def_argument_types_docbook{$type})) {
-              print STDERR "BUG: no def_argument_types_docbook for $type\n";
+              warn "BUG: no def_argument_types_docbook for $type";
               next;
             }
             foreach my $element (reverse (
@@ -1259,7 +1284,9 @@
       $result .= "\n";
     }
   }
+
   if ($root->{'contents'}) {
+    #warn " have contents $root->{'contents'}\n";
     my $in_code;
     if ($root->{'cmdname'} 
         and $Texinfo::Common::preformatted_code_commands{$root->{'cmdname'}}) {
@@ -1280,6 +1307,7 @@
     pop @{$self->{'document_context'}->[-1]->{'monospace'}}
       if ($in_code);
   }
+
   if ($root->{'type'}) {
     if (defined($type_elements{$root->{'type'}})) {
       $result .= "</$type_elements{$root->{'type'}}>";
@@ -1296,6 +1324,7 @@
   foreach my $element (@close_elements) {
     $result .= "</$element>";
   }
+  
   if ($root->{'cmdname'} 
       and exists($Texinfo::Common::block_commands{$root->{'cmdname'}})) {
     # a pending_prepend still there may happen if a quotation is empty.
@@ -1314,10 +1343,12 @@
     if ($self->{'context_block_commands'}->{$root->{'cmdname'}}) {
       pop @{$self->{'document_context'}};
     }
+
   } elsif ($root->{'type'} and 
exists($docbook_preformatted_formats{$root->{'type'}})) {
     my $format = pop 
@{$self->{'document_context'}->[-1]->{'preformatted_stack'}};
     die "BUG $format ne $docbook_preformatted_formats{$root->{'type'}}"
       if ($format ne $docbook_preformatted_formats{$root->{'type'}});
+
   # The command is closed either when the corresponding tree element
   # is done, and the command is not associated to an element, or when
   # the element is closed.
@@ -1353,6 +1384,8 @@
       }
     }
   }
+  
+  #warn " returning $result\n";
   return $result;
 }
 
@@ -1384,7 +1417,7 @@
 
 =item $converter = Texinfo::Convert::DocBook->converter($options)
 
-Initialize an DocBook converter.  
+Initialize a DocBook converter.  
 
 The I<$options> hash reference holds options for the converter.  In
 this option hash reference a parser object may be associated with the 
@@ -1406,16 +1439,10 @@
 
 =item $result = $converter->convert_tree($tree)
 
-Convert a Texinfo tree portion I<$tree> and return the resulting 
-output.  This function do not try to output a full document but only
-portions of document.  For a full document use C<convert>.
+Convert a Texinfo tree portion I<$tree> and return the resulting output.
+This function do not try to output a full document but only portions.
+For a full document use C<convert>.
 
-=item $result = $converter->output_internal_links()
-
-Returns text representing the links in the document.  At present the format 
-should follow the C<--internal-links> option of texi2any/makeinfo specification
-and this is only relevant for HTML.
-
 =back
 
 =head1 AUTHOR
@@ -1424,7 +1451,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2012 Free Software Foundation, Inc.
+Copyright 2015 Free Software Foundation, Inc.
 
 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by


Property changes on: trunk/tp/Texinfo/Convert/DocBook.pm
___________________________________________________________________
Added: svn:keywords
   + Date Author Id




reply via email to

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