texinfo-devel
[Top][All Lists]
Advanced

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

@errmessage


From: Sergey Poznyakoff
Subject: @errmessage
Date: Sat, 17 Dec 2011 22:00:12 +0200

Hi Karl & Patrice!

Sometimes one needs a feature similar to \errmessage in TeX. Attached is
a patch that implements it in makeinfo. Second attachment provides a
test file, which should produce a user-defined error message when
compiled with the --html flag. 

Regards,
Sergey

Index: tp/Texinfo/Common.pm
===================================================================
RCS file: /cvsroot/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.103
diff -p -u -r1.103 Common.pm
--- tp/Texinfo/Common.pm        4 Dec 2011 02:55:20 -0000       1.103
+++ tp/Texinfo/Common.pm        17 Dec 2011 18:36:58 -0000
@@ -422,7 +422,7 @@ foreach my $style_command ('asis','b','c

 foreach my $one_arg_command (
   'ctrl','dmn', 'w', 'key',
-  'titlefont','hyphenation','anchor') {
+  'titlefont','hyphenation','anchor','errmessage') {
   $brace_commands{$one_arg_command} = 1;
 }

Index: tp/Texinfo/Parser.pm
===================================================================
RCS file: /cvsroot/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.339
diff -p -u -r1.339 Parser.pm
--- tp/Texinfo/Parser.pm        3 Dec 2011 14:58:41 -0000       1.339
+++ tp/Texinfo/Parser.pm        17 Dec 2011 18:36:58 -0000
@@ -4460,7 +4460,12 @@ sub _parse_texi($;$)
               $self->line_warn (sprintf($self->__("Command address@hidden does 
not accept arguments"),
                                         $closed_command), $line_nr);
             }
-            if ($current->{'parent'}->{'cmdname'} eq 'anchor') {
+            if ($current->{'parent'}->{'cmdname'} eq 'errmessage') {
+              my @contents = @{$current->{'contents'}};
+              _trim_spaces_comment_from_content(address@hidden);
+              $self->line_error ($contents[0]->{'text'}, $line_nr);
+            } elsif ($current->{'parent'}->{'cmdname'} eq 'anchor') {
               $current->{'parent'}->{'line_nr'} = $line_nr;
               my $parsed_anchor = _parse_node_manual($current);
               if (_check_node_label($self, $parsed_anchor,
\input texinfo @c -*-texinfo-*-
@setfilename e.info
@settitle E

@node Top
@top E

@ifhtml
@errmessage{Not ready for HTML output yet!}
@end ifhtml
Text

@bye

reply via email to

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