[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo tp/TODO tp/Texinfo/Common.pm tp/Texinfo...
From: |
Patrice Dumas |
Subject: |
texinfo tp/TODO tp/Texinfo/Common.pm tp/Texinfo... |
Date: |
Sun, 27 Mar 2011 08:24:57 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/03/27 08:24:56
Modified files:
tp : TODO
tp/Texinfo : Common.pm Parser.pm Structuring.pm
tp/Texinfo/Convert: Converter.pm
tp/t : 08misc_commands.t
util : txicmdlist
Added files:
tp/t/results/misc_commands: command_in_heading_footing.pl
Log message:
Handle commands like @this*.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.114&r2=1.115
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.228&r2=1.229
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/08misc_commands.t?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/misc_commands/command_in_heading_footing.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/util/txicmdlist?cvsroot=texinfo&r1=1.1&r2=1.2
Patches:
Index: tp/TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- tp/TODO 20 Mar 2011 13:00:29 -0000 1.114
+++ tp/TODO 27 Mar 2011 08:24:54 -0000 1.115
@@ -1,3 +1,48 @@
+API HTML:
+
+* user wanting to change how a command/type is formatted can pass a reference
+ on a function used to format the command. For example:
+
+%commands_conversion{'quotation'} = \&my_quotation_convert_function;
+
+* the call of this function depends on the type of command. For the most
+ complex commands, that have both arguments and contents, like quotations,
+ the call would be
+
+fun($converter, $cmd_or_type_name, $command_in_tree, $contents_formatted,
+ $args_formatted);
+
+ For a command with contents and no meaningful arg (like @example
+ or @table):
+
+fun($converter, $cmd_or_type_name, $command_in_tree, $contents_formatted)
+
+ For a command with args and no content (like @image, @code):
+
+fun($converter, $cmd_or_type_name, $command_in_tree, $args_formatted)
+
+ For a command that have no argument, like @TeX{} or @@:
+
+fun($converter, $cmd_or_type_name, $command_in_tree)
+
+ For text
+
+fun($converter, $cmd_or_type_name, $command_in_tree, $text)
+
+$converter is an opaque structure that may be queried for context information,
+like am I in string, in preformatted, in footnote, in code style command?
+
+* how the contents and the args are formatted may be determined by
+ 2 hashes, one for the contents and the other for the args:
+
+$commands_contents{'copying'}Â = ['raw', 'text'];
+$commands_args{'image'} = [['raw'], ['raw'], ['raw'], ['raw, 'string', 'text'],
+ ['raw']];
+#Â this means no formatting
+$commands_args{'^'} = [[[]];
+
+
+
Handle
@xrefautomaticsectiontitle on|off
(does nothing in info, in HTML automatically set the section name as 3rd
@@ -12,6 +57,8 @@
In Info A ref like @ref{node,,,manual} should lead to
*note (manual)node::.
+Test @w{'} for the substitution of '.
+
Before the release, verify that everything on
https://savannah.gnu.org/bugs/?group=texinfo
is fixed and tested for.
@@ -145,9 +192,11 @@
No © “ ” in docbook. Use instead numeric entities.
-Add @value and @end to the corresponding commands categories? Also maybe
-add thischapter thischaptername thischapternum thisfile thispage thistitle
-to misc_commands?
+Add @value to the corresponding commands categories?
+
+Functions:
+sectioning_command_target_name
+node_target_name
Incorporation of texi2html tests
--------------------------------
Index: tp/Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- tp/Texinfo/Common.pm 20 Mar 2011 20:47:48 -0000 1.24
+++ tp/Texinfo/Common.pm 27 Mar 2011 08:24:55 -0000 1.25
@@ -206,6 +206,13 @@
'item' => 'skipspace', # or line, depending on the context
'itemx' => 'skipspace',
'tab' => 'skipspace',
+ #Â only valid in heading or footing
+ 'thischapter' => 'noarg',
+ 'thischaptername' => 'noarg',
+ 'thischapternum' => 'noarg',
+ 'thisfile' => 'noarg',
+ 'thispage' => 'noarg',
+ 'thistitle' => 'noarg',
# not valid for info (should be in @iftex)
'vskip' => 'lineraw', # arg line in TeX
# obsolete @-commands.
@@ -288,6 +295,11 @@
$explained_commands{$explained_command} = 1;
}
+our %in_heading_commands;
+foreach my $in_heading_command ('thischapter', 'thischaptername',
+ 'thischapternum', 'thisfile', 'thispage', 'thistitle') {
+ $in_heading_commands{$in_heading_command} = 1;
+}
# commands delimiting blocks, with an @end.
# Value is either the number of arguments on the line separated by
Index: tp/Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -b -r1.228 -r1.229
--- tp/Texinfo/Parser.pm 22 Mar 2011 00:37:03 -0000 1.228
+++ tp/Texinfo/Parser.pm 27 Mar 2011 08:24:55 -0000 1.229
@@ -356,6 +356,7 @@
my %ref_commands = %Texinfo::Common::ref_commands;
my %region_commands = %Texinfo::Common::region_commands;
my %code_style_commands = %Texinfo::Common::code_style_commands;
+my %in_heading_commands = %Texinfo::Common::in_heading_commands;
my %keep_line_nr_brace_commands = %context_brace_commands;
foreach my $keep_line_nr_brace_command ('titlefont', 'anchor') {
@@ -471,7 +472,7 @@
foreach my $misc_not_begin_line ('comment', 'c', 'sp', 'refill',
'noindent', 'indent', 'columnfractions',
'tab', 'item', 'headitem', 'verbatiminclude',
- 'vskip') {
+ 'vskip', keys(%in_heading_commands)) {
delete $begin_line_commands{$misc_not_begin_line};
}
@@ -3316,6 +3317,10 @@
}
$parent = $parent->{'parent'};
}
+ } elsif ($in_heading_commands{$command}) {
+ $self->line_error (sprintf($self->__("address@hidden should only
appear in heading or footing"),
+ $command), $line_nr);
+ $invalid = 1;
}
unless ($ignored) {
$misc = {'cmdname' => $command,
Index: tp/Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- tp/Texinfo/Structuring.pm 24 Mar 2011 23:06:47 -0000 1.43
+++ tp/Texinfo/Structuring.pm 27 Mar 2011 08:24:55 -0000 1.44
@@ -621,7 +621,7 @@
}
if ($split eq 'node' or (defined($level) and $split_level <= $level)
or address@hidden) {
- push @pages, {};
+ push @pages, {'type' => 'page'};
}
push @{$pages[-1]->{'contents'}}, $element;
$element->{'parent'} = $pages[-1];
Index: tp/Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- tp/Texinfo/Convert/Converter.pm 24 Mar 2011 23:06:47 -0000 1.2
+++ tp/Texinfo/Convert/Converter.pm 27 Mar 2011 08:24:55 -0000 1.3
@@ -243,4 +243,17 @@
}
}
+sub xml_protect_text($$)
+{
+ my $self = shift;
+ my $text = shift;
+ $text =~ s/&/&/g;
+ $text =~ s/</</g;
+ $text =~ s/>/>/g;
+ $text =~ s/\"/"/g;
+ return $text;
+
+}
+
+
1;
Index: tp/t/08misc_commands.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/08misc_commands.t,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- tp/t/08misc_commands.t 16 Mar 2011 01:16:43 -0000 1.18
+++ tp/t/08misc_commands.t 27 Mar 2011 08:24:55 -0000 1.19
@@ -427,6 +427,11 @@
@bye @c bye
'],
+['command_in_heading_footing',
+'@everyheading something @thispage @thischapternum
+
+In text @thispage @thischapternum text.
+'],
);
my %info_tests = (
Index: util/txicmdlist
===================================================================
RCS file: /sources/texinfo/texinfo/util/txicmdlist,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- util/txicmdlist 20 Feb 2011 18:39:40 -0000 1.1
+++ util/txicmdlist 27 Mar 2011 08:24:56 -0000 1.2
@@ -32,8 +32,6 @@
keys(%Texinfo::Common::misc_commands),
keys(%Texinfo::Common::no_brace_commands),
qw(cindex findex kindex pindex tindex value vindex),
- qw(thischapter thischaptername thischapternum thisfile thispage thistitle),
- qw(end),
);
print map { "address@hidden" } sort (@all_commands);
Index: tp/t/results/misc_commands/command_in_heading_footing.pl
===================================================================
RCS file: tp/t/results/misc_commands/command_in_heading_footing.pl
diff -N tp/t/results/misc_commands/command_in_heading_footing.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tp/t/results/misc_commands/command_in_heading_footing.pl 27 Mar 2011
08:24:56 -0000 1.1
@@ -0,0 +1,109 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors);
+
+use utf8;
+
+$result_trees{'command_in_heading_footing'} = {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'parent' => {},
+ 'text' => ' something @thispage @thischapternum
+',
+ 'type' => 'misc_arg'
+ }
+ ],
+ 'cmdname' => 'everyheading',
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'In text '
+ },
+ {
+ 'cmdname' => 'thispage',
+ 'extra' => {
+ 'invalid_nesting' => 1
+ },
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => ' '
+ },
+ {
+ 'cmdname' => 'thischapternum',
+ 'extra' => {
+ 'invalid_nesting' => 1
+ },
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => ' text.
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'text_root'
+};
+$result_trees{'command_in_heading_footing'}{'contents'}[0]{'args'}[0]{'parent'}
= $result_trees{'command_in_heading_footing'}{'contents'}[0];
+$result_trees{'command_in_heading_footing'}{'contents'}[0]{'parent'} =
$result_trees{'command_in_heading_footing'};
+$result_trees{'command_in_heading_footing'}{'contents'}[1]{'parent'} =
$result_trees{'command_in_heading_footing'};
+$result_trees{'command_in_heading_footing'}{'contents'}[2]{'contents'}[0]{'parent'}
= $result_trees{'command_in_heading_footing'}{'contents'}[2];
+$result_trees{'command_in_heading_footing'}{'contents'}[2]{'contents'}[1]{'parent'}
= $result_trees{'command_in_heading_footing'}{'contents'}[2];
+$result_trees{'command_in_heading_footing'}{'contents'}[2]{'contents'}[2]{'parent'}
= $result_trees{'command_in_heading_footing'}{'contents'}[2];
+$result_trees{'command_in_heading_footing'}{'contents'}[2]{'contents'}[3]{'parent'}
= $result_trees{'command_in_heading_footing'}{'contents'}[2];
+$result_trees{'command_in_heading_footing'}{'contents'}[2]{'contents'}[4]{'parent'}
= $result_trees{'command_in_heading_footing'}{'contents'}[2];
+$result_trees{'command_in_heading_footing'}{'contents'}[2]{'parent'} =
$result_trees{'command_in_heading_footing'};
+
+$result_texis{'command_in_heading_footing'} = '@everyheading something
@thispage @thischapternum
+
+In text @thispage @thischapternum text.
+';
+
+
+$result_texts{'command_in_heading_footing'} = '
+In text text.
+';
+
+$result_errors{'command_in_heading_footing'} = [
+ {
+ 'error_line' => ':3: @thispage should only appear in heading or footing
+',
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => '',
+ 'text' => '@thispage should only appear in heading or footing',
+ 'type' => 'error'
+ },
+ {
+ 'error_line' => ':3: @thischapternum should only appear in heading or
footing
+',
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => '',
+ 'text' => '@thischapternum should only appear in heading or footing',
+ 'type' => 'error'
+ }
+];
+
+
+
+$result_converted{'plaintext'}->{'command_in_heading_footing'} = 'In text text.
+';
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo tp/TODO tp/Texinfo/Common.pm tp/Texinfo...,
Patrice Dumas <=