[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/command_stack.c (top_integer
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/command_stack.c (top_integer_stack): use correct function name instead of top_integer_context. |
Date: |
Fri, 17 Nov 2023 05:35:47 -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 57ac23a217 * tp/Texinfo/XS/main/command_stack.c (top_integer_stack):
use correct function name instead of top_integer_context.
57ac23a217 is described below
commit 57ac23a217e48695096791fcaf70b0a90cdcfd3d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Nov 17 11:35:37 2023 +0100
* tp/Texinfo/XS/main/command_stack.c (top_integer_stack): use correct
function name instead of top_integer_context.
* tp/Texinfo/XS/main/get_perl_info.c (converter_initialize)
(set_output_converter_sv): set conf already in converter_initialize.
* tp/Texinfo/XS/main/unicode.h (OTXI_UNICODE_TEXT_CASES): always
increase var after appending. Use a constant "-".
* tp/Texinfo/XS/convert/convert_html.c (special_characters_formatting)
(in_non_breakable_space, in_space_protected)
(OTXI_ISO_ENTITY_TEXT_CASES, OTXI_NO_ISO_ENTITY_TEXT_CASES)
(OTXI_NO_BREAK_CASES, OTXI_SPACE_PROTECTION_CASES, OTXI_CONVERT_TEXT)
(OTXI_ALL_CONVERT_TEXT, html_default_format_protect_text)
(convert_text, html_converter_initialize)
(types_internal_conversion_table), tp/Texinfo/XS/convert/converter.c
(xml_format_text_with_numeric_entities),
tp/Texinfo/XS/convert/converter.h (OTXI_NUMERIC_ENTITY_TEXT_CASES),
tp/Texinfo/XS/main/converter_types.h (enum html_special_character)
(STRING_WITH_LEN, CONVERTER): use macros to generate inline code for
text conversion, remove protect_text_unicode_text,
protect_text_use_iso_entities and protect_text_no_iso_entities. Setup
special characters and line_break_element.
---
ChangeLog | 26 +++
tp/Texinfo/XS/convert/ConvertXS.xs | 4 +-
tp/Texinfo/XS/convert/convert_html.c | 415 ++++++++++++++++++++++-------------
tp/Texinfo/XS/convert/converter.c | 45 +---
tp/Texinfo/XS/convert/converter.h | 44 ++++
tp/Texinfo/XS/main/command_stack.c | 2 +-
tp/Texinfo/XS/main/converter_types.h | 15 ++
tp/Texinfo/XS/main/get_perl_info.c | 20 +-
tp/Texinfo/XS/main/unicode.h | 16 +-
tp/t/html_tests.t | 3 +-
10 files changed, 380 insertions(+), 210 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 261b3cb0ee..4853c50d89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2023-11-17 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/command_stack.c (top_integer_stack): use correct
+ function name instead of top_integer_context.
+
+ * tp/Texinfo/XS/main/get_perl_info.c (converter_initialize)
+ (set_output_converter_sv): set conf already in converter_initialize.
+
+ * tp/Texinfo/XS/main/unicode.h (OTXI_UNICODE_TEXT_CASES): always
+ increase var after appending. Use a constant "-".
+
+ * tp/Texinfo/XS/convert/convert_html.c (special_characters_formatting)
+ (in_non_breakable_space, in_space_protected)
+ (OTXI_ISO_ENTITY_TEXT_CASES, OTXI_NO_ISO_ENTITY_TEXT_CASES)
+ (OTXI_NO_BREAK_CASES, OTXI_SPACE_PROTECTION_CASES, OTXI_CONVERT_TEXT)
+ (OTXI_ALL_CONVERT_TEXT, html_default_format_protect_text)
+ (convert_text, html_converter_initialize)
+ (types_internal_conversion_table), tp/Texinfo/XS/convert/converter.c
+ (xml_format_text_with_numeric_entities),
+ tp/Texinfo/XS/convert/converter.h (OTXI_NUMERIC_ENTITY_TEXT_CASES),
+ tp/Texinfo/XS/main/converter_types.h (enum html_special_character)
+ (STRING_WITH_LEN, CONVERTER): use macros to generate inline code for
+ text conversion, remove protect_text_unicode_text,
+ protect_text_use_iso_entities and protect_text_no_iso_entities. Setup
+ special characters and line_break_element.
+
2023-11-16 Patrice Dumas <pertusus@free.fr>
* tp/t/input_files/punctuation_small_case_accents_latin1.texi,
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index ed8323f0e2..d7e2e41f06 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -245,6 +245,7 @@ html_new_document_context (SV *converter_in, char
*context_name, ...)
/* reset to ignore the HMSF_formatting_context flag just set */
self->modified_state = 0;
document_context = html_top_document_context (self);
+
document_context_hv = build_html_document_context
(document_context);
av_push (document_context_av,
@@ -276,6 +277,7 @@ html_pop_document_context (SV *converter_in)
}
*/
html_pop_document_context (self);
+
av_pop (document_context_av);
hv_store (converter_hv, "document_global_context",
strlen ("document_global_context"),
@@ -322,7 +324,7 @@ html_prepare_conversion_units (SV *converter_in, ...)
if (self->conf->OUTPUT_CHARACTERS > 0
&& self->conf->OUTPUT_ENCODING_NAME
/* not sure if strcasecmp is needed or not */
- && !strcasecmp (self->conf->OUTPUT_ENCODING_NAME, "utf8"))
+ && !strcasecmp (self->conf->OUTPUT_ENCODING_NAME, "utf-8"))
self->use_unicode_text = 1;
html_prepare_conversion_units (self,
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index a76d55756d..98c8fe654f 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -139,6 +139,15 @@ typedef struct HTML_COMMAND_STRUCT {
static HTML_COMMAND_STRUCT html_commands_data[BUILTIN_CMD_NUMBER];
+/* should correspond to enum html_special_character */
+char *special_characters_formatting[SC_non_breaking_space+1][4] = {
+ {"¶", "\xC2\xB6", "00B6", "&#" "00B6" ";"},
+ {"‘", "\xE2\x80\x98", "2018", "&#" "2018" ";"},
+ {"’", "\xE2\x80\x99", "2019", "&#" "2019" ";"},
+ {"•", "\xE2\x80\xA2", "2022", "&#" "2022" ";"},
+ {" ", "\xC2\xA0", "00A0", "&#" "00A0" ";"},
+};
+
/* in specification of args. Number max +1 for a trailing 0 */
#define MAX_COMMAND_ARGS_NR 6
@@ -490,6 +499,17 @@ inside_preformatted (CONVERTER *self)
return top_document_ctx->inside_preformatted;
}
+int
+in_non_breakable_space (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->no_break;
+}
+
int
in_raw (CONVERTER *self)
{
@@ -498,6 +518,17 @@ in_raw (CONVERTER *self)
return top_document_ctx->raw_ctx;
}
+int
+in_space_protected (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->space_protected;
+}
+
int in_upper_case (CONVERTER *self)
{
HTML_DOCUMENT_CONTEXT *top_document_ctx;
@@ -2294,27 +2325,6 @@ html_prepare_units_directions_files (CONVERTER *self,
text_append_n (result, "", 5); var++; \
break;
-void
-html_default_format_protect_text (const char *text, TEXT *result)
-{
- const char *p = text;
-
- while (*p)
- {
- int before_sep_nr = strcspn (p, "<>&\"\f");
- if (before_sep_nr)
- {
- text_append_n (result, p, before_sep_nr);
- p += before_sep_nr;
- }
- if (!*p)
- break;
- switch (*p)
- {
- OTXI_PROTECT_XML_FORM_FEED_CASES(p)
- }
- }
-}
#define ADDN(str,nr) text_append_n (result, str, nr)
@@ -2346,154 +2356,217 @@ default_css_string_format_protect_text (const char
*text, TEXT *result)
}
}
-void
-protect_text_use_iso_entities (const char *text, TEXT *result)
-{
- const char *p = text;
+#define OTXI_ISO_ENTITY_TEXT_CASES(var) \
+ case '-': \
+ if (*(var+1) && !memcmp (var, "---", 3)) \
+ { \
+ text_append_n (result, "—", 7); \
+ var += 3; \
+ } \
+ else if (!memcmp (var, "--", 2)) \
+ { \
+ text_append_n (result, "–", 7); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, "-", 1); \
+ var++; \
+ } \
+ break; \
+ case '`': \
+ if (!memcmp (var, "``", 2)) \
+ { \
+ text_append_n (result, "“", 7); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, "‘", 7); \
+ var++; \
+ } \
+ break; \
+ case '\'': \
+ if (!memcmp (var, "''", 2)) \
+ { \
+ text_append_n (result, "”", 7); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, "’", 7); \
+ var++; \
+ } \
+ break;
- while (*p)
- {
- int before_sep_nr = strcspn (p, "<>&\"\f" "-`'");
- if (before_sep_nr)
- {
- text_append_n (result, p, before_sep_nr);
- p += before_sep_nr;
- }
- if (!*p)
- break;
- switch (*p)
- {
- OTXI_PROTECT_XML_FORM_FEED_CASES(p)
- case '-':
- if (*(p+1) && !memcmp (p, "---", 3))
- {
- ADDN("—", 7);
- p += 3;
- }
- else if (!memcmp (p, "--", 2))
- {
- ADDN("–", 7);
- p += 2;
- }
- else
- {
- ADDN("-", 1);
- p++;
- }
+#define OTXI_NO_ISO_ENTITY_TEXT_CASES(var) \
+ case '-': \
+ if (*(var+1) && !memcmp (var, "---", 3)) \
+ { \
+ text_append_n (result, "--", 2); \
+ var += 3; \
+ } \
+ else \
+ { \
+ text_append_n (result, "-", 1); \
+ if (!memcmp (var, "--", 2)) \
+ var += 2; \
+ else \
+ var++; \
+ } \
+ break; \
+ case '`': \
+ if (!memcmp (var, "``", 2)) \
+ { \
+ text_append_n (result, """, 6); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, var, 1); \
+ var++; \
+ } \
+ break; \
+ case '\'': \
+ if (!memcmp (var, "''", 2)) \
+ { \
+ text_append_n (result, """, 6); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, var, 1); \
+ var++; \
+ } \
break;
- case '`':
- if (!memcmp (p, "``", 2))
- {
- ADDN("“", 7);
- p += 2;
- }
- else
- {
- ADDN("‘", 7);
- p++;
- }
+
+#define OTXI_NO_BREAK_CASES(var) \
+ case ' ': \
+ case '\n': \
+ text_append_n (result, \
+ self->special_character[SC_non_breaking_space].string, \
+ self->special_character[SC_non_breaking_space].len); \
+ var += strspn (var, "\n "); \
break;
- case '\'':
- if (!memcmp (p, "''", 2))
- {
- ADDN("”", 7);
- p += 2;
- }
- else
- {
- ADDN("’", 7);
- p++;
- }
+
+#define OTXI_SPACE_PROTECTION_CASES(var) \
+ case ' ': \
+ text_append_n (result, \
+ self->special_character[SC_non_breaking_space].string, \
+ self->special_character[SC_non_breaking_space].len); \
+ var++; \
+ break; \
+ case '\n': \
+ text_append_n (result, self->line_break_element.string, \
+ self->line_break_element.len); \
+ var++; \
break;
- }
- }
-}
+
+/* text conversion loop, with the protection of XML special
+ characters and the possibility to add more delimiters and
+ more cases to handle those delimiters */
+#define OTXI_CONVERT_TEXT(delimiters,other_cases) \
+ { \
+ while (*p) \
+ { \
+ int before_sep_nr = strcspn (p, "<>&\"\f" delimiters); \
+ if (before_sep_nr) \
+ { \
+ text_append_n (result, p, before_sep_nr); \
+ p += before_sep_nr; \
+ } \
+ if (!*p) \
+ break; \
+ switch (*p) \
+ { \
+ OTXI_PROTECT_XML_FORM_FEED_CASES(p) \
+ other_cases \
+ } \
+ } \
+ }
+
+/* conversion of text for all the possibilities regarding -- --- ''
+ conversion, with the possibility to add more for spaces protection */
+#define OTXI_ALL_CONVERT_TEXT(additional_delim,other_cases) \
+ const char *p = content_used; \
+ if (in_code (self) || in_math (self)) \
+ OTXI_CONVERT_TEXT(additional_delim, \
+ other_cases) \
+ else if (self->use_unicode_text) \
+ OTXI_CONVERT_TEXT("-`'" additional_delim, \
+ OTXI_UNICODE_TEXT_CASES(p) \
+ other_cases) \
+ else if (self->conf->USE_NUMERIC_ENTITY > 0) \
+ OTXI_CONVERT_TEXT("-`'" additional_delim, \
+ OTXI_NUMERIC_ENTITY_TEXT_CASES(p) \
+ other_cases) \
+ else if (self->conf->USE_ISO > 0) \
+ OTXI_CONVERT_TEXT("-`'" additional_delim, \
+ OTXI_ISO_ENTITY_TEXT_CASES(p) \
+ other_cases) \
+ else \
+ OTXI_CONVERT_TEXT("-`'" additional_delim, \
+ OTXI_NO_ISO_ENTITY_TEXT_CASES(p) \
+ other_cases)
void
-protect_text_no_iso_entities (const char *text, TEXT *result)
+html_default_format_protect_text (const char *text, TEXT *result)
{
const char *p = text;
- while (*p)
- {
- int before_sep_nr = strcspn (p, "<>&\"\f" "-`'");
- if (before_sep_nr)
- {
- text_append_n (result, p, before_sep_nr);
- p += before_sep_nr;
- }
- if (!*p)
- break;
- switch (*p)
- {
- OTXI_PROTECT_XML_FORM_FEED_CASES(p)
- case '-':
- if (*(p+1) && !memcmp (p, "---", 3))
- {
- ADDN("--", 2);
- p += 3;
- }
- else
- {
- if (!memcmp (p, "--", 2))
- p += 2;
- else
- p++;
- ADDN("-", 1);
- }
- break;
- case '`':
- if (!memcmp (p, "``", 2))
- {
- ADDN(""", 6);
- p += 2;
- }
- else
- {
- ADDN(p, 1);
- p++;
- }
- break;
- case '\'':
- if (!memcmp (p, "''", 2))
- {
- ADDN(""", 6);
- p += 2;
- }
- else
- {
- ADDN(p, 1);
- p++;
- }
- break;
- }
- }
+ OTXI_CONVERT_TEXT ( , )
}
-#undef ADDN
void
-protect_text_unicode_text (const char *text, TEXT *result)
+convert_text (CONVERTER *self, const enum element_type type,
+ const ELEMENT *element, const char *content,
+ TEXT *result)
{
- const char *p = text;
+ char *content_used;
+ int contents_used_to_be_freed = 0;
- while (*p)
+ if (in_verbatim (self))
{
- int before_sep_nr = strcspn (p, "<>&\"\f" "-`'");
- if (before_sep_nr)
- {
- text_append_n (result, p, before_sep_nr);
- p += before_sep_nr;
- }
- if (!*p)
- break;
- switch (*p)
- {
- OTXI_PROTECT_XML_FORM_FEED_CASES(p)
- OTXI_UNICODE_TEXT_CASES(p)
- }
+ html_default_format_protect_text (content, result);
+ return;
+ }
+ else if (in_raw (self))
+ {
+ text_append (result, content);
+ return;
}
+
+ if (in_upper_case (self))
+ {
+ content_used = to_upper_or_lower_multibyte (content, 1);
+ contents_used_to_be_freed = 1;
+ }
+ else
+ /* cast needed to avoid a compiler warning */
+ content_used = (char *) content;
+
+ if (in_preformatted_context (self))
+ {
+ OTXI_ALL_CONVERT_TEXT ( , )
+ }
+ else if (in_non_breakable_space (self))
+ {
+ OTXI_ALL_CONVERT_TEXT (" \n", OTXI_NO_BREAK_CASES(p))
+ }
+ else if (in_space_protected (self))
+ {
+ OTXI_ALL_CONVERT_TEXT (" \n", OTXI_SPACE_PROTECTION_CASES(p))
+ }
+ else
+ {
+ OTXI_ALL_CONVERT_TEXT ( , )
+ }
+
+ if (contents_used_to_be_freed)
+ free (content_used);
}
+
void
convert_table_term_type (CONVERTER *self, const enum element_type type,
const ELEMENT *element, const char *content,
@@ -2509,10 +2582,11 @@ convert_table_term_type (CONVERTER *self, const enum
element_type type,
/* associate type to the C function implementing the conversion */
static TYPE_INTERNAL_CONVERSION types_internal_conversion_table[] = {
{ET_table_term, &convert_table_term_type},
+ {ET_text, &convert_text},
{0, 0},
};
-void
+static void
command_conversion_external (CONVERTER *self, const enum command_id cmd,
const ELEMENT *element,
const HTML_ARGS_FORMATTED *args_formatted,
@@ -2819,8 +2893,44 @@ html_converter_initialize (CONVERTER *self)
{
int i;
int nr_special_units;
+ char *output_encoding;
+ char *line_break_element;
/* initialization needing some information from perl */
+ output_encoding = self->conf->OUTPUT_ENCODING_NAME;
+
+ for (i = 0; i < SC_non_breaking_space+1; i++)
+ {
+ char *unicode_point = special_characters_formatting[i][2];
+ char *entity = special_characters_formatting[i][0];
+ char *encoded_string = special_characters_formatting[i][1];
+ char *numeric_entity = special_characters_formatting[i][3];
+ char *special_character_string;
+
+ if (self->conf->OUTPUT_CHARACTERS > 0
+ && unicode_point_decoded_in_encoding (output_encoding,
+ unicode_point))
+ special_character_string = encoded_string;
+ else if (self->conf->USE_NUMERIC_ENTITY > 0)
+ special_character_string = numeric_entity;
+ else
+ special_character_string = entity;
+
+ self->special_character[i].string = special_character_string;
+ self->special_character[i].len = strlen (special_character_string);
+ }
+
+ if (self->conf->USE_XML_SYNTAX > 0)
+ {
+ /* here in perl something for rules but we already get that from perl */
+ line_break_element = "<br/>";
+ }
+ else
+ line_break_element = "<br>";
+
+ self->line_break_element.string = line_break_element;
+ self->line_break_element.len = strlen(line_break_element);
+
nr_special_units = self->special_unit_varieties.number;
/* allocate space for translated tree types, they will be created
@@ -4286,6 +4396,7 @@ convert_output_unit (CONVERTER *self, const OUTPUT_UNIT
*output_unit,
char *explanation, TEXT *result)
{
TEXT content_formatted;
+ /* store this to be able to show only what was added in debug message */
size_t input_result_end = result->end;
enum output_unit_type unit_type = output_unit->unit_type;
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index 13d9246935..fd56d9d0b4 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -584,7 +584,6 @@ free_generic_converter (CONVERTER *self)
/* XML conversion functions */
-#define ADD(x) text_append_n (result, "&#" #x ";", 7)
void
xml_format_text_with_numeric_entities (const char *text, TEXT *result)
{
@@ -603,52 +602,10 @@ xml_format_text_with_numeric_entities (const char *text,
TEXT *result)
break;
switch (*p)
{
- case '-':
- if (*(p+1) && !memcmp (p, "---", 3))
- {
- ADD(8212);
- p += 3;
- }
- else if (!memcmp (p, "--", 2))
- {
- ADD(8211);
- p += 2;
- }
- else
- {
- text_append_n (result, "-", 1);
- p++;
- }
- break;
- case '`':
- if (!memcmp (p, "``", 2))
- {
- ADD(8220);
- p += 2;
- }
- else
- {
- ADD(8216);
- p++;
- }
- break;
- case '\'':
- if (!memcmp (p, "''", 2))
- {
- ADD(8221);
- p += 2;
- }
- else
- {
- ADD(8217);
- p++;
- }
- break;
+ OTXI_NUMERIC_ENTITY_TEXT_CASES(p)
}
}
}
-#undef ADD
-
void
diff --git a/tp/Texinfo/XS/convert/converter.h
b/tp/Texinfo/XS/convert/converter.h
index 3a39d772f3..b05ad6f7e2 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -25,6 +25,50 @@
text_append_n (result, """, 6); var++; \
break;
+#define OTXI_NUMERIC_ENTITY_TEXT_CASES(var) \
+ case '-': \
+ if (*(var+1) && !memcmp (var, "---", 3)) \
+ { \
+ text_append_n (result, "&#" "8212" ";", 7); \
+ var += 3; \
+ } \
+ else if (!memcmp (var, "--", 2)) \
+ { \
+ text_append_n (result, "&#" "8211" ";", 7); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, "-", 1); \
+ var++; \
+ } \
+ break; \
+ case '`': \
+ if (!memcmp (var, "``", 2)) \
+ { \
+ text_append_n (result, "&#" "8220" ";", 7); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, "&#" "8216" ";", 7); \
+ var++; \
+ } \
+ break; \
+ case '\'': \
+ if (!memcmp (var, "''", 2)) \
+ { \
+ text_append_n (result, "&#" "8221" ";", 7); \
+ var += 2; \
+ } \
+ else \
+ { \
+ text_append_n (result, "&#" "8217" ";", 7); \
+ var++; \
+ } \
+ break;
+
+
CONVERTER *retrieve_converter (int converter_descriptor);
size_t register_converter (CONVERTER *converter);
diff --git a/tp/Texinfo/XS/main/command_stack.c
b/tp/Texinfo/XS/main/command_stack.c
index 42a5045980..be0e2660a7 100644
--- a/tp/Texinfo/XS/main/command_stack.c
+++ b/tp/Texinfo/XS/main/command_stack.c
@@ -177,7 +177,7 @@ pop_integer_stack (INTEGER_STACK *stack)
}
int
-top_integer_context (INTEGER_STACK *stack)
+top_integer_stack (INTEGER_STACK *stack)
{
if (stack->top == 0)
fatal ("integer stack empty for top");
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index b9695c541d..875c66df5a 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -148,6 +148,14 @@ enum html_argument_formatting_type {
#undef html_aft_type
};
+enum html_special_character {
+ SC_paragraph_symbol,
+ SC_left_quote,
+ SC_right_quote,
+ SC_bullet,
+ SC_non_breaking_space,
+};
+
typedef struct {
enum command_id *stack;
size_t top; /* One above last pushed command. */
@@ -348,6 +356,11 @@ typedef struct HTML_DOCUMENT_CONTEXT_STACK {
size_t space;
} HTML_DOCUMENT_CONTEXT_STACK;
+typedef struct STRING_WITH_LEN {
+ char *string;
+ size_t len;
+} STRING_WITH_LEN;
+
typedef struct CONVERTER {
int converter_descriptor;
/* perl converter. This should be HV *hv,
@@ -381,6 +394,8 @@ typedef struct CONVERTER {
int code_types[ET_special_unit_element+1];
char *pre_class_types[ET_special_unit_element+1];
int upper_case[BUILTIN_CMD_NUMBER];
+ STRING_WITH_LEN special_character[SC_non_breaking_space+1];
+ STRING_WITH_LEN line_break_element;
FORMATTING_REFERENCE
formatting_references[FR_format_translate_message+1];
FORMATTING_REFERENCE
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index 386f3237cd..f3980329f5 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -341,6 +341,7 @@ void
converter_initialize (SV *converter_sv, CONVERTER *converter)
{
HV *hv_in;
+ SV **converter_conf_sv;
SV **converter_init_conf_sv;
DOCUMENT *document;
@@ -351,6 +352,15 @@ converter_initialize (SV *converter_sv, CONVERTER
*converter)
document = get_sv_document_document (converter_sv, 0);
converter->document = document;
+ converter_conf_sv = hv_fetch (hv_in, "conf",
+ strlen ("conf"), 0);
+
+ if (converter_conf_sv && SvOK (*converter_conf_sv))
+ {
+ converter->conf
+ = copy_sv_options (*converter_conf_sv);
+ }
+
converter_init_conf_sv
= hv_fetch (hv_in, "converter_init_conf",
strlen ("converter_init_conf"), 0);
@@ -371,7 +381,7 @@ CONVERTER *
set_output_converter_sv (SV *sv_in, char *warn_string)
{
HV *hv_in;
- SV **converter_options_sv;
+ SV **converter_conf_sv;
SV **converter_init_conf_sv;
CONVERTER *converter = 0;
@@ -380,13 +390,15 @@ set_output_converter_sv (SV *sv_in, char *warn_string)
converter = get_sv_converter (sv_in, warn_string);
hv_in = (HV *)SvRV (sv_in);
- converter_options_sv = hv_fetch (hv_in, "conf",
+ converter_conf_sv = hv_fetch (hv_in, "conf",
strlen ("conf"), 0);
- if (converter_options_sv)
+ if (converter_conf_sv)
{
+ if (converter->conf)
+ free_options (converter->conf);
converter->conf
- = copy_sv_options (*converter_options_sv);
+ = copy_sv_options (*converter_conf_sv);
}
converter_init_conf_sv = hv_fetch (hv_in, "output_init_conf",
diff --git a/tp/Texinfo/XS/main/unicode.h b/tp/Texinfo/XS/main/unicode.h
index f42e43a232..0850a4b497 100644
--- a/tp/Texinfo/XS/main/unicode.h
+++ b/tp/Texinfo/XS/main/unicode.h
@@ -23,48 +23,48 @@ typedef struct COMMAND_UNICODE {
case '-': \
if (*(var+1) && !memcmp (var, "---", 3)) \
{ \
- var += 3; \
/* Unicode em dash U+2014 (0xE2 0x80 0x94) */ \
text_append_n (result, "\xE2\x80\x94", 3); \
+ var += 3; \
} \
else if (!memcmp (var, "--", 2)) \
{ \
- var += 2; \
/* Unicode en dash U+2013 (0xE2 0x80 0x93) */ \
text_append_n (result, "\xE2\x80\x93", 3); \
+ var += 2; \
} \
else \
{ \
+ text_append_n (result, "-", 1); \
var++; \
- text_append_n (result, var, 1); \
} \
break; \
case '`': \
if (!memcmp (var, "``", 2)) \
{ \
- var += 2; \
/* U+201C E2 80 9C */ \
text_append_n (result, "\xE2\x80\x9C", 3); \
+ var += 2; \
} \
else \
{ \
- var++; \
/* U+2018 E2 80 98 */ \
text_append_n (result, "\xE2\x80\x98", 3); \
+ var++; \
} \
break; \
case '\'': \
if (!memcmp (var, "''", 2)) \
{ \
- var += 2; \
/* U+201D E2 80 9D */ \
text_append_n (result, "\xE2\x80\x9D", 3); \
+ var += 2; \
} \
else \
{ \
- var++; \
/* U+2019 E2 80 99 */ \
text_append_n (result, "\xE2\x80\x99", 3); \
+ var++; \
} \
break;
@@ -72,6 +72,8 @@ typedef struct COMMAND_UNICODE {
extern char *unicode_diacritics[];
extern COMMAND_UNICODE unicode_character_brace_no_arg_commands[];
+int unicode_point_decoded_in_encoding (char *encoding, char *codepoint);
+
char *normalize_NFC (const char *text);
char *normalize_NFKD (const char *text);
char *unicode_accent (const char *text, const ELEMENT *e);
diff --git a/tp/t/html_tests.t b/tp/t/html_tests.t
index 6881d53458..5cf5bda258 100644
--- a/tp/t/html_tests.t
+++ b/tp/t/html_tests.t
@@ -730,7 +730,8 @@ ccc}
@verb{|aaa bb
ccc|}
-', {'init_files' => ['spaces_in_line_breaks.init']},
+', {'init_files' => ['spaces_in_line_breaks.init'],
+ 'skip' => $XS_convert ? 'Direct perl data change test' : undef,},
],
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/command_stack.c (top_integer_stack): use correct function name instead of top_integer_context.,
Patrice Dumas <=