texinfo-commits
[Top][All Lists]
Advanced

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

texinfo ChangeLog TODO tp/MANIFEST tp/Makefile....


From: Patrice Dumas
Subject: texinfo ChangeLog TODO tp/MANIFEST tp/Makefile....
Date: Sun, 15 Jan 2012 20:51:15 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/01/15 20:51:15

Modified files:
        .              : ChangeLog TODO 
        tp             : MANIFEST Makefile.am texi2any.pl 
Added files:
        tp/Texinfo/Convert: TextContent.pm 

Log message:
                * tp/texi2any.pl, tp/Texinfo/Convert/TextContent.pm, 
tp/Makefile.am, TODO: 
                New converter that strips commands from output.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/ChangeLog?cvsroot=texinfo&r1=1.1306&r2=1.1307
http://cvs.savannah.gnu.org/viewcvs/texinfo/TODO?cvsroot=texinfo&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/MANIFEST?cvsroot=texinfo&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Makefile.am?cvsroot=texinfo&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.101&r2=1.102
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/TextContent.pm?cvsroot=texinfo&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/texinfo/texinfo/ChangeLog,v
retrieving revision 1.1306
retrieving revision 1.1307
diff -u -b -r1.1306 -r1.1307
--- ChangeLog   15 Jan 2012 15:23:17 -0000      1.1306
+++ ChangeLog   15 Jan 2012 20:51:14 -0000      1.1307
@@ -4,6 +4,9 @@
        remove @-commands that have no effect and add new @-commands available
        as customization options.
 
+       * tp/texi2any.pl, tp/Texinfo/Convert/TextContent.pm, tp/Makefile.am, 
TODO: 
+       New converter that strips commands from output.
+
 2012-01-14  Patrice Dumas  <address@hidden>
 
        Move tests from texi2html that are still relevant to tp.

Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/TODO,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- TODO        8 Dec 2011 20:34:41 -0000       1.58
+++ TODO        15 Jan 2012 20:51:14 -0000      1.59
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.58 2011/12/08 20:34:41 pertusus Exp $
+$Id: TODO,v 1.59 2012/01/15 20:51:14 pertusus Exp $
 This is the todo list for GNU Texinfo.
 If you are interested in working on any of these, email address@hidden
 
@@ -71,10 +71,6 @@
 * Makeinfo:
   - add automatic generation of @node and @menu.
   - Improve the HTML customization API.
-  - A detexinfo program, like detex or delatex.  This command would
-    strip all the texinfo commands out, and would be used as a filter on
-    the way to a speller.  An option would be to NOT strip comments out.
-    makeinfo --set RAW_TEXT comes close.
   - HTML: support thumbnails.
   - HTML: have a library of different CSS styles.
     http://mail.gnu.org/archive/html/bug-texinfo/2004-01/msg00025.html

Index: tp/MANIFEST
===================================================================
RCS file: /sources/texinfo/texinfo/tp/MANIFEST,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- tp/MANIFEST 14 Jan 2012 13:28:52 -0000      1.16
+++ tp/MANIFEST 15 Jan 2012 20:51:14 -0000      1.17
@@ -64,6 +64,7 @@
 Texinfo/Convert/Paragraph.pm
 Texinfo/Convert/Plaintext.pm
 Texinfo/Convert/Texinfo.pm
+Texinfo/Convert/TextContent.pm
 Texinfo/Convert/Text.pm
 Texinfo/Convert/UnFilled.pm
 Texinfo/Convert/Unicode.pm

Index: tp/Makefile.am
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Makefile.am,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- tp/Makefile.am      15 Jan 2012 13:59:44 -0000      1.25
+++ tp/Makefile.am      15 Jan 2012 20:51:14 -0000      1.26
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.25 2012/01/15 13:59:44 pertusus Exp $
+# $Id: Makefile.am,v 1.26 2012/01/15 20:51:14 pertusus Exp $
 # Makefile.am for texinfo/tp.
 #
 # Copyright 2011 Free Software Foundation, Inc.
@@ -62,6 +62,7 @@
  Texinfo/Convert/HTML.pm \
  Texinfo/Convert/DocBook.pm \
  Texinfo/Convert/Text.pm \
+ Texinfo/Convert/TextContent.pm \
  Texinfo/Convert/UnFilled.pm \
  Texinfo/Convert/Paragraph.pm \
  Texinfo/Convert/Line.pm \

Index: tp/texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- tp/texi2any.pl      7 Jan 2012 19:25:03 -0000       1.101
+++ tp/texi2any.pl      15 Jan 2012 20:51:14 -0000      1.102
@@ -185,6 +185,7 @@
 require Texinfo::Convert::HTML;
 require Texinfo::Convert::XML;
 require Texinfo::Convert::DocBook;
+require Texinfo::Convert::TextContent;
 require DebugTexinfo::DebugCount;
 require DebugTexinfo::DebugTree;
 
@@ -763,6 +764,8 @@
        $format = 'debugtree';
      } elsif ($var eq 'RAW_TEXT') {
        $format = 'raw_text';
+     } elsif ($var eq 'TEXTCONTENT') {
+       $format = 'textcontent';
      } else {
        set_from_cmdline ($var, $value);
        # FIXME do that here or when all command line options are processed?
@@ -887,6 +890,9 @@
           'split' => 1,
           'converter' => sub{DebugTexinfo::DebugTree->converter(@_)},
          },
+  'textcontent' => {
+            'converter' => sub{Texinfo::Convert::TextContent->converter(@_)},
+           },
   'raw_text' => {
             'converter' => sub{Texinfo::Convert::Text->converter(@_)},
            },

Index: tp/Texinfo/Convert/TextContent.pm
===================================================================
RCS file: tp/Texinfo/Convert/TextContent.pm
diff -N tp/Texinfo/Convert/TextContent.pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tp/Texinfo/Convert/TextContent.pm   15 Jan 2012 20:51:14 -0000      1.1
@@ -0,0 +1,174 @@
+# TextContent.pm: return the text contents stripped of commands
+#
+# Copyright 2011 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
+# the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# 
+# Original author: Patrice Dumas <address@hidden>
+
+package Texinfo::Convert::TextContent;
+
+use 5.00405;
+use strict;
+
+use Texinfo::Convert::Converter;
+use Texinfo::Convert::Text;
+use Texinfo::Common;
+
+use vars qw($VERSION @ISA);
address@hidden = qw(Texinfo::Convert::Converter);
+
+my %ignored_brace_commands;
+# Handle better @errormsg?
+foreach my $ignored_brace_command ('hyphenation', 'errormsg') {
+  $ignored_brace_commands{$ignored_brace_command} = 1;
+}
+my %ignored_block_commands;
+foreach my $ignored_command ('titlepage', 'copying', 'documentdescription',
+  'html', 'tex', 'xml', 'docbook', 'ignore', 'macro', 'rmacro') {
+  $ignored_block_commands{$ignored_command} = 1;
+}
+
+my %ignored_types;
+foreach my $type ('empty_line_after_command', 'preamble',
+            'empty_spaces_after_command',
+            'empty_spaces_before_paragraph',
+            'empty_spaces_after_close_brace',
+            'empty_space_at_end_def_bracketed') {
+  $ignored_types{$type} = 1;
+}
+
+my %defaults = (
+  'SHOW_MENU'            => 1,
+  'OUTFILE'              => '-',
+);
+
+sub converter_defaults($)
+{
+  return %defaults;
+}
+
+sub converter_initialize($)
+{
+  my $self = shift;
+  
+  %{$self->{'formatting_misc_commands'}}
+    = %Texinfo::Convert::Text::formatting_misc_commands;
+
+  #if ($self->get_conf('KEEP_COMMENTS')) {
+  #  $self->{'formatting_misc_commands'}->{'c'} = 1;
+  #  $self->{'formatting_misc_commands'}->{'comment'} = 1;
+  #}
+}
+
+sub convert_tree($$)
+{
+  my $self = shift;
+  my $root = shift;
+
+  return $self->_convert($root);
+}
+
+sub convert($$)
+{
+  my $self = shift;
+  my $root = shift;
+
+  return $self->_convert($root);
+}
+
+sub _convert($$);
+
+sub _convert($$)
+{
+  my $self = shift;
+  my $root = shift;
+
+  if (0) {
+    print STDERR "root $root";
+    print STDERR " cmd: address@hidden>{'cmdname'}," if ($root->{'cmdname'});
+    print STDERR " type: $root->{'type'}," if ($root->{'type'});
+    my $text = $root->{'text'};
+    if (defined($text)) {
+      $text =~ s/\n/\\n/;
+      print STDERR " text: `$text'";
+    }
+    print STDERR "\n";
+    #print STDERR "  Special def_command: $root->{'extra'}->{'def_command'}\n"
+    #  if (defined($root->{'extra'}) and $root->{'extra'}->{'def_command'});
+  }
+
+  return '' if (!($root->{'type'} and $root->{'type'} eq 'def_line')
+     and (($root->{'type'} and $ignored_types{$root->{'type'}})
+          or ($root->{'cmdname'}
+             and ($ignored_brace_commands{$root->{'cmdname'}}
+                 or ($ignored_block_commands{$root->{'cmdname'}}
+                     and !(defined($self->{'expanded_formats_hash'})
+                           and 
$self->{'expanded_formats_hash'}->{$root->{'cmdname'}}))
+                 or 
($Texinfo::Common::inline_format_commands{$root->{'cmdname'}}
+                     and (!$root->{'extra'}->{'format'}
+                          or 
!$self->{'expanded_formats_hash'}->{$root->{'extra'}->{'format'}}))
+                 or ($root->{'cmdname'} eq 'menu' and 
!$self->get_conf('SHOW_MENU'))
+             # here ignore most of the misc commands
+                 or ($root->{'args'} and $root->{'args'}->[0]
+                     and $root->{'args'}->[0]->{'type'}
+                     and ($root->{'args'}->[0]->{'type'} eq 'misc_line_arg'
+                         or $root->{'args'}->[0]->{'type'} eq 'misc_arg')
+                     and 
!$self->{'formatting_misc_commands'}->{$root->{'cmdname'}})))));
+  if (defined($root->{'text'})) {
+    return $root->{'text'};
+  }
+  if (defined($root->{'cmdname'})) {
+    if (exists($Texinfo::Common::no_brace_commands{$root->{'cmdname'}})) {
+      return $Texinfo::Common::no_brace_commands{$root->{'cmdname'}};
+    } elsif ($root->{'cmdname'} eq 'today') {
+      my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
+        = localtime(time);
+      $year += ($year < 70) ? 2000 : 1900;
+      return "$Texinfo::Common::MONTH_NAMES[$mon] $mday, $year";
+    } elsif 
(defined($Texinfo::Convert::Text::text_brace_no_arg_commands{$root->{'cmdname'}}))
 {
+      return Texinfo::Convert::Text::brace_no_arg_command($root, undef);
+    } elsif ($Texinfo::Common::accent_commands{$root->{'cmdname'}}) {
+      my %options = Texinfo::Common::_convert_text_options($self);
+      my $result = Texinfo::Convert::Text::text_accents ($root, 
+                                        $options{'enabled_encoding'});
+      return $result;
+    }
+  }
+  my $result = '';
+  if ($root->{'args'} 
+      and (!$root->{'cmdname'} 
+           or !$Texinfo::Common::block_item_commands{$root->{'cmdname'}})) {
+    #if ($root->{'type'} and ($root->{'type'} eq 'def_line'
+    #                         or $root->{'type'} eq 'menu_entry')) { 
+    #}
+    foreach my $arg (@{$root->{'args'}}) {
+      $result .= _convert ($self, $arg);
+    }
+  }
+  if ($root->{'contents'}) {
+    foreach my $content (@{$root->{'contents'}}) {
+      $result .= _convert ($self, $content);
+    }
+  }
+  $result = '{'.$result.'}'
+     if ($root->{'type'} and $root->{'type'} eq 'bracketed'
+         and (!$root->{'parent'}->{'type'} or
+              ($root->{'parent'}->{'type'} ne 'block_line_arg'
+               and $root->{'parent'}->{'type'} ne 'misc_line_arg')));
+
+  return $result;
+}
+
+1;



reply via email to

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