[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sun, 3 Mar 2024 14:58:33 -0500 (EST) |
branch: master
commit 9012bd5040f23711b3585edcbbe2248f1742fe6d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Mar 3 20:58:29 2024 +0100
* tp/Texinfo/Document.pm (_existing_label_error)
(set_labels_identifiers_target)
(register_label_element), tp/Texinfo/Transformations.pm (_new_node):
pass registrar as argument of _existing_label_error and
register_label_element. Set the argument in
set_labels_identifiers_target as should be done for a parser, and in
_new_node as a document.
---
ChangeLog | 10 ++++++++++
tp/Texinfo/Document.pm | 14 ++++++++------
tp/Texinfo/Transformations.pm | 4 ++++
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3104efebb6..085c955c32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-03-03 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Document.pm (_existing_label_error)
+ (set_labels_identifiers_target)
+ (register_label_element), tp/Texinfo/Transformations.pm (_new_node):
+ pass registrar as argument of _existing_label_error and
+ register_label_element. Set the argument in
+ set_labels_identifiers_target as should be done for a parser, and in
+ _new_node as a document.
+
2024-03-03 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Document.pm (registrar), tp/Texinfo/Structuring.pm: add
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 57a36838fd..c9f3bf185e 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -312,14 +312,13 @@ sub document_descriptor($)
return $self->{'document_descriptor'};
}
-sub _existing_label_error($$;$)
+sub _existing_label_error($$;$$)
{
my $self = shift;
my $element = shift;
+ my $registrar = shift;
my $customization_information = shift;
- my $registrar = $self->{'registrar'};
-
if ($element->{'extra'}
and defined($element->{'extra'}->{'normalized'})) {
my $normalized = $element->{'extra'}->{'normalized'};
@@ -387,22 +386,25 @@ sub set_labels_identifiers_target($$$)
= sort {$a->{'extra'}->{'normalized'} cmp $b->{'extra'}->{'normalized'}}
@elements_with_error;
foreach my $element (@sorted) {
- _existing_label_error($self, $element, $customization_information);
+ _existing_label_error($self, $element, $self->{'registrar'},
+ $customization_information);
}
}
}
# TODO document when stabilized
-sub register_label_element($$;$)
+sub register_label_element($$;$$)
{
my $self = shift;
my $element = shift;
+ my $registrar = shift;
my $customization_information = shift;
my $retval = _add_element_to_identifiers_target($self, $element,
$customization_information);
if (!$retval) {
- _existing_label_error($self, $element, $customization_information);
+ _existing_label_error($self, $element, $registrar,
+ $customization_information);
}
# FIXME do not push at the end but have the caller give an information
# on the element it should be after or before in the list?
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 0fd3b1cc30..395e8ed7ab 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -285,6 +285,9 @@ sub reference_to_arg_in_tree($)
# $CUSTOMIZATION_INFORMATION is used for error reporting, but it may
# not be useful, as the code checks that the new node target label does
# not exist already.
+# Right now the $DOCUMENT error messages registrar is used to register
+# error messages, instead it could be given as argument. Does not matter
+# much, see just above.
sub _new_node($$;$)
{
my $node_tree = shift;
@@ -389,6 +392,7 @@ sub _new_node($$;$)
$node->{'extra'}->{'normalized'} = $normalized;
Texinfo::Document::register_label_element($document, $node,
+ $document->registrar(),
$customization_information);
return $node;