+Wed Oct 8 23:40:26 2003 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gmarkup.c (g_markup_printf_escaped):
+ (g_markup_vprintf_escaped): Document as 2.4 additions.
+ (unescape_text): Implement newline and whitespace normalization
+ according to the XML specification. (#123919)
+ (g_markup_escape_text): Document whitespace (non)handling.
+
2003-10-05 Matthias Clasen <maclas@gmx.de>
* configure.in: Make the various printf feature test macros
+Wed Oct 8 23:40:26 2003 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gmarkup.c (g_markup_printf_escaped):
+ (g_markup_vprintf_escaped): Document as 2.4 additions.
+ (unescape_text): Implement newline and whitespace normalization
+ according to the XML specification. (#123919)
+ (g_markup_escape_text): Document whitespace (non)handling.
+
2003-10-05 Matthias Clasen <maclas@gmx.de>
* configure.in: Make the various printf feature test macros
+Wed Oct 8 23:40:26 2003 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gmarkup.c (g_markup_printf_escaped):
+ (g_markup_vprintf_escaped): Document as 2.4 additions.
+ (unescape_text): Implement newline and whitespace normalization
+ according to the XML specification. (#123919)
+ (g_markup_escape_text): Document whitespace (non)handling.
+
2003-10-05 Matthias Clasen <maclas@gmx.de>
* configure.in: Make the various printf feature test macros
+Wed Oct 8 23:40:26 2003 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gmarkup.c (g_markup_printf_escaped):
+ (g_markup_vprintf_escaped): Document as 2.4 additions.
+ (unescape_text): Implement newline and whitespace normalization
+ according to the XML specification. (#123919)
+ (g_markup_escape_text): Document whitespace (non)handling.
+
2003-10-05 Matthias Clasen <maclas@gmx.de>
* configure.in: Make the various printf feature test macros
+Wed Oct 8 23:40:26 2003 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gmarkup.c (g_markup_printf_escaped):
+ (g_markup_vprintf_escaped): Document as 2.4 additions.
+ (unescape_text): Implement newline and whitespace normalization
+ according to the XML specification. (#123919)
+ (g_markup_escape_text): Document whitespace (non)handling.
+
2003-10-05 Matthias Clasen <maclas@gmx.de>
* configure.in: Make the various printf feature test macros
+Wed Oct 8 23:40:26 2003 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gmarkup.c (g_markup_printf_escaped):
+ (g_markup_vprintf_escaped): Document as 2.4 additions.
+ (unescape_text): Implement newline and whitespace normalization
+ according to the XML specification. (#123919)
+ (g_markup_escape_text): Document whitespace (non)handling.
+
2003-10-05 Matthias Clasen <maclas@gmx.de>
* configure.in: Make the various printf feature test macros
const gchar *p;
UnescapeState state;
const gchar *start;
+ gboolean normalize_attribute;
str = g_string_new (NULL);
+ if (context->state == STATE_INSIDE_ATTRIBUTE_VALUE_SQ ||
+ context->state == STATE_INSIDE_ATTRIBUTE_VALUE_DQ)
+ normalize_attribute = TRUE;
+ else
+ normalize_attribute = FALSE;
+
state = USTATE_INSIDE_TEXT;
p = text;
start = p;
case USTATE_INSIDE_TEXT:
{
while (p != text_end && *p != '&')
- p = g_utf8_next_char (p);
+ {
+ if ((*p == '\t' || *p == '\n') && normalize_attribute)
+ {
+ g_string_append_len (str, start, p - start);
+ g_string_append_c (str, ' ');
+ p = g_utf8_next_char (p);
+ start = p;
+ }
+ else if (*p == '\r')
+ {
+ g_string_append_len (str, start, p - start);
+ g_string_append_c (str, normalize_attribute ? ' ' : '\n');
+ p = g_utf8_next_char (p);
+ if (*p == '\n')
+ p = g_utf8_next_char (p);
+ start = p;
+ }
+ else
+ p = g_utf8_next_char (p);
+ }
if (p != start)
{
}
}
+
static void
add_attribute (GMarkupParseContext *context, char *name)
{
* corresponding entities. This function would typically be used
* when writing out a file to be parsed with the markup parser.
*
+ * Note that this function doesn't protect whitespace and line endings
+ * from being processed according to the XML rules for normalization
+ * of line endings and attribute values.
+ *
* Return value: escaped text
**/
gchar*
*
* Return value: newly allocated result from formatting
* operation. Free with g_free().
+ *
+ * Since: 2.4
**/
char *
g_markup_vprintf_escaped (const char *format,
* might themselves contain markup.
*
* <informalexample><programlisting>
- * const char *store = "Fortnum & Mason";
+ * const char *store = "Fortnum & Mason";
* const char *item = "Tea";
* char *output;
*
*
* Return value: newly allocated result from formatting
* operation. Free with g_free().
+ *
+ * Since: 2.4
**/
char *
g_markup_printf_escaped (const char *format, ...)