texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Fri, 8 Dec 2023 13:06:07 -0500 (EST)

branch: master
commit eaa18a3a94f978975a4ecaba0303e5a80f11ce1b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Dec 8 19:04:54 2023 +0100

    * tp/Texinfo/Convert/HTML.pm (_noticed_line_warn): do not return a
    value.
    
    * tp/Texinfo/XS/convert/convert_html.c (noticed_line_warn),
    tp/Texinfo/XS/main/errors.c (vmessage_list_command_warn): add
    noticed_line_warn. Add a "v" version of message_list_command_warn that
    takes a va_list as argument instead of a variable length argument to
    be used in case the caller already has a variable length argument, as
    is the case with noticed_line_warn.
    
    * tp/Texinfo/XS/convert/convert_html.c (convert_raw_command):
    implement in C.
---
 ChangeLog                            | 15 ++++++
 tp/Texinfo/Convert/HTML.pm           |  2 +-
 tp/Texinfo/XS/convert/convert_html.c | 93 +++++++++++++++++++++++++++---------
 tp/Texinfo/XS/main/errors.c          | 10 ++++
 tp/Texinfo/XS/main/errors.h          |  2 +
 5 files changed, 99 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f279e4996e..5cdfee3cc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2023-12-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_noticed_line_warn): do not return a
+       value.
+
+       * tp/Texinfo/XS/convert/convert_html.c (noticed_line_warn),
+       tp/Texinfo/XS/main/errors.c (vmessage_list_command_warn): add
+       noticed_line_warn. Add a "v" version of message_list_command_warn that
+       takes a va_list as argument instead of a variable length argument to
+       be used in case the caller already has a variable length argument, as
+       is the case with noticed_line_warn.
+
+       * tp/Texinfo/XS/convert/convert_html.c (convert_raw_command):
+       implement in C.
+
 2023-12-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 3187b110fb..77554b6354 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2735,7 +2735,7 @@ sub _noticed_line_warn($$$)
   my $text = shift;
   my $line_nr = shift;
   return if ($self->{'ignore_notice'});
-  return $self->line_warn($self, $text, $line_nr);
+  $self->line_warn($self, $text, $line_nr);
 }
 
 my %kept_line_commands;
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 4f3c10406a..e46633af3c 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -14,11 +14,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 #include <ctype.h>
+#include <stdarg.h>
 
 #include "global_commands_types.h"
 #include "tree_types.h"
@@ -1876,6 +1878,24 @@ set_root_commands_targets_node_files (CONVERTER *self)
     }
 }
 
+/*
+intercept warning and error messages to take 'ignore_notice' into
+account
+ */
+static void
+noticed_line_warn (CONVERTER *self, const ELEMENT *element,
+                   const char *format, ...)
+{
+  va_list v;
+
+  if (self->ignore_notice)
+    return;
+
+  va_start (v, format);
+
+  vmessage_list_command_warn (&self->error_messages, element, format, v);
+}
+
 /* to be inlined in text parsing codes */
 #define OTXI_PROTECT_XML_FORM_FEED_CASES(var) \
         OTXI_PROTECT_XML_CASES(var) \
@@ -5923,6 +5943,29 @@ convert_w_command (CONVERTER *self, const enum 
command_id cmd,
     }
 }
 
+void
+convert_raw_command (CONVERTER *self, const enum command_id cmd,
+                    const ELEMENT *element,
+                    const HTML_ARGS_FORMATTED *args_formatted,
+                    const char *content, TEXT *result)
+{
+  if (cmd == CM_html)
+    {
+      if (content)
+        text_append (result, content);
+      return;
+    }
+
+  /* TODO the message is not marked as a translatable message.  Not
+     such an issue since the perl message is, but it could be problematic
+     if the perl code is removed. */
+  noticed_line_warn (self, element, "raw format %s is not converted",
+                     element_command_name (element));
+                //builtin_command_name (cmd));
+
+  format_protect_text (self, content, result);
+}
+
 /* command is NULL unless called from @-command formatting function */
 static char *
 contents_inline_element (CONVERTER *self, const enum command_id cmd,
@@ -6570,28 +6613,34 @@ static COMMAND_INTERNAL_CONVERSION 
commands_internal_conversion_table[] = {
   {CM_shortcontents, &convert_contents_command},
   {CM_summarycontents, &convert_contents_command},
 
-  {CM_node, convert_heading_command},
-  {CM_top, convert_heading_command},
-  {CM_chapter, convert_heading_command},
-  {CM_unnumbered, convert_heading_command},
-  {CM_chapheading, convert_heading_command},
-  {CM_appendix, convert_heading_command},
-  {CM_section, convert_heading_command},
-  {CM_unnumberedsec, convert_heading_command},
-  {CM_heading, convert_heading_command},
-  {CM_appendixsec, convert_heading_command},
-  {CM_subsection, convert_heading_command},
-  {CM_unnumberedsubsec, convert_heading_command},
-  {CM_subheading, convert_heading_command},
-  {CM_appendixsubsec, convert_heading_command},
-  {CM_subsubsection, convert_heading_command},
-  {CM_unnumberedsubsubsec, convert_heading_command},
-  {CM_subsubheading, convert_heading_command},
-  {CM_appendixsubsubsec, convert_heading_command},
-  {CM_part, convert_heading_command},
-  {CM_appendixsection, convert_heading_command},
-  {CM_majorheading, convert_heading_command},
-  {CM_centerchap, convert_heading_command},
+  {CM_node, &convert_heading_command},
+  {CM_top, &convert_heading_command},
+  {CM_chapter, &convert_heading_command},
+  {CM_unnumbered, &convert_heading_command},
+  {CM_chapheading, &convert_heading_command},
+  {CM_appendix, &convert_heading_command},
+  {CM_section, &convert_heading_command},
+  {CM_unnumberedsec, &convert_heading_command},
+  {CM_heading, &convert_heading_command},
+  {CM_appendixsec, &convert_heading_command},
+  {CM_subsection, &convert_heading_command},
+  {CM_unnumberedsubsec, &convert_heading_command},
+  {CM_subheading, &convert_heading_command},
+  {CM_appendixsubsec, &convert_heading_command},
+  {CM_subsubsection, &convert_heading_command},
+  {CM_unnumberedsubsubsec, &convert_heading_command},
+  {CM_subsubheading, &convert_heading_command},
+  {CM_appendixsubsubsec, &convert_heading_command},
+  {CM_part, &convert_heading_command},
+  {CM_appendixsection, &convert_heading_command},
+  {CM_majorheading, &convert_heading_command},
+  {CM_centerchap, &convert_heading_command},
+
+  {CM_html, &convert_raw_command},
+  {CM_tex, &convert_raw_command},
+  {CM_xml, &convert_raw_command},
+  {CM_docbook, &convert_raw_command},
+  {CM_latex, &convert_raw_command},
 
   {0, 0},
 };
diff --git a/tp/Texinfo/XS/main/errors.c b/tp/Texinfo/XS/main/errors.c
index 904ff22cdf..49173b9975 100644
--- a/tp/Texinfo/XS/main/errors.c
+++ b/tp/Texinfo/XS/main/errors.c
@@ -276,6 +276,16 @@ message_list_command_warn (ERROR_MESSAGE_LIST 
*error_messages,
                                     &e->source_info, format, v);
 }
 
+/* similar as message_list_command_warn, to be used only when the calling
+   function already has a variable argument */
+void
+vmessage_list_command_warn (ERROR_MESSAGE_LIST *error_messages,
+                            const ELEMENT *e, const char *format, va_list v)
+{
+  message_list_line_error_internal (error_messages, MSG_warning, 0,
+                                    &e->source_info, format, v);
+}
+
 void
 command_error (const ELEMENT *e, const char *format, ...)
 {
diff --git a/tp/Texinfo/XS/main/errors.h b/tp/Texinfo/XS/main/errors.h
index 76253c4091..56f5cdba33 100644
--- a/tp/Texinfo/XS/main/errors.h
+++ b/tp/Texinfo/XS/main/errors.h
@@ -32,6 +32,8 @@ void message_list_document_error (ERROR_MESSAGE_LIST 
*error_messages,
 void message_list_document_warn (ERROR_MESSAGE_LIST *error_messages,
                                  OPTIONS *conf,
                                  const char *format, ...);
+void vmessage_list_command_warn (ERROR_MESSAGE_LIST *error_messages,
+                            const ELEMENT *e, const char *format, va_list v);
 
 extern ERROR_MESSAGE_LIST error_messages_list;
 extern SOURCE_INFO current_source_info;



reply via email to

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