[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 16 Apr 2024 17:33:55 -0400 (EDT) |
branch: master
commit 3d2fcb2fd76c46cc367fc083da4c2fbc90d633b3
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Apr 16 23:33:39 2024 +0200
* Pod-Simple-Texinfo/pod2texi.pl (_print_texinfo_errors)
(_parsed_manual_tree): better formatting of error messages from
Texinfo modules.
---
ChangeLog | 6 ++++++
Pod-Simple-Texinfo/pod2texi.pl | 42 ++++++++++++++++++++++++++----------------
2 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 659fd4b5c1..26b5d15a00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-16 Patrice Dumas <pertusus@free.fr>
+
+ * Pod-Simple-Texinfo/pod2texi.pl (_print_texinfo_errors)
+ (_parsed_manual_tree): better formatting of error messages from
+ Texinfo modules.
+
2024-04-16 Patrice Dumas <pertusus@free.fr>
* Pod-Simple-Texinfo/pod2texi.pl (_parsed_manual_tree): set debugging
diff --git a/Pod-Simple-Texinfo/pod2texi.pl b/Pod-Simple-Texinfo/pod2texi.pl
index 88fe32b6d4..2a15a15716 100755
--- a/Pod-Simple-Texinfo/pod2texi.pl
+++ b/Pod-Simple-Texinfo/pod2texi.pl
@@ -275,6 +275,30 @@ if ($base_level > 0) {
}
}
+sub _print_texinfo_errors($$)
+{
+ my $location = shift;
+ my $error_source = shift;
+
+ my ($error_messages, $error_count) = $error_source->errors();
+ foreach my $error_message (@$error_messages) {
+ my $type_string;
+ if ($error_message->{'type'} eq 'error') {
+ $type_string = 'ERROR';
+ } else {
+ $type_string = 'WARNING';
+ }
+ my $location_string = $location;
+ if (defined($error_message->{'file_name'})) {
+ $location_string .= ":$error_message->{'file_name'}";
+ }
+ if (defined($error_message->{'line_nr'})) {
+ $location_string .= ":$error_message->{'line_nr'}";
+ }
+ warn "$type_string: $location_string: $error_message->{'error_line'}";
+ }
+}
+
# return a parser and parsed tree
sub _parsed_manual_tree($$$$$)
{
@@ -293,14 +317,7 @@ sub _parsed_manual_tree($$$$$)
my $tree = $document->tree();
if ($debug > 1) {
- my ($parser_errors, $parser_error_count) = $texi_parser->errors();
- foreach my $error_message (@$parser_errors) {
- if ($error_message->{'type'} eq 'error') {
- warn "ERROR: _parsed_manual_tree: $error_message->{'error_line'}";
- } else {
- warn "WARNING: _parsed_manual_tree: $error_message->{'error_line'}";
- }
- }
+ _print_texinfo_errors('_parsed_manual_tree', $texi_parser);
}
my $identifier_target = $document->labels_information();
@@ -341,14 +358,7 @@ sub _parsed_manual_tree($$$$$)
if ($section_nodes and $do_node_menus);
if ($debug > 1) {
- my ($document_errors, $document_error_count) = $document->errors();
- foreach my $error_message (@$document_errors) {
- if ($error_message->{'type'} eq 'error') {
- warn "ERROR: _parsed_manual_tree document:
$error_message->{'error_line'}";
- } else {
- warn "WARNING: _parsed_manual_tree document:
$error_message->{'error_line'}";
- }
- }
+ _print_texinfo_errors('_parsed_manual_tree document', $document);
}
return ($texi_parser, $document, $identifier_target);