texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (TYPE_INTE


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (TYPE_INTERNAL_CONVERSION) (types_internal_conversion_table, convert_table_term_type) (html_converter_initialize), tp/Texinfo/XS/main/converter_types.h (enum formatting_reference_status): add types_internal_conversion_table where type conversion implemented in C is registered, use it to replace type_conversion function. Implement convert_table_term_type as a type conversion function.
Date: Wed, 15 Nov 2023 14:31:37 -0500

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 661f09a498 * tp/Texinfo/XS/convert/convert_html.c 
(TYPE_INTERNAL_CONVERSION) (types_internal_conversion_table, 
convert_table_term_type) (html_converter_initialize), 
tp/Texinfo/XS/main/converter_types.h (enum formatting_reference_status): add 
types_internal_conversion_table where type conversion implemented in C is 
registered, use it to replace type_conversion function. Implement 
convert_table_term_type as a type conversion function.
661f09a498 is described below

commit 661f09a498fd16069f9a8d81b6e6e7dfe7077756
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Nov 15 20:31:28 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (TYPE_INTERNAL_CONVERSION)
    (types_internal_conversion_table, convert_table_term_type)
    (html_converter_initialize), tp/Texinfo/XS/main/converter_types.h
    (enum formatting_reference_status): add
    types_internal_conversion_table where type conversion implemented in C
    is registered, use it to replace type_conversion function.
    Implement convert_table_term_type as a type conversion function.
    
    * tp/Texinfo/XS/convert/convert_html.c (in_code, in_math, in_raw)
    (in_upper_case, in_verbatim): add.
---
 ChangeLog                            | 13 ++++++
 tp/Texinfo/XS/convert/convert_html.c | 82 ++++++++++++++++++++++++++++++++++++
 tp/Texinfo/XS/main/converter_types.h |  2 +
 3 files changed, 97 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 3312c45b47..0b99b6549a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-11-15  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (TYPE_INTERNAL_CONVERSION)
+       (types_internal_conversion_table, convert_table_term_type)
+       (html_converter_initialize), tp/Texinfo/XS/main/converter_types.h
+       (enum formatting_reference_status): add
+       types_internal_conversion_table where type conversion implemented in C
+       is registered, use it to replace type_conversion function.
+       Implement convert_table_term_type as a type conversion function.
+
+       * tp/Texinfo/XS/convert/convert_html.c (in_code, in_math, in_raw)
+       (in_upper_case, in_verbatim): add.
+
 2023-11-15  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/utils.h, tp/Texinfo/XS/main/converter_types.h
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 4a449ac190..b9a6b92a6f 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -55,6 +55,11 @@ typedef struct CMD_VARIETY {
     char *variety;
 } CMD_VARIETY;
 
+typedef struct TYPE_INTERNAL_CONVERSION {
+    enum element_type type;
+    char * (* type_conversion) (CONVERTER *self, enum element_type type, const 
ELEMENT *element, char *content);
+} TYPE_INTERNAL_CONVERSION;
+
 char *html_global_unit_direction_names[] = {
   #define hgdt_name(name) #name,
    HTML_GLOBAL_DIRECTIONS_LIST
@@ -449,6 +454,45 @@ html_pgdt_tree (const char *translation_context, const 
char *string,
                         translation_context, in_lang);
 }
 
+int in_code (CONVERTER *self)
+{
+  HTML_DOCUMENT_CONTEXT *top_document_ctx;
+  top_document_ctx = html_top_document_context (self);
+  return top_monospace_context (&top_document_ctx->monospace);
+}
+
+int in_math (CONVERTER *self)
+{
+  HTML_DOCUMENT_CONTEXT *top_document_ctx;
+  top_document_ctx = html_top_document_context (self);
+  return top_document_ctx->math_ctx;
+}
+
+int
+in_raw (CONVERTER *self)
+{
+  HTML_DOCUMENT_CONTEXT *top_document_ctx;
+  top_document_ctx = html_top_document_context (self);
+  return top_document_ctx->raw_ctx;
+}
+
+int in_upper_case (CONVERTER *self)
+{
+  HTML_DOCUMENT_CONTEXT *top_document_ctx;
+  HTML_FORMATTING_CONTEXT *top_formating_ctx;
+  top_document_ctx = html_top_document_context (self);
+  top_formating_ctx
+    = html_top_formatting_context (&top_document_ctx->formatting_context);
+  return top_formating_ctx->upper_case_ctx;
+}
+
+int
+in_verbatim (CONVERTER *self)
+{
+  HTML_DOCUMENT_CONTEXT *top_document_ctx;
+  top_document_ctx = html_top_document_context (self);
+  return top_document_ctx->verbatim_ctx;
+}
 
 ELEMENT *
 special_unit_info_tree (CONVERTER *self, enum special_unit_info_tree type,
@@ -2405,6 +2449,29 @@ protect_text_no_iso_entities (const char *text, TEXT 
*result)
 }
 #undef ADDN
 
+char *
+convert_table_term_type (CONVERTER *self, enum element_type type,
+                        const ELEMENT *element, char *content)
+{
+  TEXT result;
+
+  text_init (&result);
+  text_append (&result, "");
+
+  if (content)
+    {
+      text_append (&result, "<dt>");
+      text_append (&result, content);
+    }
+  return result.text;
+}
+
+/* associate type to the C function implementing the conversion */
+static TYPE_INTERNAL_CONVERSION types_internal_conversion_table[] = {
+  {ET_table_term, &convert_table_term_type},
+  {0, 0},
+};
+
 static char *
 command_conversion_external (CONVERTER *self, enum command_id cmd,
                     const ELEMENT *element, HTML_ARGS_FORMATTED 
*args_formatted,
@@ -2759,6 +2826,21 @@ html_converter_initialize (CONVERTER *self)
              &self->css_string_types_conversion[i]);
     }
 
+  for (i = 0; types_internal_conversion_table[i].type_conversion; i++)
+    {
+      enum element_type type = types_internal_conversion_table[i].type;
+      TYPE_CONVERSION_FUNCTION *type_conversion
+         = self->type_conversion_function[type];
+      if (type_conversion
+          && type_conversion->status == FRS_status_default_set)
+        {
+          type_conversion->formatting_reference = 0;
+          type_conversion->status = FRS_status_internal;
+          type_conversion->type_conversion
+              = types_internal_conversion_table[i].type_conversion;
+        }
+    }
+
   for (i = 0; i < BUILTIN_CMD_NUMBER; i++)
     {
       self->command_conversion_function[i]
diff --git a/tp/Texinfo/XS/main/converter_types.h 
b/tp/Texinfo/XS/main/converter_types.h
index 3657e2c115..66319edab5 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -31,6 +31,8 @@ enum formatting_reference_status {
                                      customization is the same as default) */
    FRS_status_customization_set,  /* customization is set, no default, or
                                      not the same as default */
+   FRS_status_internal,           /* formatting reference is not used, code in 
C
+                                     does the task */
    FRS_status_ignored,            /* explicitely ignored. Only used for
                                      types_conversion and commands_conversion
                                    */



reply via email to

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