mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +01:00 
			
		
		
		
	Document as 2.4 additions. (unescape_text): Implement newline and
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.
This commit is contained in:
		
				
					committed by
					
						
						Matthias Clasen
					
				
			
			
				
	
			
			
			
						parent
						
							97a7e32afa
						
					
				
				
					commit
					fce9dce6b3
				
			@@ -1,3 +1,11 @@
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,11 @@
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,11 @@
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,11 @@
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,11 @@
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,11 @@
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
@@ -335,9 +335,16 @@ unescape_text (GMarkupParseContext *context,
 | 
			
		||||
  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;
 | 
			
		||||
@@ -350,7 +357,26 @@ unescape_text (GMarkupParseContext *context,
 | 
			
		||||
        case USTATE_INSIDE_TEXT:
 | 
			
		||||
          {
 | 
			
		||||
            while (p != text_end && *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)
 | 
			
		||||
              {
 | 
			
		||||
@@ -752,6 +778,7 @@ find_current_text_end (GMarkupParseContext *context)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
add_attribute (GMarkupParseContext *context, char *name)
 | 
			
		||||
{
 | 
			
		||||
@@ -1809,6 +1836,10 @@ append_escaped_text (GString     *str,
 | 
			
		||||
 * 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*
 | 
			
		||||
@@ -1965,6 +1996,8 @@ find_conversion (const char  *format,
 | 
			
		||||
 * 
 | 
			
		||||
 * Return value: newly allocated result from formatting
 | 
			
		||||
 *  operation. Free with g_free().
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 2.4
 | 
			
		||||
 **/
 | 
			
		||||
char *
 | 
			
		||||
g_markup_vprintf_escaped (const char *format,
 | 
			
		||||
@@ -2103,7 +2136,7 @@ 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;
 | 
			
		||||
 *  
 | 
			
		||||
@@ -2116,6 +2149,8 @@ g_markup_vprintf_escaped (const char *format,
 | 
			
		||||
 * 
 | 
			
		||||
 * Return value: newly allocated result from formatting
 | 
			
		||||
 *  operation. Free with g_free().
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 2.4
 | 
			
		||||
 **/
 | 
			
		||||
char *
 | 
			
		||||
g_markup_printf_escaped (const char *format, ...)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user