texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod,


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod, doc/tp_api/Makefile.am (tp_api_dependencies, dist_modules_DATA), tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h: move Pod documentation on hashes in Texinfo::Commands out of tp/Texinfo/Common.pm to tp/Texinfo/Commands.pod. Add more information in tp/Texinfo/XS/parsetexi/command_data.txt and tp/Texinfo/XS/parsetexi/commands.h.
Date: Wed, 05 Oct 2022 16:05:33 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 172c029077 * tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod, 
doc/tp_api/Makefile.am (tp_api_dependencies, dist_modules_DATA), 
tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h: 
move Pod documentation on hashes in Texinfo::Commands out of 
tp/Texinfo/Common.pm to tp/Texinfo/Commands.pod. Add more information in 
tp/Texinfo/XS/parsetexi/command_data.txt and tp/Texinfo/XS/parsetexi/commands.h.
172c029077 is described below

commit 172c029077b68bbdf3f09d5da0b014e135540885
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 5 22:02:38 2022 +0200

    * tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod,
    doc/tp_api/Makefile.am (tp_api_dependencies, dist_modules_DATA),
    tp/Texinfo/XS/parsetexi/command_data.txt,
    tp/Texinfo/XS/parsetexi/commands.h: move Pod documentation on
    hashes in Texinfo::Commands out of tp/Texinfo/Common.pm to
    tp/Texinfo/Commands.pod. Add more information in
    tp/Texinfo/XS/parsetexi/command_data.txt and
    tp/Texinfo/XS/parsetexi/commands.h.
---
 ChangeLog                                |  11 ++
 doc/tp_api/Makefile.am                   |   1 +
 tp/Makefile.am                           |   1 +
 tp/Texinfo/Commands.pod                  | 250 +++++++++++++++++++++++++++++++
 tp/Texinfo/Common.pm                     | 200 ++-----------------------
 tp/Texinfo/XS/parsetexi/command_data.txt |   6 +-
 tp/Texinfo/XS/parsetexi/commands.h       |   6 +-
 7 files changed, 287 insertions(+), 188 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ea1d12f87c..5f82758323 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-10-05  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm, tp/Texinfo/Commands.pod,
+       doc/tp_api/Makefile.am (tp_api_dependencies, dist_modules_DATA),
+       tp/Texinfo/XS/parsetexi/command_data.txt,
+       tp/Texinfo/XS/parsetexi/commands.h: move Pod documentation on
+       hashes in Texinfo::Commands out of tp/Texinfo/Common.pm to
+       tp/Texinfo/Commands.pod. Add more information in
+       tp/Texinfo/XS/parsetexi/command_data.txt and
+       tp/Texinfo/XS/parsetexi/commands.h.
+
 2022-10-05  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * util/texi2dvi (decide_aux_files_method): Change an error
diff --git a/doc/tp_api/Makefile.am b/doc/tp_api/Makefile.am
index 0acc32e774..d2b1059790 100644
--- a/doc/tp_api/Makefile.am
+++ b/doc/tp_api/Makefile.am
@@ -47,6 +47,7 @@ BUILT_SOURCES = tp_api.texi
 # all the modules with some interesting public interfaces.
 # The order matters for the result.
 tp_api_dependencies = \
+  $(top_srcdir)/tp/Texinfo/Commands.pod \
   $(top_srcdir)/tp/Texinfo/Common.pm \
   $(top_srcdir)/tp/Texinfo/ParserNonXS.pm \
   $(top_srcdir)/tp/Texinfo/Structuring.pm \
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 527e70a472..4392834c75 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -69,6 +69,7 @@ dist_modules_DATA = \
  Texinfo/ParserNonXS.pm \
  Texinfo/Report.pm \
  Texinfo/Common.pm \
+ Texinfo/Commands.pod \
  Texinfo/Structuring.pm \
  Texinfo/Transformations.pm \
  Texinfo/Translations.pm \
diff --git a/tp/Texinfo/Commands.pod b/tp/Texinfo/Commands.pod
new file mode 100644
index 0000000000..133f672e52
--- /dev/null
+++ b/tp/Texinfo/Commands.pod
@@ -0,0 +1,250 @@
+=head1 NAME
+
+Texinfo::Commands - Classification of commands
+
+=head1 SYNOPSIS
+
+  use Texinfo::Commands;
+  if ($Texinfo::Common::accent_commands{$a_command}) {
+    print STDERR "$a_command is an accent command\n";
+  }
+
+=head1 NOTES
+
+The Texinfo Perl module main purpose is to be used in C<texi2any> to convert
+Texinfo to other formats.  There is no promise of API stability.
+
+=head1 DESCRIPTION
+
+Texinfo::Common holds a few hashes with information on @-commands 
+and hashes classifying Texinfo @-commands.
+
+=head1 @-COMMAND INFORMATION
+
+Hashes are defined as C<our> variables, and are therefore available
+outside of the module.
+
+=over
+
+=item %index_names
+X<C<%index_names>>
+
+Hash describing the default Texinfo indices.  The format of this hash is
+described in L<Texinfo::Parser/indices_information>.
+
+=back
+
+=head1 @-COMMAND CLASSES
+
+Hashes are defined as C<our> variables, and are therefore available
+outside of the module.
+
+The key of the hashes are @-command names without the @.  The
+following hashes are available:
+
+=over
+
+=item %accent_commands
+X<C<%accent_commands>>
+
+Accent @-commands taking an argument, like C<@'> or C<@ringaccent>,
+including C<@dotless> and C<@tieaccent>.
+
+=item %block_commands
+X<C<%block_commands>>
+
+Commands delimiting a block with a closing C<@end>.  The values are:
+
+=over
+
+=item I<conditional>
+
+C<@if*> commands;
+
+=item I<def>
+
+Definition commands like C<@deffn>;
+
+=item I<float>
+
+C<@float>;
+
+=item I<format_raw>
+
+raw output format commands such as C<@html> or C<@info>;
+
+=item I<item_container>
+
+commands  with C<@item> containing
+any content, C<@itemize> and C<@enumerate>;
+
+=item I<item_line>
+
+commands like C<@table> in which the C<@item> argument is on its line;
+
+=item I<menu>
+
+menu @-commands, C<@menu>, C<@detailmenu>
+and C<@direntry>;
+
+=item I<math>
+
+Math block commands, like C<@displaymath>.
+
+=item I<multitable>
+
+C<@multitable>;
+
+=item I<other>
+
+The remaining block commands.
+
+=item I<preformatted>
+
+Commands whose content should not be filled, like C<@example> or C<@display>.
+
+=item I<quotation>
+
+Commands like C<@quotation>.
+
+=item I<raw>
+
+@-commands that have no expansion
+of @-commands in their bodies (C<@macro>, C<@verbatim> and C<@ignore>);
+
+=item I<region>
+
+Commands delimiting a region of the document out of the main processing:
+C<@titlepage>, C<@copying>, C<@documentdescription>.
+
+=back
+
+=item %commands_args_number
+X<C<%commands_args_number>>
+
+Set to the number of arguments separated by commas that may appear in braces or
+on the @-command line.  That means 0 or unset for most block commands,
+including C<@example> which has an unlimited (variadic) number of arguments, 1
+for C<@quotation>, 2 for C<@float>, 1 for most brace commands, 2 for C<@email>
+or C<@abbr>, 5 for C<@image> of C<@ref>.
+
+Values are not necessarily set for all the commands, as commands are
+also classified by type of command, some type of commands implying a
+number of arguments, and the number of arguments may not be set if it
+corresponds to the default (0 for block commands, 1 for other commands).
+
+=item %brace_commands
+X<C<%brace_commands>>
+
+The commands that take braces. Value is I<noarg> for brace commands without
+argument such as C<@AA>, C<@TeX>, or C<@equiv>.  Other values include
+I<accent>, I<arguments>, I<context> and other values.
+
+=item %def_commands
+X<C<%def_commands>>
+
+Definition commands.
+
+=item %default_index_commands
+X<C<%default_index_commands>>
+
+Index entry commands corresponding to default indices. For example
+C<@cindex>.
+
+=item %heading_spec_commands
+X<C<%heading_spec_commands>>
+
+@-commands used to specify custom headings, like C<@everyheading>.
+
+=item %in_heading_spec_commands
+X<C<%in_heading_spec_commands>>
+
+Special @-commands appearing in custom headings, such as C<@thischapter>
+or C<@thistitle>.
+
+=item %letter_no_arg_commands
+X<C<%letter_no_arg_commands>>
+
+@-commands with braces but no argument corresponding to letters,
+like C<@AA{}> or C<@ss{}> or C<@o{}>.
+
+=item %math_commands
+X<C<%math_commands>>
+
+@-commands which contains math, like C<@math> or C<@displaymath>.
+
+=item %line_commands
+X<C<%line_commands>>
+
+Command that do not take braces, take arguments on the command line and are
+not block commands either, like C<@node>, C<@chapter>, C<@cindex>, C<@deffnx>,
+C<@end>, C<@footnotestyle>, C<@set>, C<@settitle>, C<@itemx>,
+C<@definfoenclose>, C<@comment> and many others.
+
+Note that C<@item> is in C<%line_commands> for its role in C<@table> and
+similar @-commands.
+
+=item %nobrace_commands
+X<C<%nobrace_commands>>
+
+Command that do not take braces, do not have argument on their line and
+are not block commands either.  The value is I<symbol> for single character
+non-alphabetical @-commands such as C<@@>, C<@ > or @C<@:>.  Other commands in 
that hash
+include C<@indent>, C<@tab> or C<@thissection>.
+
+Note that C<@item> is in C<%nobrace_commands> for its role in C<@multitable>,
+C<@itemize> and C<@enumerate>.
+
+=item %preformatted_commands
+
+=item %preformatted_code_commands
+X<C<%preformatted_commands>>
+X<C<%preformatted_code_commands>>
+
+I<%preformatted_commands> is for commands whose content should not
+be filled, like C<@example> or C<@display>.  If the command is meant
+for code, it is also in I<%preformatted_code_commands>, like C<@example>.
+
+=item %ref_commands
+X<C<%ref_commands>>
+
+Cross reference @-command referencing nodes, like C<@xref>.
+
+=item %root_commands
+X<C<%root_commands>>
+
+Commands that are at the root of a Texinfo document, namely
+C<@node> and sectioning commands, except heading commands
+like C<@heading>.
+
+=item %sectioning_heading_commands
+X<C<%sectioning_heading_commands>>
+
+All the sectioning and heading commands.
+
+=item %variadic_commands
+X<C<%variadic_commands>>
+
+Commands with unlimited arguments, like C<@example>.
+
+=back
+
+=head1 SEE ALSO
+
+L<Texinfo::Parser>, L<Texinfo::Common>.
+
+=head1 AUTHOR
+
+Patrice Dumas, E<lt>pertusus@free.frE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2010- Free Software Foundation, Inc.  See the source file for
+all copyright years.
+
+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
+the Free Software Foundation; either version 3 of the License, or (at
+your option) any later version.
+
+=cut
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 422787f1cc..332e0743aa 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -2447,14 +2447,17 @@ __END__
 
 =head1 NAME
 
-Texinfo::Common - Classification of commands and miscellaneous methods
+Texinfo::Common - Texinfo modules common data and miscellaneous methods
 
 =head1 SYNOPSIS
 
   use Texinfo::Common;
-  if ($Texinfo::Common::accent_commands{$a_command}) {
-    print STDERR "$a_command is an accent command\n";
-  }
+
+
+  my @commands_to_collect = ('math');
+  my $collected_commands
+    = Texinfo::Common::collect_commands_in_tree($document_root,
+                                             \@commands_to_collect);
 
 =head1 NOTES
 
@@ -2463,8 +2466,9 @@ Texinfo to other formats.  There is no promise of API 
stability.
 
 =head1 DESCRIPTION
 
-Texinfo::Common holds hashes with miscellaneous information and hashes
-classifying Texinfo @-commands, as well as miscellaneous methods.
+Texinfo::Common holds hashes with miscellaneous information and some
+hashes with information on Texinfo @-commands, as well as miscellaneous
+methods.
 
 =head1 MISC INFORMATION
 
@@ -2476,12 +2480,6 @@ TODO: undocumented
 
 =over
 
-=item %index_names
-X<C<%index_names>>
-
-Hash describing the default Texinfo indices.  The format of this hash is
-described in L<Texinfo::Parser/indices_information>.
-
 =item %texinfo_output_formats
 X<C<%texinfo_output_formats>>
 
@@ -2491,7 +2489,7 @@ and C<plaintext>.
 
 =back
 
-=head1 @-COMMAND CLASSES
+=head1 @-COMMAND INFORMATION
 
 Hashes are defined as C<our> variables, and are therefore available
 outside of the module.
@@ -2506,108 +2504,20 @@ X<C<%all_commands>>
 
 All the @-commands.
 
-=item %accent_commands
-X<C<%accent_commands>>
-
-Accent @-commands taking an argument, like C<@'> or C<@ringaccent>,
-including C<@dotless> and C<@tieaccent>.
-
-=item %block_commands
-X<C<%block_commands>>
-
-Commands delimiting a block with a closing C<@end>.  The values are:
-
-=over
-
-=item I<conditional>
-
-C<@if*> commands;
-
-=item I<def>
-
-Definition commands like C<@deffn>;
-
-=item I<format_raw>
-
-raw output format commands such as C<@html> or C<@info>;
-
-=item I<item_container>
-
-commands  with C<@item> containing
-any content, C<@itemize> and C<@enumerate>;
-
-=item I<item_line>
-
-commands like C<@table> in which the C<@item> argument is on its line;
-
-=item I<menu>
-
-menu @-commands, C<@menu>, C<@detailmenu>
-and C<@direntry>;
-
-=item I<math>
-
-Math block commands, like C<@displaymath>.
-
-=item I<multitable>
-
-C<@multitable>;
-
-=item I<other>
-
-The remaining block commands.
-
-=item I<preformatted>
-
-Commands whose content should not be filled, like C<@example> or C<@display>.
-
-=item I<raw>
-
-@-commands that have no expansion
-of @-commands in their bodies (C<@macro>, C<@verbatim> and C<@ignore>);
-
-=back
-
-Other values for other block line commands.
-
-=item %commands_args_number
-X<C<%commands_args_number>>
-
-Set to the number of arguments separated by commas that may appear in braces or
-on the @-command line.  That means 0 or unset in most block command cases,
-including C<@example> which has an unlimited (variadic) number of arguments, 1
-for C<@quotation>, 2 for C<@float>, 1 for most brace commands, 2 for C<@email>
-or C<@abbr>, 5 for C<@image> of C<@ref>.
-
-Values are not necessarily set for all the commands, as commands are
-also classified by type of command, some type of commands implying a
-number of arguments, and the number of arguments may not be set if it
-coorresponds to the default (0 for block commands, 1 for other commands).
-
-=item %brace_commands
-X<C<%brace_commands>>
-
-The commands that take braces. Value is I<noarg> for brace commands without
-argument such as C<@AA>, C<@TeX>, or C<@equiv>.  Other values include
-I<accent>, I<arguments>, I<context> and other values.
-
 =item %brace_code_commands
 X<C<%brace_code_commands>>
 
 Brace commands that have their argument in code style, like
 C<@code>.
 
-=item %def_commands
-
 =item %def_aliases
 
 =item %def_no_var_arg_commands
-X<C<%def_commands>>
 X<C<%def_aliases>>
 X<C<%def_no_var_arg_commands>>
 
-Definition commands.  C<%def_aliases> associates an aliased command
-to the original command, for example C<defun> is associated to C<deffn>.
+C<%def_aliases> associates an aliased command to the original command, for
+example C<defun> is associated to C<deffn>.
 
 C<%def_no_var_arg_commands> associates a definition command name with
 a true value if the I<argument> on the definition command line can contain
@@ -2615,29 +2525,12 @@ non-metasyntactic variables.  For instance, it is true 
for C<deftypevr>
 but false for C<defun>, since C<@defun> I<argument> is supposed to contain
 metasyntactic variables only.
 
-=item %default_index_commands
-X<C<%default_index_commands>>
-
-Index entry commands corresponding to default indices. For example
-C<@cindex>.
-
 =item %explained_commands
 X<C<%explained_commands>>
 
 @-commands whose second argument explain first argument and further
 @-command call without first argument, as C<@abbr> and C<@acronym>.
 
-=item %heading_spec_commands
-X<C<%heading_spec_commands>>
-
-@-commands used to specify custom headings, like C<@everyheading>.
-
-=item %in_heading_spec_commands
-X<C<%in_heading_spec_commands>>
-
-Special @-commands appearing in custom headings, such as C<@thischapter>
-or C<@thistitle>.
-
 =item %inline_conditional_commands
 
 =item %inline_format_commands
@@ -2647,83 +2540,18 @@ X<C<%inline_format_commands>>
 Inline conditional commands, like C<@inlineifclear>, and inline format
 commands like C<inlineraw> and C<inlinefmt>.
 
-=item %letter_no_arg_commands
-X<C<%letter_no_arg_commands>>
-
-@-commands with braces but no argument corresponding to letters,
-like C<@AA{}> or C<@ss{}> or C<@o{}>.
-
-=item %math_commands
-X<C<%math_commands>>
-
-@-commands which contains math, like C<@math> or C<@displaymath>.
-
-=item %line_commands
-X<C<%line_commands>>
-
-Command that do not take braces, take arguments on the command line and are
-not block commands either, like C<@node>, C<@chapter>, C<@cindex>, C<@deffnx>,
-C<@end>, C<@footnotestyle>, C<@set>, C<@settitle>, C<@itemx>,
-C<@definfoenclose>, C<@comment> and many others.
-
-Note that C<@item> is in C<%line_commands> for its role in C<@table> and
-similar @-commands.
-
-=item %nobrace_commands
-X<C<%nobrace_commands>>
-
-Command that do not take braces, do not have argument on their line and
-are not block commands either.  The value is I<symbol> for single character
-non-alphabetical @-commands such as C<@@>, C<@ > or @C<@:>.  Other commands in 
that hash
-include C<@indent>, C<@tab> or C<@thissection>.
-
-Note that C<@item> is in C<%nobrace_commands> for its role in C<@multitable>,
-C<@itemize> and C<@enumerate>.
-
 =item %nobrace_symbol_text
 X<C<%nobrace_symbol_text>>
 
 Values are ASCII representation of single character non-alphabetical commands
 without brace such as C<*> or C<:>.  The value may be an empty string.
 
-=item %preformatted_commands
-
-=item %preformatted_code_commands
-X<C<%preformatted_commands>>
-X<C<%preformatted_code_commands>>
-
-I<%preformatted_commands> is for commands whose content should not
-be filled, like C<@example> or C<@display>.  If the command is meant
-for code, it is also in I<%preformatted_code_commands>, like C<@example>.
-
-=item %ref_commands
-X<C<%ref_commands>>
-
-Cross reference @-command referencing nodes, like C<@xref>.
-
-=item %root_commands
-X<C<%root_commands>>
-
-Commands that are at the root of a Texinfo document, namely
-C<@node> and sectioning commands, except heading commands
-like C<@heading>.
-
-=item %sectioning_heading_commands
-X<C<%sectioning_heading_commands>>
-
-All the sectioning and heading commands.
-
 =item %small_block_associated_command
 X<C<%small_block_associated_command>>
 
 Associate small command like C<smallexample> to the regular command
 C<example>.
 
-=item %variadic_commands
-X<C<%variadic_commands>>
-
-Commands with unlimited arguments, like C<@example>.
-
 =back
 
 =head1 METHODS
@@ -2936,7 +2764,7 @@ X<C<split_custom_heading_command_contents>>
 Split the I<$contents> array reference at C<@|> in at max three parts.
 Return an array reference containing the split parts.  The I<$contents>
 array reference is supposed to be C<< $element->{'args'}->[0]->{'contents'} >>
-of C<%heading_spec_commands> commands such as C<@everyheading>.
+of C<%Texinfo::Commands::heading_spec_commands> commands such as 
C<@everyheading>.
 
 =item trim_spaces_comment_from_content($contents)
 X<C<trim_spaces_comment_from_content>>
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt 
b/tp/Texinfo/XS/parsetexi/command_data.txt
index 4d73721519..b9226340f9 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -15,7 +15,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Information from tp/Texinfo/Common.pm
+# this information is used to setup both the XS Parser commands
+# builtin_command_data and the perl Parser commands classification
+# hashes.
+
+# Some documentation of the flags (second column) is in commands.h.
 
 ##############################################################
 # Internal commands
diff --git a/tp/Texinfo/XS/parsetexi/commands.h 
b/tp/Texinfo/XS/parsetexi/commands.h
index fd06251d03..60a119e284 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -52,6 +52,7 @@ void wipe_user_commands (void);
 /* commands that should only appear at the root level and contain up to
    the next root command.  @node and sectioning commands. */
 #define CF_root                                0x0004
+/* sectioning and heading commands */
 #define CF_sectioning_heading          0x0008
 #define CF_brace                       0x0010
 /* CF_letter_no_arg is not used in XS parser, used in perl */
@@ -59,6 +60,7 @@ void wipe_user_commands (void);
 #define CF_accent                      0x0040
 /* CF_math is not used in XS parser, used in perl */
 #define CF_math                                0x0080
+/* commands with an unlimited number of arguments */
 #define CF_variadic                    0x0100
 #define CF_INFOENCLOSE                 0x0200
 /* in_heading_spec only valid in heading or footing specifications */
@@ -76,8 +78,10 @@ void wipe_user_commands (void);
 #define CF_def_alias                   0x00040000
 /* only accept plain text, ie only accent, symbol and glyph commands */
 #define CF_contain_plain_text          0x00080000
-/* CF_close_paragraph commands that forces closing an opened paragraph */
+/* CF_close_paragraph commands force closing an opened paragraph */
 #define CF_close_paragraph             0x00100000
+/* for commands containing simple text only, corresponding to paragraph
+   text without @ref, @footnote, @titlefont, @anchor nor @verb. */
 #define CF_contain_simple_text         0x00200000
 #define CF_preformatted                        0x00400000
 #define CF_preformatted_code           0x00800000



reply via email to

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