[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Report.pm (document_warn, document_e
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Report.pm (document_warn, document_error), tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, Texinfo/ParserNonXS.pm, tp/Texinfo/Structuring.pm, tp/Texinfo/XS/parsetexi/Parsetexi.pm, tp/init/chm.pm, tp/init/highlight_syntax.pm, tp/init/latex2html.pm, tp/init/tex4ht.pm: separate registrar that regist [...] |
Date: |
Mon, 30 Aug 2021 15:03:06 -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 77ac2fc * tp/Texinfo/Report.pm (document_warn, document_error),
tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm,
tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm,
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
Texinfo/ParserNonXS.pm, tp/Texinfo/Structuring.pm,
tp/Texinfo/XS/parsetexi/Parsetexi.pm, tp/init/chm.pm,
tp/init/highlight_syntax.pm, tp/init/latex2html.pm, tp/init/tex4ht.pm: separate
re [...]
77ac2fc is described below
commit 77ac2fcff23453d9533d58e41bb2fd8c3fc471d5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Aug 30 21:02:53 2021 +0200
* tp/Texinfo/Report.pm (document_warn, document_error),
tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm,
tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm,
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
Texinfo/ParserNonXS.pm, tp/Texinfo/Structuring.pm,
tp/Texinfo/XS/parsetexi/Parsetexi.pm, tp/init/chm.pm,
tp/init/highlight_syntax.pm, tp/init/latex2html.pm,
tp/init/tex4ht.pm: separate registrar that
register errors from from configuration in Texinfo::Report
for document_warn() and document_error().
---
ChangeLog | 14 +++++++
tp/DebugTexinfo/DebugTree.pm | 3 +-
tp/Texinfo/Common.pm | 3 +-
tp/Texinfo/Convert/Converter.pm | 22 ++++++----
tp/Texinfo/Convert/DocBook.pm | 9 ++--
tp/Texinfo/Convert/HTML.pm | 81 +++++++++++++++++++++---------------
tp/Texinfo/Convert/IXIN.pm | 6 ++-
tp/Texinfo/Convert/Info.pm | 20 +++++----
tp/Texinfo/Convert/LaTeX.pm | 6 ++-
tp/Texinfo/Convert/Plaintext.pm | 12 ++++--
tp/Texinfo/ParserNonXS.pm | 7 ++--
tp/Texinfo/Report.pm | 48 ++++++++++-----------
tp/Texinfo/Structuring.pm | 78 ++++++++++++++++++----------------
tp/Texinfo/XS/parsetexi/Parsetexi.pm | 5 ++-
tp/init/chm.pm | 22 ++++++----
tp/init/highlight_syntax.pm | 23 +++++-----
tp/init/latex2html.pm | 34 +++++++++------
tp/init/tex4ht.pm | 26 +++++++-----
18 files changed, 251 insertions(+), 168 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7f6ef3a..1fa2f8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2021-08-30 Patrice Dumas <pertusus@free.fr>
+ * tp/Texinfo/Report.pm (document_warn, document_error),
+ tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm,
+ tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm,
+ tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm,
+ tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
+ Texinfo/ParserNonXS.pm, tp/Texinfo/Structuring.pm,
+ tp/Texinfo/XS/parsetexi/Parsetexi.pm, tp/init/chm.pm,
+ tp/init/highlight_syntax.pm, tp/init/latex2html.pm,
+ tp/init/tex4ht.pm: separate registrar that
+ register errors from from configuration in Texinfo::Report
+ for document_warn() and document_error().
+
+2021-08-30 Patrice Dumas <pertusus@free.fr>
+
* tp/Texinfo/Report.pm (line_warn, line_error),
Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_protect_hashchar),
Pod-Simple-Texinfo/pod2texi.pl (_fix_texinfo_tree),
diff --git a/tp/DebugTexinfo/DebugTree.pm b/tp/DebugTexinfo/DebugTree.pm
index e41fd06..31153da 100644
--- a/tp/DebugTexinfo/DebugTree.pm
+++ b/tp/DebugTexinfo/DebugTree.pm
@@ -60,7 +60,8 @@ sub output($$)
if (! $self->{'output_file'} eq '') {
$fh = $self->Texinfo::Common::open_out ($self->{'output_file'});
if (!$fh) {
- $self->document_error(sprintf($self->__("could not open %s for writing:
%s"),
+ $self->document_error($self,
+ sprintf($self->__("could not open %s for writing: %s"),
$self->{'output_file'}, $!));
return undef;
}
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 793d7a6..6271680 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1246,7 +1246,8 @@ sub expand_verbatiminclude($$$)
}
if (!close (VERBINCLUDE)) {
if ($registrar) {
- $registrar->document_warn(sprintf(__(
+ $registrar->document_warn(
+ $configuration_informations, sprintf(__(
"error on closing \@verbatiminclude file %s: %s"),
$file, $!));
}
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 9343b6f..00d01fb 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -728,7 +728,8 @@ sub output($$)
or $self->get_conf('OUTFILE') eq '-'
or $self->get_conf('OUTFILE') eq '')) {
if ($self->get_conf('SPLIT')) {
- $self->document_warn(sprintf(__("%s: output incompatible with split"),
+ $self->document_warn($self,
+ sprintf(__("%s: output incompatible with split"),
$self->get_conf('OUTFILE')));
$self->force_conf('SPLIT', 0);
}
@@ -782,7 +783,8 @@ sub output($$)
if ($self->get_conf('DEBUG'));
$fh = $self->Texinfo::Common::open_out($outfile);
if (!$fh) {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$outfile, $!));
return undef;
}
@@ -803,7 +805,8 @@ sub output($$)
if ($fh and $outfile ne '-') {
$self->register_close_file($outfile);
if (!close($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$outfile, $!));
}
}
@@ -820,7 +823,8 @@ sub output($$)
if (!$files{$element->{'filename'}}->{'fh'}) {
$file_fh =
$self->Texinfo::Common::open_out($element->{'out_filename'});
if (!$file_fh) {
- $self->document_error(sprintf(__("could not open %s for writing:
%s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$element->{'out_filename'}, $!));
return undef;
}
@@ -836,7 +840,8 @@ sub output($$)
if ($element->{'out_filename'} ne '-') {
$self->register_close_file($element->{'out_filename'});
if (!close($file_fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$element->{'out_filename'}, $!));
return undef;
}
@@ -913,7 +918,7 @@ sub _create_destination_directory($)
$directories . '.' . $self->get_conf('EXTENSION'), $file);
if (! -d $new_directory) {
if (!mkdir($new_directory, oct(755))) {
- $self->document_error(sprintf(__(
+ $self->document_error($self, sprintf(__(
"could not create directories `%s' or `%s': %s"),
$self->{'destination_directory'}, $new_directory, $!));
return undef;
@@ -921,7 +926,7 @@ sub _create_destination_directory($)
}
$self->{'destination_directory'} = $new_directory;
} else {
- $self->document_error(sprintf(__(
+ $self->document_error($self, sprintf(__(
"could not create directory `%s': %s"),
$self->{'destination_directory'}, $!));
return undef;
@@ -1095,7 +1100,8 @@ sub output_no_split($$)
if (! $self->{'output_file'} eq '') {
$fh = $self->Texinfo::Common::open_out($self->{'output_file'});
if (!$fh) {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$self->{'output_file'}, $!));
return undef;
}
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 239d4c2..61924d4 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -314,7 +314,8 @@ sub output($$)
if (! $self->{'output_file'} eq '') {
$fh = $self->Texinfo::Common::open_out ($self->{'output_file'});
if (!$fh) {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$self->{'output_file'}, $!));
return undef;
}
@@ -350,7 +351,8 @@ sub output($$)
if ($fh and $self->{'output_file'} ne '-') {
$self->register_close_file($self->{'output_file'});
if (!close ($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$self->{'output_file'}, $!));
}
}
@@ -1137,7 +1139,8 @@ sub _convert($$;$)
if ($argument) {
$result = "&#x$argument;";
} else {
- $self->line_warn($self, __("no argument specified for \@U"),
+ $self->line_warn($self,
+ __("no argument specified for \@U"),
$root->{'line_nr'});
$result = '';
}
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index b8d54a4..5876c9f 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -690,11 +690,13 @@ sub get_value($$)
# intercept warning and error messages to take 'ignore_notice' into
# account
-sub noticed_line_warn
+sub noticed_line_warn($$$)
{
my $self = shift;
+ my $text = shift;
+ my $line_nr = shift;
return if ($self->{'ignore_notice'});
- return $self->line_warn($self, @_);
+ return $self->line_warn($self, $text, $line_nr);
}
# This function should be used in formatting functions when some
@@ -5016,7 +5018,7 @@ sub _parse_htmlxref_files($$)
}
print STDERR "html refs config file: $file\n" if
($self->get_conf('DEBUG'));
unless (open (HTMLXREF, $file)) {
- $self->document_warn(
+ $self->document_warn($self,
sprintf(__("could not open html refs config file %s: %s"),
$file, $!));
next;
@@ -5045,11 +5047,13 @@ sub _parse_htmlxref_files($$)
my $split_or_mono = shift @htmlxref;
#print STDERR "$split_or_mono
$Texi2HTML::Config::htmlxref_entries{$split_or_mono} $line_nr\n";
if (!defined($split_or_mono)) {
- $self->file_line_warn(__("missing type"), $fname, $line_nr);
+ $self->file_line_warn(__("missing type"),
+ $fname, $line_nr);
next;
} elsif (!defined($htmlxref_entries{$split_or_mono})) {
- $self->file_line_warn(sprintf(__("unrecognized type: %s"),
- $split_or_mono), $fname, $line_nr);
+ $self->file_line_warn(
+ sprintf(__("unrecognized type: %s"),
+ $split_or_mono), $fname, $line_nr);
next;
}
my $href = shift @htmlxref;
@@ -5064,7 +5068,7 @@ sub _parse_htmlxref_files($$)
$htmlxref->{$manual}->{$split_or_mono} = $href;
}
if (!close (HTMLXREF)) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"error on closing html refs config file %s: %s"),
$file, $!));
}
@@ -5384,14 +5388,14 @@ sub _process_css_file($$$)
}
}
}
- #file_line_warn (__("string not closed in css file"), $file) if ($in_string);
- #file_line_warn (__("--css-file ended in comment"), $file) if ($in_comment);
- #file_line_warn (__("\@import not finished in css file"), $file) if
($in_import and !$in_comment and !$in_string);
- $self->file_line_warn(sprintf(__("string not closed in css file"),
+ $self->file_line_warn(
+ sprintf(__("string not closed in css file"),
$file, $line_nr)) if ($in_string);
- $self->file_line_warn(sprintf(__("--css-include ended in comment"),
+ $self->file_line_warn(
+ sprintf(__("--css-include ended in comment"),
$file, $line_nr)) if ($in_comment);
- $self->file_line_warn(sprintf(__("\@import not finished in css file"),
+ $self->file_line_warn(
+ sprintf(__("\@import not finished in css file"),
$file, $line_nr))
if ($in_import and !$in_comment and !$in_string);
return ($imports, $rules);
@@ -5416,13 +5420,13 @@ sub _prepare_css($)
} else {
$css_file = $self->Texinfo::Common::locate_include_file($file);
unless (defined($css_file)) {
- $self->document_warn(sprintf(
+ $self->document_warn($self, sprintf(
__("CSS file %s not found"), $file));
next;
}
# FIXME use open_out?
unless (open (CSSFILE, $css_file)) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"could not open --include-file %s: %s"),
$css_file, $!));
next;
@@ -5433,7 +5437,8 @@ sub _prepare_css($)
($import_lines, $rules_lines)
= $self->_process_css_file ($css_file_fh, $css_file);
if (!close($css_file_fh)) {
- $self->document_warn(sprintf(__("error on closing CSS file %s: %s"),
+ $self->document_warn($self,
+ sprintf(__("error on closing CSS file %s: %s"),
$css_file, $!));
}
push @css_import_lines, @$import_lines;
@@ -6234,7 +6239,7 @@ sub _external_node_href($$$$)
"no htmlxref.cnf entry found for `%s'"), $manual_name),
$link_command->{'line_nr'});
} elsif (!$self->{'check_htmlxref_already_warned'}->{$manual_name}) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"no htmlxref.cnf entry found for `%s'"), $manual_name),
);
}
@@ -6736,7 +6741,7 @@ sub _file_header_informations($$)
if (defined($self->get_conf('INFO_JS_DIR'))) {
if (!$self->get_conf('SPLIT')) {
- $self->document_error(
+ $self->document_error($self,
sprintf(__("%s not meaningful for non-split output"),
'INFO_JS_DIR'));
} else {
@@ -7065,7 +7070,7 @@ sub _do_jslicenses_file {
$a .= "</body></html>\n";
if (File::Spec->file_name_is_absolute($path) or $path =~ /^[A-Za-z]*:/) {
- $self->document_warn(sprintf(
+ $self->document_warn($self, sprintf(
__("cannot use absolute path or URL `%s' for JS_WEBLABELS_FILE when generating
web labels file"), $path));
return;
}
@@ -7076,11 +7081,13 @@ __("cannot use absolute path or URL `%s' for
JS_WEBLABELS_FILE when generating w
print $fh $a;
$self->register_close_file($license_file);
if (!close ($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$license_file, $!));
}
} else {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$license_file, $!));
}
}
@@ -7131,12 +7138,14 @@ EOT
$self->register_close_file($frame_outfile);
if (!close ($frame_fh)) {
- $self->document_error(sprintf(__("error on closing frame file %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing frame file %s: %s"),
$frame_outfile, $!));
return 0;
}
} else {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$frame_outfile, $!));
return 0;
}
@@ -7155,12 +7164,14 @@ EOT
$self->register_close_file($toc_frame_outfile);
if (!close ($toc_frame_fh)) {
- $self->document_error(sprintf(__("error on closing TOC frame file %s:
%s"),
+ $self->document_error($self,
+ sprintf(__("error on closing TOC frame file %s: %s"),
$toc_frame_outfile, $!));
return 0;
}
} else {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$toc_frame_outfile, $!));
return 0;
}
@@ -7601,7 +7612,8 @@ sub output($$)
}
$fh = $self->Texinfo::Common::open_out($outfile);
if (!$fh) {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$outfile, $!));
return undef;
}
@@ -7629,7 +7641,8 @@ sub output($$)
if ($fh and $outfile ne '-') {
$self->register_close_file($outfile);
if (!close($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$outfile, $!));
}
}
@@ -7673,7 +7686,8 @@ sub output($$)
if (!$files{$element->{'filename'}}->{'fh'}) {
$file_fh =
$self->Texinfo::Common::open_out($element->{'out_filename'});
if (!$file_fh) {
- $self->document_error(sprintf(__("could not open %s for writing:
%s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$element->{'out_filename'}, $!));
return undef;
}
@@ -7694,7 +7708,8 @@ sub output($$)
if ($element->{'out_filename'} ne '-') {
$self->register_close_file($element->{'out_filename'});
if (!close($file_fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$element->{'out_filename'}, $!));
return undef;
}
@@ -7706,7 +7721,7 @@ sub output($$)
$self->get_conf('INFO_JS_DIR'));
if (!-d $jsdir) {
if (-f $jsdir) {
- $self->document_error(
+ $self->document_error($self,
sprintf(__("%s already exists but is not a directory"), $jsdir));
} else {
mkdir $jsdir;
@@ -7725,7 +7740,7 @@ sub output($$)
my $from = File::Spec->catfile($jssrcdir, $f);
if (!copy($from, $jsdir)) {
- $self->document_error(
+ $self->document_error($self,
sprintf(__("error on copying %s into %s"), $from, $jsdir));
}
}
@@ -7779,14 +7794,14 @@ sub output($$)
}
my $file_fh = $self->Texinfo::Common::open_out($out_filename);
if (!$file_fh) {
- $self->document_error(sprintf(__(
+ $self->document_error($self, sprintf(__(
"could not open %s for writing: %s"),
$out_filename, $!));
} else {
print $file_fh $redirection_page;
$self->register_close_file($out_filename);
if (!close ($file_fh)) {
- $self->document_error(sprintf(__(
+ $self->document_error($self, sprintf(__(
"error on closing redirection node file %s: %s"),
$out_filename, $!));
return undef;
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index 0cff890..296f743 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -283,7 +283,8 @@ sub output_ixin($$)
if (! $self->{'output_file'} eq '') {
$fh = $self->Texinfo::Common::open_out($self->{'output_file'});
if (!$fh) {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$self->{'output_file'}, $!));
return undef;
}
@@ -906,7 +907,8 @@ sub output_ixin($$)
if ($fh and $self->{'output_file'} ne '-') {
$self->register_close_file($self->{'output_file'});
if (!close ($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$self->{'output_file'}, $!));
}
}
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 4e09816..20d5bfb 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -157,7 +157,8 @@ sub output($)
if ($out_file_nr == 1) {
$self->register_close_file($self->{'output_file'});
if (defined($close_error)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$self->{'output_file'}, $close_error));
return undef;
}
@@ -167,7 +168,8 @@ sub output($)
}
unless (rename($self->{'output_file'},
$self->{'output_file'}.'-'.$out_file_nr)) {
- $self->document_error(sprintf(__("rename %s failed: %s"),
+ $self->document_error($self,
+ sprintf(__("rename %s failed: %s"),
$self->{'output_file'}, $!));
return undef;
}
@@ -183,7 +185,8 @@ sub output($)
} else {
$self->register_close_file($self->{'output_file'}.'-'.$out_file_nr);
if (defined($close_error)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$self->{'output_file'}.'-'.$out_file_nr,
$close_error));
return undef;
@@ -211,7 +214,8 @@ sub output($)
if ($out_file_nr > 1) {
$self->register_close_file($self->{'output_file'}.'-'.$out_file_nr);
if (!close ($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$self->{'output_file'}.'-'.$out_file_nr, $!));
return undef;
}
@@ -274,7 +278,8 @@ sub output($)
unless ($self->{'output_file'} eq '-') {
$self->register_close_file($self->{'output_file'});
if (!close ($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$self->{'output_file'}, $!));
}
}
@@ -293,7 +298,7 @@ sub _open_info_file($$)
my $filename = shift;
my $fh = $self->Texinfo::Common::open_out($filename, undef, 'use_binmode');
if (!$fh) {
- $self->document_error(sprintf(
+ $self->document_error($self, sprintf(
__("could not open %s for writing: %s"),
$filename, $!));
return undef;
@@ -378,7 +383,8 @@ sub _error_outside_of_any_node($$)
my $self = shift;
my $root = shift;
if (!$self->{'node'}) {
- $self->line_warn($self, sprintf(__("\@%s outside of any node"),
+ $self->line_warn($self,
+ sprintf(__("\@%s outside of any node"),
$root->{'cmdname'}), $root->{'line_nr'});
}
}
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index d6708f9..8c33efe 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -887,7 +887,8 @@ sub output($$)
if (! $self->{'output_file'} eq '') {
$fh = $self->Texinfo::Common::open_out ($self->{'output_file'});
if (!$fh) {
- $self->document_error(sprintf(__("could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
$self->{'output_file'}, $!));
return undef;
}
@@ -976,7 +977,8 @@ sub output($$)
if ($fh and $self->{'output_file'} ne '-') {
$self->register_close_file($self->{'output_file'});
if (!close ($fh)) {
- $self->document_error(sprintf(__("error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
$self->{'output_file'}, $!));
}
}
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 33c3aae..6d99b82 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1350,7 +1350,8 @@ sub _printindex_formatted($$;$)
# done by the Parser.
# Warn, only once.
if (!$self->{'index_entries_no_node'}->{$entry}) {
- $self->line_warn($self, sprintf(__("entry for index `%s' outside of
any node"),
+ $self->line_warn($self,
+ sprintf(__("entry for index `%s' outside of any node"),
$index_name),
$entry->{'command'}->{'line_nr'});
$self->{'index_entries_no_node'}->{$entry} = 1;
}
@@ -1463,12 +1464,14 @@ sub _image_text($$$)
# remove last end of line
chomp ($result);
if (!close ($filehandle)) {
- $self->document_warn(sprintf(__("error on closing image text file %s:
%s"),
+ $self->document_warn($self,
+ sprintf(__("error on closing image text file %s: %s"),
$txt_file, $!));
}
return ($result, $max_width);
} else {
- $self->line_warn($self, sprintf(__("\@image file `%s' unreadable: %s"),
+ $self->line_warn($self,
+ sprintf(__("\@image file `%s' unreadable: %s"),
$txt_file, $!), $root->{'line_nr'});
}
}
@@ -2217,7 +2220,8 @@ sub _convert($$)
"`.' or `,' must follow \@xref, not %s"),
$char), $root->{'line_nr'});
} else {
- $self->line_warn($self, __("`.' or `,' must follow \@xref"),
+ $self->line_warn($self,
+ __("`.' or `,' must follow \@xref"),
$root->{'line_nr'});
}
}
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 9468fba..3535c90 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -906,7 +906,8 @@ sub parse_texi_file($$)
my $filehandle = do { local *FH };
if (!_open_in($self, $filehandle, $file_name)) {
- $self->document_error(sprintf(__("could not open %s: %s"),
+ $self->document_error($self,
+ sprintf(__("could not open %s: %s"),
$file_name, $!));
return undef;
}
@@ -1964,9 +1965,9 @@ sub _next_text($$)
# Don't close STDIN
if ($previous_input->{'fh'} and $previous_input->{'name'} ne '-') {
if (!close($previous_input->{'fh'})) {
- $self->document_warn(sprintf(__("error on closing %s: %s"),
+ $self->document_warn($self,
+ sprintf(__("error on closing %s: %s"),
$previous_input->{'name'}, $!));
-
}
}
}
diff --git a/tp/Texinfo/Report.pm b/tp/Texinfo/Report.pm
index d24e004..7713dab 100644
--- a/tp/Texinfo/Report.pm
+++ b/tp/Texinfo/Report.pm
@@ -115,16 +115,18 @@ sub line_error($$$$)
$self->{'error_nrs'}++;
}
-sub document_warn($$)
+sub document_warn($$$)
{
my $self = shift;
+ my $configuration_informations = shift;
my $text = shift;
chomp($text);
my $warn_line;
- if (defined($self->get_conf('PROGRAM')) and $self->get_conf('PROGRAM') ne
'') {
+ if (defined($configuration_informations->get_conf('PROGRAM'))
+ and $configuration_informations->get_conf('PROGRAM') ne '') {
$warn_line = sprintf(__p("whole document warning", "%s: warning: %s\n"),
- $self->get_conf('PROGRAM'), $text);
+ $configuration_informations->get_conf('PROGRAM'), $text);
} else {
$warn_line = sprintf(__p("whole document warning", "warning: %s\n"),
$text);
@@ -133,14 +135,17 @@ sub document_warn($$)
{ 'type' => 'warning', 'text' => $text, 'error_line' => $warn_line };
}
-sub document_error($$)
+sub document_error($$$)
{
my $self = shift;
+ my $configuration_informations = shift;
my $text = shift;
chomp($text);
my $error_line;
- if (defined($self->get_conf('PROGRAM')) and $self->get_conf('PROGRAM') ne
'') {
- $error_line = sprintf("%s: %s\n", $self->get_conf('PROGRAM'), $text);
+ if (defined($configuration_informations->get_conf('PROGRAM'))
+ and $configuration_informations->get_conf('PROGRAM') ne '') {
+ $error_line = sprintf("%s: %s\n",
+ $configuration_informations->get_conf('PROGRAM'), $text);
} else {
$error_line = "$text\n";
}
@@ -452,14 +457,14 @@ Texinfo::Report - Error storing and string translations
for Texinfo modules
@ISA = qw(Texinfo::Report);
- $converter->Texinfo::Report::new();
+ $registrar->Texinfo::Report::new();
if ($warning_happened) {
- $converter->line_warn($converter, sprintf($converter->__("\@%s is wrongly
used"),
+ $registrar->line_warn($converter, sprintf(__("\@%s is wrongly used"),
$current->{'cmdname'}), $current->{'line_nr'});
}
- my ($errors, $errors_count) = $converter->errors();
+ my ($errors, $errors_count) = $registrar->errors();
foreach my $error_message (@$errors) {
warn $error_message->{'error_line'};
}
@@ -473,13 +478,8 @@ Texinfo::Report - Error storing and string translations
for Texinfo modules
The Texinfo::Report module helps with string translations and error
handling. It is used by the Texinfo modules Texinfo::Parser and
-Texinfo::Convert::Converter. To use this module, the usual way is
-to inherit Texinfo::Report methods and initialize the Texinfo::Report
-variables for a I<$converter> object. This is done by calling
-C<Texinfo::Report::new()> on the I<$converter> object. This is done by
-Texinfo::Convert::Converter, for instance, so every module that inherits
-Texinfo::Convert::Converter can automatically use the Texinfo::Report
-methods in an object-oriented way.
+Texinfo::Convert::Converter. To use this module, initialize the
+Texinfo::Report object with C<Texinfo::Report::new()>.
Besides the C<new> method, C<gdt> is used for string translations,
C<errors> for reporting errors, and the other methods to store errors
@@ -550,7 +550,7 @@ methods allow registering errors and warnings.
=over
-=item ($error_warnings_list, $error_count) = errors ($converter)
+=item ($error_warnings_list, $error_count) = errors ($registrar)
This function returns as I<$error_count> the count of errors since
calling C<new>. The I<$error_warnings_list> is an array of hash references
@@ -587,30 +587,30 @@ the error or warning.
=back
-=item $converter->line_warn($text, $configuration_informations, $line_nr)
+=item $registrar->line_warn($text, $configuration_informations, $line_nr)
-=item $converter->line_error($text, $configuration_informations, $line_nr)
+=item $registrar->line_error($text, $configuration_informations, $line_nr)
Register a warning or an error. The I<$text> is the text of the
error or warning. The optional I<$line_nr> holds the information
on the error or warning location. It is associated with the I<line_nr>
key of Texinfo tree elements as described in L<Texinfo::Parser/line_nr>
-for the @-commands. The I<$line_nr> structure is described in
L<errors|($error_warnings_list, $error_count) = errors ($converter)>
+for the @-commands. The I<$line_nr> structure is described in
L<errors|($error_warnings_list, $error_count) = errors ($registrar)>
above.
-=item $converter->document_warn($text)
+=item $registrar->document_warn($text)
-=item $converter->document_error($text)
+=item $registrar->document_error($text)
Register a document-wide error or warning. I<$text> is the error or
warning message.
-=item $converter->file_line_warn($text, $file, $line_nr)
+=item $registrar->file_line_warn($text, $file, $line_nr)
Register the warning message I<$text> for file I<$file>, with, optionally
the line I<$line_nr> in the file.
-=item $converter->file_line_error($text, $file, $line_nr)
+=item $registrar->file_line_error($text, $file, $line_nr)
Register the error message I<$text> for file I<$file>, with, optionally
the line I<$line_nr> in the file.
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 2079b5d..b944812 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -176,8 +176,8 @@ sub sectioning_structure($$$$)
# new command is below
if ($previous_section->{'level'} < $level) {
if ($level - $previous_section->{'level'} > 1) {
- $registrar->line_error($configuration_informations, sprintf(
- __("raising the section level of \@%s which is too low"),
+ $registrar->line_error($configuration_informations,
+ sprintf(__("raising the section level of \@%s which is too low"),
$content->{'cmdname'}), $content->{'line_nr'});
$content->{'level'} = $previous_section->{'level'} + 1;
}
@@ -208,13 +208,13 @@ sub sectioning_structure($$$$)
if ($content->{'cmdname'} eq 'part') {
$new_upper_part_element = 1;
if ($level < $up->{'level'}) {
- $registrar->line_warn($configuration_informations, sprintf(__(
- "no chapter-level command before \@%s"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("no chapter-level command before \@%s"),
$content->{'cmdname'}), $content->{'line_nr'});
}
} else {
- $registrar->line_warn($configuration_informations, sprintf(__(
- "lowering the section level of \@%s appearing after a
lower element"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("lowering the section level of \@%s appearing after a lower
element"),
$content->{'cmdname'}), $content->{'line_nr'});
$content->{'level'} = $up->{'level'} + 1;
}
@@ -302,8 +302,8 @@ sub sectioning_structure($$$$)
}
} elsif ($content->{'cmdname'} eq 'part'
and !$content->{'extra'}->{'part_associated_section'}) {
- $registrar->line_warn($configuration_informations, sprintf(__(
- "no sectioning command associated with \@%s"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("no sectioning command associated with \@%s"),
$content->{'cmdname'}), $content->{'line_nr'});
}
}
@@ -334,7 +334,8 @@ sub warn_non_empty_parts($$$)
if ($global_commands->{'part'}) {
foreach my $part (@{$global_commands->{'part'}}) {
if (!Texinfo::Common::is_content_empty($part)) {
- $registrar->line_warn($configuration_informations, sprintf(__("\@%s
not empty"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("\@%s not empty"),
$part->{'cmdname'}), $part->{'line_nr'});
}
}
@@ -392,20 +393,20 @@ sub _check_menu_entry($$$$$)
my $menu_node = $labels->{$normalized_menu_node};
if (!$menu_node) {
- $registrar->line_error($configuration_informations, sprintf(
- __("\@%s reference to nonexistent node `%s'"), $command,
+ $registrar->line_error($configuration_informations,
+ sprintf(__("\@%s reference to nonexistent node `%s'"), $command,
node_extra_to_texi($menu_content->{'extra'}->{'menu_entry_node'})),
$menu_content->{'line_nr'});
} else {
if (!_check_node_same_texinfo_code($menu_node,
$menu_content->{'extra'}->{'menu_entry_node'})) {
- $registrar->line_warn($configuration_informations, sprintf(
- __("\@%s entry node name `%s' different from %s name `%s'"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("\@%s entry node name `%s' different from %s name `%s'"),
$command,
node_extra_to_texi($menu_content->{'extra'}->{'menu_entry_node'}),
$menu_node->{'cmdname'},
node_extra_to_texi($menu_node->{'extra'})),
- $menu_content->{'line_nr'});
+ $menu_content->{'line_nr'});
}
}
}
@@ -484,7 +485,8 @@ sub set_menus_node_directions($$$$$$)
if ($node->{'menus'}) {
if (@{$node->{'menus'}} > 1) {
foreach my $menu (@{$node->{'menus'}}[1 .. $#{$node->{'menus'}}]) {
- $registrar->line_warn($configuration_informations,
sprintf(__("multiple \@%s"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("multiple \@%s"),
$menu->{'cmdname'}), $menu->{'line_nr'});
}
}
@@ -616,8 +618,8 @@ sub complete_node_tree_with_menus($$$$)
and $section->{'section_up'}{'extra'}{'associated_node'}{'menus'}
and @{$section->{'section_up'}{'extra'}{'associated_node'}{'menus'}}
and !$node->{'menu_'.$direction}) {
- $registrar->line_warn($configuration_informations, sprintf(
- __("node %s for `%s' is `%s' in sectioning but not in menu"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("node %s for `%s' is `%s' in sectioning but not in menu"),
$direction,
node_extra_to_texi($node->{'extra'}),
node_extra_to_texi($direction_associated_node->{'extra'})),
@@ -634,8 +636,8 @@ sub complete_node_tree_with_menus($$$$)
and !$node->{'menu_'.$direction}->{'extra'}->{'manual_content'})
{
if
($configuration_informations->get_conf('CHECK_NORMAL_MENU_STRUCTURE')
and $node->{'extra'}->{'associated_section'}) {
- $registrar->line_warn($configuration_informations, sprintf(
- __("node `%s' is %s for `%s' in menu but not in sectioning"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("node `%s' is %s for `%s' in menu but not in sectioning"),
node_extra_to_texi($node->{'menu_'.$direction}->{'extra'}),
$direction,
node_extra_to_texi($node->{'extra'}),
@@ -676,8 +678,8 @@ sub complete_node_tree_with_menus($$$$)
and $node->{'menu_'.$direction}
ne $node->{'node_'.$direction}
and not
$node->{'menu_'.$direction}->{'extra'}->{'manual_content'}) {
- $registrar->line_warn($configuration_informations, sprintf(
- __("node %s pointer for `%s' is `%s' but %s is `%s' in menu"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("node %s pointer for `%s' is `%s' but %s is `%s' in
menu"),
$direction,
node_extra_to_texi($node->{'extra'}),
node_extra_to_texi($node->{'node_'.$direction}->{'extra'}),
@@ -697,11 +699,12 @@ sub complete_node_tree_with_menus($$$$)
or
!$node->{'menu_up_hash'}->{$node->{'node_up'}->{'extra'}->{'normalized'}})) {
# check if up node has a menu
if ($node->{'node_up'}->{'menus'} and @{$node->{'node_up'}->{'menus'}}) {
- $registrar->line_warn($configuration_informations, sprintf(
+ $registrar->line_warn($configuration_informations,
+ sprintf(
__("node `%s' lacks menu item for `%s' despite being its Up
target"),
node_extra_to_texi($node->{'node_up'}->{'extra'}),
node_extra_to_texi($node->{'extra'})),
- $node->{'node_up'}->{'line_nr'});
+ $node->{'node_up'}->{'line_nr'});
}
# FIXME check that the menu_up_hash is not empty (except for Top)?
# FIXME check that node_up is not an external node (except for Top)?
@@ -787,23 +790,25 @@ sub nodes_tree($$$$$$)
if (!$parser_informations->{'novalidate'}
and !_check_node_same_texinfo_code($node_target,
$node_direction)) {
- $registrar->line_warn($configuration_informations, sprintf(
- __("%s pointer `%s' (for node `%s') different from %s name
`%s'"),
+ $registrar->line_warn($configuration_informations,
+ sprintf(
+ __("%s pointer `%s' (for node `%s') different from %s name
`%s'"),
$direction_texts{$direction},
node_extra_to_texi($node_direction),
node_extra_to_texi($node->{'extra'}),
$node_target->{'cmdname'},
node_extra_to_texi($node_target->{'extra'})),
- $node->{'line_nr'});
+ $node->{'line_nr'});
}
} else {
if ($parser_informations->{'novalidate'}) {
$node->{'node_'.$direction} = { 'extra' => $node_direction };
} else {
- $registrar->line_error($configuration_informations, sprintf(
- __("%s reference to nonexistent `%s'"),
- $direction_texts{$direction},
- node_extra_to_texi($node_direction)), $node->{'line_nr'});
+ $registrar->line_error($configuration_informations,
+ sprintf(__("%s reference to nonexistent `%s'"),
+ $direction_texts{$direction},
+ node_extra_to_texi($node_direction)),
+ $node->{'line_nr'});
}
}
}
@@ -1343,12 +1348,13 @@ sub associate_internal_references($$$$$)
$ref->{'extra'}->{'label'} = $node_target;
if (!$parser_informations->{'novalidate'}
and !_check_node_same_texinfo_code($node_target, $node_arg)) {
- $registrar->line_warn($configuration_informations, sprintf(
- __("\@%s to `%s', different from %s name `%s'"),
- $ref->{'cmdname'},
- node_extra_to_texi($node_arg),
- $node_target->{'cmdname'},
- node_extra_to_texi($node_target->{'extra'})), $ref->{'line_nr'});
+ $registrar->line_warn($configuration_informations,
+ sprintf(__("\@%s to `%s', different from %s name `%s'"),
+ $ref->{'cmdname'},
+ node_extra_to_texi($node_arg),
+ $node_target->{'cmdname'},
+ node_extra_to_texi($node_target->{'extra'})),
+ $ref->{'line_nr'});
}
}
}
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index 285d11f..69616a4 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -250,8 +250,9 @@ sub parse_texi_file ($$)
my $status = parse_file ($file_name);
if ($status) {
- # TODO: internationalise this message?
- $self->document_error(sprintf("could not open %s: %s", $file_name, $!));
+ # FIXME internationalize
+ $self->document_error($self,
+ sprintf("could not open %s: %s", $file_name, $!));
return undef;
}
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index 42fe7f5..add3537 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -219,7 +219,8 @@ sub chm_init($)
my $hhk_file = File::Spec->catfile($outdir, $hhk_filename);
my $hhk_fh = Texinfo::Common::open_out($self, $hhk_file);
if (!defined($hhk_fh)) {
- $self->document_error(sprintf(__("chm.pm: could not open %s for writing:
%s\n"),
+ $self->document_error($self,
+ sprintf(__("chm.pm: could not open %s for writing: %s\n"),
$hhk_file, $!));
return 0;
}
@@ -235,8 +236,8 @@ sub chm_init($)
}
print $hhk_fh "</OBJECT>\n";
- my $index_entries = Texinfo::Structuring::sort_indices($self->{'parser'},
$self, $self,
- $self->{'index_entries'},
+ my $index_entries = Texinfo::Structuring::sort_indices($self->{'parser'},
+ $self, $self, $self->{'index_entries'},
$self->{'index_names'});
if ($index_entries) {
foreach my $index_name (sort(keys(%$index_entries))) {
@@ -265,7 +266,8 @@ sub chm_init($)
print $hhk_fh "</BODY>\n</HTML>\n";
delete $self->{'unclosed_files'}->{$hhk_file};
if (!close ($hhk_fh)) {
- $self->document_error(sprintf(__("chm.pm: error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("chm.pm: error on closing %s: %s"),
$hhk_file, $!));
return 0;
}
@@ -275,7 +277,8 @@ sub chm_init($)
my $hhc_fh = Texinfo::Common::open_out($self, $hhc_file);
# Not sure $! is still valid
if (!defined($hhc_fh)) {
- $self->document_error(sprintf(__("chm.pm: could not open %s for writing:
%s\n"),
+ $self->document_error($self,
+ sprintf(__("chm.pm: could not open %s for writing: %s\n"),
$hhc_file, $!));
return 0;
}
@@ -335,7 +338,8 @@ sub chm_init($)
print $hhc_fh "</HTML>\n</BODY>\n";
delete $self->{'unclosed_files'}->{$hhc_file};
if (!close ($hhc_fh)) {
- $self->document_error(sprintf(__("chm.pm: error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("chm.pm: error on closing %s: %s"),
$hhc_file, $!));
return 0;
}
@@ -345,7 +349,8 @@ sub chm_init($)
my $hhp_fh = Texinfo::Common::open_out($self, $hhp_file);
# Not sure $! is still valid
if (!defined($hhp_fh)) {
- $self->document_error(sprintf(__("chm.pm: could not open %s for writing:
%s\n"),
+ $self->document_error(
+ $self, sprintf(__("chm.pm: could not open %s for writing: %s\n"),
$hhp_file, $!));
return 0;
}
@@ -396,7 +401,8 @@ EOT
delete $self->{'unclosed_files'}->{$hhp_file};
if (!close ($hhp_fh)) {
- $self->document_error(sprintf(__("chm.pm: error on closing %s: %s"),
+ $self->document_error($self,
+ sprintf(__("chm.pm: error on closing %s: %s"),
$hhp_file, $!));
return 0;
}
diff --git a/tp/init/highlight_syntax.pm b/tp/init/highlight_syntax.pm
index 7bc978b..517a7eb 100644
--- a/tp/init/highlight_syntax.pm
+++ b/tp/init/highlight_syntax.pm
@@ -54,7 +54,7 @@ sub _get_highlighted_languages($)
my $cmd = 'source-highlight --lang-list';
if (not(open(HIGHLIGHT_LANG_LIST, '-|', $cmd))) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
'highlight_syntax.pm: command failed: %s'), $cmd));
return 0;
}
@@ -65,7 +65,7 @@ sub _get_highlighted_languages($)
my $language = $1;
$highlighted_languages_list{$language} = 1;
} else {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
'highlight_syntax.pm: %s: %s: cannot parse language
line'),
$cmd, $line));
}
@@ -167,7 +167,8 @@ sub highlight_process($$)
# program
my $rfile = $languages{$language}->{'rfile'};
unless (open (HIGHLIGHT_LANG_IN, ">$rfile")) {
- $self->document_warn(sprintf(__("highlight_syntax.pm: could not open %s:
%s"),
+ $self->document_warn($self,
+ sprintf(__("highlight_syntax.pm: could not open %s: %s"),
$rfile, $!));
return 0;
}
@@ -216,7 +217,8 @@ sub highlight_process($$)
my $cmd = "source-highlight --src-lang=$language --out-format=html5 -i
'$rfile' -o '$html_result_file' --line-range=$option_line_range_str
--range-separator='$range_separator'";
if (system($cmd)) {
- $self->document_error(sprintf(__("highlight_syntax.pm: command did not
succeed: %s"),
+ $self->document_error($self,
+ sprintf(__("highlight_syntax.pm: command did not succeed: %s"),
$cmd));
return 0;
}
@@ -224,7 +226,8 @@ sub highlight_process($$)
my $language_fragments_nr = $languages{$language}->{'counter'};
# extract highlighted fragments
unless (open (HIGHLIGHT_LANG_OUT, $html_result_file)) {
- $self->document_warn(sprintf(__("highlight_syntax.pm: could not open %s:
%s"),
+ $self->document_warn($self,
+ sprintf(__("highlight_syntax.pm: could not open %s: %s"),
$html_result_file, $!));
return 0;
}
@@ -255,7 +258,7 @@ sub highlight_process($$)
}
}
if ($separators_count != $language_fragments_nr +1) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"highlight_syntax.pm: %s: %d separators; expected %d, the number of
fragments +1"),
$language, $separators_count,
$language_fragments_nr+1));
}
@@ -263,12 +266,12 @@ sub highlight_process($$)
my $root_command = $languages{$language}->{'commands'}->[$got_count-1];
my $root = $root_command->[0];
my $command = $root_command->[1];
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"highlight_syntax.pm: %s: end of \@%s item %d not found"),
$language, $command, $got_count));
}
if ($got_count != $languages{$language}->{'counter'}) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"highlight_syntax.pm: %s: processing produced %d items in HTML;
expected %d, the number found in the document"),
$language, $got_count, $language_fragments_nr));
}
@@ -288,7 +291,7 @@ sub highlight_preformatted_command($$)
if (exists ($commands{$cmdname}->{'results'}->{$command})
and defined($commands{$cmdname}->{'results'}->{$command})) {
if (not defined($language)) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"highlight_syntax.pm: output has HTML item for \@%s but
no language %s"),
$cmdname, $command));
} else {
@@ -335,7 +338,7 @@ sub highlight_preformatted_command($$)
return $self->_attribute_class('div', $cmdname,
$extra_classes).">\n".$preformatted_result_content.'</div>'."\n";
}
} elsif (defined($language)) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"highlight_syntax.pm: output has no HTML item for \@%s
%s %s"),
$cmdname, $language, $command));
#print STDERR "$content\n";
diff --git a/tp/init/latex2html.pm b/tp/init/latex2html.pm
index 3e67abe..d774bfe 100644
--- a/tp/init/latex2html.pm
+++ b/tp/init/latex2html.pm
@@ -194,7 +194,7 @@ sub l2h_process($$)
unless ($self->get_conf('L2H_SKIP')) {
unless (open(L2H_LATEX, ">$l2h_latex_file")) {
- $self->document_error(sprintf(__(
+ $self->document_error($self, sprintf(__(
"l2h: could not open latex file %s for writing: %s"),
$l2h_latex_file, $!));
$status = 0;
@@ -339,12 +339,14 @@ sub l2h_to_html($)
# Check for dot in directory where dvips will work
if ($self->get_conf('L2H_TMP')) {
if ($self->get_conf('L2H_TMP') =~ /\./) {
- $self->document_warn(__("l2h: L2H_TMP directory contains a dot"));
+ $self->document_warn($self,
+ __("l2h: L2H_TMP directory contains a dot"));
$dotbug = 1;
}
} else {
if (cwd() =~ /\./) {
- $self->document_warn(__("l2h: current directory contains a dot"));
+ $self->document_warn($self,
+ __("l2h: current directory contains a dot"));
$dotbug = 1;
}
}
@@ -372,7 +374,8 @@ sub l2h_to_html($)
warn "# l2h: executing '$call'\n" if ($verbose);
if (system($call)) {
- $self->document_error(sprintf(__("l2h: command did not succeed: %s"),
+ $self->document_error($self,
+ sprintf(__("l2h: command did not succeed: %s"),
$call));
return 0;
} else {
@@ -419,7 +422,7 @@ sub l2h_change_image_file_names($$)
# document extension. copying the file could result in
# overwriting an output file (almost surely if the default
# texi2html file names are used).
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"l2h: image has invalid extension: %s"), $src));
next;
}
@@ -436,7 +439,8 @@ sub l2h_change_image_file_names($$)
copy($file_src, $file_dest);
} else {
if (!rename($file_src, $file_dest)) {
- $self->document_warn(sprintf(__("l2h: rename %s as %s failed: %s"),
+ $self->document_warn($self,
+ sprintf(__("l2h: rename %s as %s failed: %s"),
$file_src, $file_dest, $!));
}
}
@@ -458,7 +462,8 @@ sub l2h_init_from_html($)
}
if (! open(L2H_HTML, "<$l2h_html_file")) {
- $self->document_warn(sprintf(__("l2h: could not open %s: %s"),
+ $self->document_warn($self,
+ sprintf(__("l2h: could not open %s: %s"),
$l2h_html_file, $!));
return 0;
}
@@ -491,7 +496,8 @@ sub l2h_init_from_html($)
}
unless ($h_end_found) {
# couldn't found the closing comment. Should be a bug.
- $self->document_warn(sprintf(__("latex2html.pm: end of \@%s item %d
not found"),
+ $self->document_warn($self,
+ sprintf(__("latex2html.pm: end of \@%s item %d not found"),
$l2h_name, $count));
close(L2H_HTML);
return 0;
@@ -501,7 +507,7 @@ sub l2h_init_from_html($)
# Not the same number of converted elements and retrieved elements
if ($latex_converted_count != $html_converted_count) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"latex2html.pm: processing produced %d items in HTML; expected %d, the
number of items found in the document"),
$html_converted_count, $latex_converted_count));
}
@@ -531,7 +537,7 @@ sub l2h_do_tex($$)
if (!defined($count)) {
# counter is undefined
$invalid_counter_count++;
- $self->document_warn(
+ $self->document_warn($self,
sprintf(__("l2h: could not determine the fragment %d for \@%s"),
$counter, $cmdname));
return ("<!-- l2h: ". __LINE__ . " undef count for ${cmdname}_$counter
-->")
@@ -557,7 +563,7 @@ sub l2h_do_tex($$)
} else {
# if the result is not in @l2h_from_html, there is an error somewhere.
$extract_error_count++;
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"l2h: could not extract the fragment %d for \@%s with output counter %d
from HTML"),
$counter, $cmdname, $count));
# try simple (ordinary) substitution (without l2h)
@@ -619,7 +625,8 @@ sub l2h_init_cache($)
my $self = shift;
if (-r $l2h_cache_file) {
my $rdo = do "$l2h_cache_file";
- $self->document_error(sprintf(__("l2h: could not load %s: %s"),
+ $self->document_error($self,
+ sprintf(__("l2h: could not load %s: %s"),
$l2h_cache_file, $@))
unless ($rdo);
}
@@ -632,7 +639,8 @@ sub l2h_store_cache($)
return unless $latex_count;
my ($key, $value);
unless (open(FH, ">$l2h_cache_file")) {
- $self->document_error(sprintf(__("l2h: could not open %s for writing: %s"),
+ $self->document_error($self,
+ sprintf(__("l2h: could not open %s for writing: %s"),
$l2h_cache_file, $!));
return;
}
diff --git a/tp/init/tex4ht.pm b/tp/init/tex4ht.pm
index 9e4e4a5..f0b86bc 100644
--- a/tp/init/tex4ht.pm
+++ b/tp/init/tex4ht.pm
@@ -142,7 +142,8 @@ sub tex4ht_prepare($$)
local *TEX4HT_TEXFILE;
unless (open (*TEX4HT_TEXFILE, ">$rfile")) {
- $self->document_warn(sprintf(__("tex4ht.pm: could not open %s: %s"),
+ $self->document_warn($self,
+ sprintf(__("tex4ht.pm: could not open %s: %s"),
$rfile, $!));
return 1;
}
@@ -240,7 +241,8 @@ sub tex4ht_convert($)
{
my $self = shift;
unless (chdir $tex4ht_out_dir) {
- $self->document_warn(sprintf(__("tex4ht.pm: chdir %s failed: %s"),
+ $self->document_warn($self,
+ sprintf(__("tex4ht.pm: chdir %s failed: %s"),
$tex4ht_out_dir, $!));
return 0;
}
@@ -252,7 +254,7 @@ sub tex4ht_convert($)
$errors += tex4ht_process_format($self, $format);
}
unless (chdir $tex4ht_initial_dir) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"tex4ht.pm: unable to return to initial directory: %s"), $!));
return 0;
}
@@ -265,7 +267,8 @@ sub tex4ht_process_format($$) {
return 0 unless ($formats{$format}->{'counter'});
- $self->document_warn(sprintf(__("tex4ht.pm: output file missing: %s"),
+ $self->document_warn($self,
+ sprintf(__("tex4ht.pm: output file missing: %s"),
$formats{$format}->{'basefile'}))
unless (-f $formats{$format}->{'basefile'});
# now run tex4ht
@@ -285,12 +288,12 @@ sub tex4ht_process_format($$) {
# if tex fails, it will read from STDIN and the input may trigger
# diverse actions by tex.
if (not(open(TEX4HT, "|-", $cmd))) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"tex4ht.pm: command failed: %s"), $cmd));
return 1;
}
if (!close (TEX4HT)) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"tex4ht.pm: closing communication failed: %s: %s"),
$cmd, $!));
return 1;
@@ -299,7 +302,8 @@ sub tex4ht_process_format($$) {
# extract the html from the file created by tex4ht
my $html_basefile = $formats{$format}->{'html_file'};
unless (open (TEX4HT_HTMLFILE, $html_basefile)) {
- $self->document_warn(sprintf(__("tex4ht.pm: could not open %s: %s"),
+ $self->document_warn($self,
+ sprintf(__("tex4ht.pm: could not open %s: %s"),
$html_basefile, $!));
return 1;
}
@@ -325,14 +329,14 @@ sub tex4ht_process_format($$) {
}
}
unless ($end_found) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"tex4ht.pm: end of %s item %d not found"),
$format, $count));
}
}
}
if ($got_count != $formats{$format}->{'counter'}) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"tex4ht.pm: processing produced %d items in HTML; expected %d, the
number of items found in the document for %s"),
$got_count, $formats{$format}->{'counter'},
$format));
@@ -352,7 +356,7 @@ sub tex4ht_do_tex($$$$)
$commands{$cmdname}->{'output_counter'}++;
return $commands{$cmdname}->{'results'}->{$command};
} else {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"tex4ht.pm: output has no HTML item for \@%s %s"),
$cmdname, $command));
return '';
@@ -367,7 +371,7 @@ sub tex4ht_finish($)
if ($self->get_conf('VERBOSE')) {
foreach my $command (keys(%commands)) {
if ($commands{$command}->{'output_counter'} !=
$commands{$command}->{'counter'}) {
- $self->document_warn(sprintf(__(
+ $self->document_warn($self, sprintf(__(
"tex4ht.pm: processing retrieved %d items in HTML; expected %d, the
number of items found in the document for \@%s"),
$commands{$command}->{'output_counter'},
$commands{$command}->{'counter'}, $command));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Report.pm (document_warn, document_error), tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, Texinfo/ParserNonXS.pm, tp/Texinfo/Structuring.pm, tp/Texinfo/XS/parsetexi/Parsetexi.pm, tp/init/chm.pm, tp/init/highlight_syntax.pm, tp/init/latex2html.pm, tp/init/tex4ht.pm: separate registrar that regist [...],
Patrice Dumas <=