[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Better cutomization variables coverage by checkin
From: |
Patrice Dumas |
Subject: |
branch master updated: Better cutomization variables coverage by checking separately commands |
Date: |
Wed, 19 Oct 2022 16:50:40 -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 78aad01b0a Better cutomization variables coverage by checking
separately commands
78aad01b0a is described below
commit 78aad01b0aaa5ed6f692b7c22c2cde573f570564
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 19 22:50:27 2022 +0200
Better cutomization variables coverage by checking separately commands
* doc/refcard/txivarcheck (main, read_refman), tp/Texinfo/Common.pm,
util/txicustomvars: compare manual and lists from code and output
separately Texinfo @-commands as customization variables and other
customization variables. Add --commands option to txicustomvars
to show the global commands with a customization variable only.
* doc/texinfo.texi (Customization Variables for @@-Commands):
add missing customization variables for @-commands.
---
ChangeLog | 13 ++++++
doc/refcard/txirefcard-a4.pdf | Bin 101233 -> 100620 bytes
doc/refcard/txirefcard.pdf | Bin 102202 -> 101601 bytes
doc/refcard/txivarcheck | 103 ++++++++++++++++++++++++++----------------
doc/texinfo.texi | 19 ++++++--
tp/Texinfo/Common.pm | 14 ++++--
util/txicustomvars | 25 +++++++++-
7 files changed, 124 insertions(+), 50 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 43f895c06f..f5ff05c21b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-10-19 Patrice Dumas <pertusus@free.fr>
+
+ Better cutomization variables coverage by checking separately commands
+
+ * doc/refcard/txivarcheck (main, read_refman), tp/Texinfo/Common.pm,
+ util/txicustomvars: compare manual and lists from code and output
+ separately Texinfo @-commands as customization variables and other
+ customization variables. Add --commands option to txicustomvars
+ to show the global commands with a customization variable only.
+
+ * doc/texinfo.texi (Customization Variables for @@-Commands):
+ add missing customization variables for @-commands.
+
2022-10-19 Patrice Dumas <pertusus@free.fr>
* tp/ext/tex4ht.pm (tex4ht_prepare): fix typo in error messages.
diff --git a/doc/refcard/txirefcard-a4.pdf b/doc/refcard/txirefcard-a4.pdf
index cc90da9b2b..9e81f374a8 100644
Binary files a/doc/refcard/txirefcard-a4.pdf and
b/doc/refcard/txirefcard-a4.pdf differ
diff --git a/doc/refcard/txirefcard.pdf b/doc/refcard/txirefcard.pdf
index 90d8284f76..ae35fd5252 100644
Binary files a/doc/refcard/txirefcard.pdf and b/doc/refcard/txirefcard.pdf
differ
diff --git a/doc/refcard/txivarcheck b/doc/refcard/txivarcheck
index d3c91e6681..799cccfa17 100755
--- a/doc/refcard/txivarcheck
+++ b/doc/refcard/txivarcheck
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
# Copyright 2012, 2013, 2016 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,
@@ -15,46 +15,74 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Original author: Karl Berry.
-#
+#
# Kludge of a script to check customization variables in refman vs. tp
# for consistency. Although this has nothing to do with the reference
# card, since it's similar to the txicmdcheck script, keep them
# together. And maybe we'll add the cust.vars to the refcard.
+use strict;
+
exit (&main ());
sub main {
my $no_common = $ARGV[0] eq "--no-common";
-
- my @man_vars = &read_refman ("../texinfo.texi");
+
+ my ($man_customization_vars, $man_cmds_customization_vars)
+ = &read_refman ("../texinfo.texi");
+ my @man_vars = @$man_customization_vars;
+ my @man_cmds_vars = @$man_cmds_customization_vars;
my @tp_vars = &read_tp ("../../util/txicustomvars");
+ my @tp_cmds_vars = &read_tp ("../../util/txicustomvars --commands");
- my (%man_vars, %tp_vars); # list to hash
+ my (%man_vars, %tp_vars, %man_cmds_vars, %tp_cmds_vars); # list to hash
@man_vars{@man_vars} = ();
@tp_vars{@tp_vars} = ();
+ @man_cmds_vars{@man_cmds_vars} = ();
+ @tp_cmds_vars{@tp_cmds_vars} = ();
- my @found = ();
+ my @found_vars = ();
for my $name (@tp_vars) {
if (exists $man_vars{$name}) {
- push (@found, $name);
+ push (@found_vars, $name);
delete $man_vars{$name};
delete $tp_vars{$name};
}
}
-
- printf ("common %3d: @{[sort @found]}\n", @found + 0)
+
+ printf ("common %3s: @{[sort @found_vars]}\n", scalar(@found_vars))
unless $no_common;
- # we can't reasonly reduce the list of variable names only in the
+ # we can't reasonably reduce the list of variable names only in the
# manual to null, since the manual necessarily includes many non-variables.
- #
- my @man_only = keys %man_vars;
- printf "man only %2s: @{[sort @man_only]}\n", @man_only + 0;
-
- my @tp_only = keys %tp_vars;
- printf "tp only %2s: @{[sort @tp_only]}\n", @tp_only + 0;
-
- return @tp_only;
+ #
+ my @man_vars_only = sort(keys(%man_vars));
+ printf "man only %3s: @man_vars_only\n", scalar(@man_vars_only);
+
+ my @tp_vars_only = sort(keys(%tp_vars));
+ printf "tp only %3s: @tp_vars_only\n", scalar(@tp_vars_only);
+
+ my @found_cmds_vars = ();
+ for my $name (@tp_cmds_vars) {
+ if (exists $man_cmds_vars{$name}) {
+ push (@found_cmds_vars, $name);
+ delete $man_cmds_vars{$name};
+ delete $tp_cmds_vars{$name};
+ }
+ }
+
+ print "\n";
+ printf ("common cmds %3s: @{[sort @found_cmds_vars]}\n",
scalar(@found_cmds_vars))
+ unless $no_common;
+
+ my @man_cmds_vars_only = sort(keys(%man_cmds_vars));
+ printf "man only cmds %3s: @man_cmds_vars_only\n",
scalar(@man_cmds_vars_only);
+
+ my @tp_cmds_vars_only = sort(keys(%tp_cmds_vars));
+ printf "tp only cmds %3s: @tp_cmds_vars_only\n", scalar(@tp_cmds_vars_only);
+
+
+ return scalar(@tp_vars_only) + scalar(@tp_cmds_vars_only);
}
@@ -62,14 +90,15 @@ sub main {
# Return customization variable names from the section in the reference
# manual. We assume their names are all uppercase, to avoid returning
# numerous non-variables.
-#
+#
sub read_refman {
my ($fname) = @_;
- my @ret = ();
+ my @commands_customization_variables = ();
+ my @other_customization_variables = ();
local *FILE;
- $FILE = $fname;
- open (FILE) || die "open($FILE) failed: $!";
+ my $FILE = $fname;
+ open (FILE, $FILE) || die "open($FILE) failed: $!";
# since we have to look at generic commands like @item, at least
# ignore until right section to reduce chance of false matches.
@@ -91,24 +120,24 @@ sub read_refman {
}
# done with special node.
my @atcmds = split (" ", $atcmds);
- push (@ret, @atcmds);
+ push (@commands_customization_variables, @atcmds);
next;
}
-
+
# Stop looking for cust.var names after those nodes are done.
last if /^\@node Internationalization of Document Strings/;
-
+
# Otherwise, we're looking at a line in one of the cust.var
# documentation nodes.
next unless s/^\@(itemx?|vindex) *//; # look for item[x]s and vindex
next unless /^[A-Z0-9_]+$/; # uppercase only
-
+
chomp;
- push (@ret, $_);
+ push (@other_customization_variables, $_);
}
close (FILE) || warn "close($FILE) failed: $!";
- return @ret;
+ return \@other_customization_variables, \@commands_customization_variables;
}
@@ -118,23 +147,19 @@ sub read_refman {
sub read_tp {
my ($prog) = @_;
my @ret = ();
-
+
local *FILE;
- $FILE = "$prog |";
- open (FILE) || die "open($FILE) failed: $!";
+ my $FILE = "$prog |";
+ open (FILE, $FILE) || die "open($FILE) failed: $!";
while (<FILE>) {
chomp;
- $var = $_;
+ my $var = $_;
next if $var eq "OUTPUT_PERL_ENCODING"; # not for users
- next if $var eq "HTMLXREF"; # not documented
-
- # these are documented, but their lowercase names don't match
- # everything
- #next if $var =~ /^(even|every|odd)(heading|footing)$/;
+
push (@ret, $var);
}
- close (FILE) || warn "close($FILE) failed: $!";
-
+ close (FILE) || warn "close($FILE) failed: $!";
+
return @ret;
}
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index c2a56f2b88..61f2cd471b 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -16012,12 +16012,21 @@ Each of the following @@-commands has an associated
customization
variable with the same name (minus the leading @code{@@}):
@example
-@@allowcodebreaks @@clickstyle @@codequotebacktick
+@@afivepaper @@afourpaper @@afourlatex
+@@afourwide @@allowcodebreaks @@bsixpaper
+@@contents @@clickstyle @@codequotebacktick
@@codequoteundirected @@deftypefnnewline @@documentdescription
-@@documentencoding @@documentlanguage @@exampleindent
-@@firstparagraphindent @@footnotestyle @@frenchspacing
-@@kbdinputstyle @@novalidate @@paragraphindent
-@@setfilename @@urefbreakstyle @@xrefautomaticsectiontitle
+@@documentencoding @@documentlanguage @@evenfooting
+@@evenfootingmarks @@evenheading @@evenheadingmarks
+@@everyfooting @@everyfootingmarks @@everyheading
+@@everyheadingmarks @@exampleindent @@firstparagraphindent
+@@fonttextsize @@footnotestyle @@frenchspacing
+@@headings @@kbdinputstyle @@microtype
+@@novalidate @@oddfooting @@oddfootingmarks
+@@oddheading @@oddheadingmarks @@pagesizes
+@@paragraphindent @@setfilename @@setchapternewpage
+@@shortcontents @@smallbook @@summarycontents
+@@urefbreakstyle @@xrefautomaticsectiontitle
@end example
Setting such a customization variable to a value @samp{foo} is similar
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 900388fbc4..145b2e1080 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -129,12 +129,14 @@ my %default_parser_specific_customization = (
# this serves both to set defaults and list configuration options
# valid for the parser.
+# also used in util/txicustomvars
our %default_parser_customization_values =
(%default_parser_common_customization,
%default_parser_specific_customization);
# @-commands that can be used multiple time in a document and default
# values. Associated with customization values too.
+# also used in util/txicustomvars
our %document_settable_multiple_at_commands = (
'allowcodebreaks' => 'true',
'clickstyle' => '@arrow',
@@ -145,10 +147,10 @@ our %document_settable_multiple_at_commands = (
'documentencoding' => 'us-ascii',
'documentlanguage' => 'en', # or undef? Documented as en.
# --document-language
- 'everyheading' => undef,
- 'everyfooting' => undef,
- 'evenheading' => undef,
'evenfooting' => undef,
+ 'evenheading' => undef,
+ 'everyfooting' => undef,
+ 'everyheading' => undef,
# is N ems in TeX, 0.4 in.
'exampleindent' => 5,
'firstparagraphindent' => 'none',
@@ -166,6 +168,7 @@ our %document_settable_multiple_at_commands = (
);
# @-commands that should be unique. Associated with customization values too.
+# also used in util/txicustomvars
our %document_settable_unique_at_commands = (
'afivepaper' => undef,
'afourpaper' => undef,
@@ -256,7 +259,8 @@ my %default_main_program_command_line_options = (
);
# used in main program, defaults documented in manual
-my %default_main_program_customization = (
+# also used in util/txicustomvars
+our %default_main_program_customization = (
'CHECK_NORMAL_MENU_STRUCTURE' => 0, # output warnings when node with
# automatic direction and directions in menu are not consistent
# with sectionning, and when node directions are not consistent
@@ -275,6 +279,7 @@ our %default_main_program_customization_options = (
%default_main_program_command_line_options,
%default_main_program_customization);
# used in converters, default documented in manual
+# also used in util/txicustomvars
our %default_converter_customization = (
'TOP_NODE_UP' => '(dir)', # up node of Top node default value
'BASEFILENAME_LENGTH' => 255 - 10,
@@ -304,6 +309,7 @@ our %default_converter_customization = (
# some converters, for example CLOSE_QUOTE_SYMBOL and many
# for HTML. Could be added to %default_converter_customization.
# Defaults are documented in manual and set in the various converters.
+# used in util/txicustomvars
our @variable_string_settables = (
'AFTER_BODY_OPEN',
'AFTER_SHORT_TOC_LINES',
diff --git a/util/txicustomvars b/util/txicustomvars
index e159712c98..703ed5de3d 100755
--- a/util/txicustomvars
+++ b/util/txicustomvars
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
# Copyright 2012-2021 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,
@@ -32,4 +32,25 @@ BEGIN {
use Texinfo::Common;
-print join("\n", @Texinfo::Common::variable_string_settables);
+my $do_customization_variable_commands = $ARGV[0] eq "--commands";
+
+if ($do_customization_variable_commands) {
+ print join("\n",
+ sort(keys(%Texinfo::Common::document_settable_multiple_at_commands),
+ keys(%Texinfo::Common::document_settable_unique_at_commands)));
+ exit 0;
+}
+
+my %parser_customization
+ = %Texinfo::Common::default_parser_customization_values;
+
+# avoid commands by selecting only upper cased customization variables
+my @parser_string_non_command_customization
+ = grep {ref($parser_customization{$_}) eq '' and $_ =~ /^[A-Z0-9_]+$/ }
+ keys(%parser_customization);
+
+print join("\n",
+ sort(@parser_string_non_command_customization,
+ keys(%Texinfo::Common::default_main_program_customization),
+ keys(%Texinfo::Common::default_converter_customization),
+ @Texinfo::Common::variable_string_settables));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Better cutomization variables coverage by checking separately commands,
Patrice Dumas <=