Tests for handling of whitespace inside tags.

2004-07-28  Matthias Clasen  <mclasen@redhat.com>

	* tests/markups/valid-{9,10,11}.gmarkup:
	* tests/markups/fail-{37,38,39}.gmarkup: Tests for handling
	of whitespace inside tags.

	* glib/gmarkup.c (enum GMarkupParseState): Add
	STATE_AFTER_ATTRIBUTE_NAME and STATE_AFTER_CLOSE_TAG_NAME.
	(g_markup_parse_context_parse): Accept whitespace between
	attribute names, '=' and attribute values and between
	close tag name and '>'. (#148646, Hiroyuki Ikezoe)
This commit is contained in:
Matthias Clasen 2004-07-28 15:00:59 +00:00 committed by Matthias Clasen
parent 45e1212b68
commit 889096b1ea
12 changed files with 198 additions and 115 deletions

View File

@ -1,3 +1,15 @@
2004-07-28 Matthias Clasen <mclasen@redhat.com>
* tests/markups/valid-{9,10,11}.gmarkup:
* tests/markups/fail-{37,38,39}.gmarkup: Tests for handling
of whitespace inside tags.
* glib/gmarkup.c (enum GMarkupParseState): Add
STATE_AFTER_ATTRIBUTE_NAME and STATE_AFTER_CLOSE_TAG_NAME.
(g_markup_parse_context_parse): Accept whitespace between
attribute names, '=' and attribute values and between
close tag name and '>'. (#148646, Hiroyuki Ikezoe)
Tue Jul 27 02:01:31 2004 Matthias Clasen <maclas@gmx.de>
* glib/gstrfuncs.c (g_strsplit_set): s/g_strsplit/g_strsplit_set/

View File

@ -1,3 +1,15 @@
2004-07-28 Matthias Clasen <mclasen@redhat.com>
* tests/markups/valid-{9,10,11}.gmarkup:
* tests/markups/fail-{37,38,39}.gmarkup: Tests for handling
of whitespace inside tags.
* glib/gmarkup.c (enum GMarkupParseState): Add
STATE_AFTER_ATTRIBUTE_NAME and STATE_AFTER_CLOSE_TAG_NAME.
(g_markup_parse_context_parse): Accept whitespace between
attribute names, '=' and attribute values and between
close tag name and '>'. (#148646, Hiroyuki Ikezoe)
Tue Jul 27 02:01:31 2004 Matthias Clasen <maclas@gmx.de>
* glib/gstrfuncs.c (g_strsplit_set): s/g_strsplit/g_strsplit_set/

View File

@ -1,3 +1,15 @@
2004-07-28 Matthias Clasen <mclasen@redhat.com>
* tests/markups/valid-{9,10,11}.gmarkup:
* tests/markups/fail-{37,38,39}.gmarkup: Tests for handling
of whitespace inside tags.
* glib/gmarkup.c (enum GMarkupParseState): Add
STATE_AFTER_ATTRIBUTE_NAME and STATE_AFTER_CLOSE_TAG_NAME.
(g_markup_parse_context_parse): Accept whitespace between
attribute names, '=' and attribute values and between
close tag name and '>'. (#148646, Hiroyuki Ikezoe)
Tue Jul 27 02:01:31 2004 Matthias Clasen <maclas@gmx.de>
* glib/gstrfuncs.c (g_strsplit_set): s/g_strsplit/g_strsplit_set/

View File

@ -1,3 +1,15 @@
2004-07-28 Matthias Clasen <mclasen@redhat.com>
* tests/markups/valid-{9,10,11}.gmarkup:
* tests/markups/fail-{37,38,39}.gmarkup: Tests for handling
of whitespace inside tags.
* glib/gmarkup.c (enum GMarkupParseState): Add
STATE_AFTER_ATTRIBUTE_NAME and STATE_AFTER_CLOSE_TAG_NAME.
(g_markup_parse_context_parse): Accept whitespace between
attribute names, '=' and attribute values and between
close tag name and '>'. (#148646, Hiroyuki Ikezoe)
Tue Jul 27 02:01:31 2004 Matthias Clasen <maclas@gmx.de>
* glib/gstrfuncs.c (g_strsplit_set): s/g_strsplit/g_strsplit_set/

View File

@ -1,3 +1,15 @@
2004-07-28 Matthias Clasen <mclasen@redhat.com>
* tests/markups/valid-{9,10,11}.gmarkup:
* tests/markups/fail-{37,38,39}.gmarkup: Tests for handling
of whitespace inside tags.
* glib/gmarkup.c (enum GMarkupParseState): Add
STATE_AFTER_ATTRIBUTE_NAME and STATE_AFTER_CLOSE_TAG_NAME.
(g_markup_parse_context_parse): Accept whitespace between
attribute names, '=' and attribute values and between
close tag name and '>'. (#148646, Hiroyuki Ikezoe)
Tue Jul 27 02:01:31 2004 Matthias Clasen <maclas@gmx.de>
* glib/gstrfuncs.c (g_strsplit_set): s/g_strsplit/g_strsplit_set/

View File

@ -49,6 +49,7 @@ typedef enum
STATE_AFTER_ELISION_SLASH, /* the slash that obviates need for end element */
STATE_INSIDE_OPEN_TAG_NAME,
STATE_INSIDE_ATTRIBUTE_NAME,
STATE_AFTER_ATTRIBUTE_NAME,
STATE_BETWEEN_ATTRIBUTES,
STATE_AFTER_ATTRIBUTE_EQUALS_SIGN,
STATE_INSIDE_ATTRIBUTE_VALUE_SQ,
@ -56,6 +57,7 @@ typedef enum
STATE_INSIDE_TEXT,
STATE_AFTER_CLOSE_TAG_SLASH,
STATE_INSIDE_CLOSE_TAG_NAME,
STATE_AFTER_CLOSE_TAG_NAME,
STATE_INSIDE_PASSTHROUGH,
STATE_ERROR
} GMarkupParseState;
@ -1136,28 +1138,29 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
break;
case STATE_INSIDE_ATTRIBUTE_NAME:
/* Possible next states: AFTER_ATTRIBUTE_EQUALS_SIGN */
/* Possible next states: AFTER_ATTRIBUTE_NAME */
advance_to_name_end (context);
add_to_partial (context, context->start, context->iter);
/* read the full name, if we enter the equals sign state
* then add the attribute to the list (without the value),
* otherwise store a partial chunk to be prepended later.
*/
advance_to_name_end (context);
if (context->iter != context->current_text_end)
context->state = STATE_AFTER_ATTRIBUTE_NAME;
break;
if (context->iter == context->current_text_end)
{
/* The name hasn't necessarily ended. Merge with
* partial chunk, leave state unchanged.
*/
add_to_partial (context, context->start, context->iter);
}
else
case STATE_AFTER_ATTRIBUTE_NAME:
/* Possible next states: AFTER_ATTRIBUTE_EQUALS_SIGN */
skip_spaces (context);
if (context->iter != context->current_text_end)
{
/* The name has ended. Combine it with the partial chunk
* if any; push it on the stack; enter next state.
*/
add_to_partial (context, context->start, context->iter);
add_attribute (context, g_string_free (context->partial_chunk, FALSE));
context->partial_chunk = NULL;
@ -1280,6 +1283,11 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
case STATE_AFTER_ATTRIBUTE_EQUALS_SIGN:
/* Possible next state: INSIDE_ATTRIBUTE_VALUE_[SQ/DQ] */
skip_spaces (context);
if (context->iter != context->current_text_end)
{
if (*context->iter == '"')
{
advance_char (context);
@ -1305,6 +1313,7 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
current_attribute (context),
current_element (context));
}
}
break;
case STATE_INSIDE_ATTRIBUTE_VALUE_SQ:
@ -1447,26 +1456,27 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
break;
case STATE_INSIDE_CLOSE_TAG_NAME:
/* Possible next state: AFTER_CLOSE_ANGLE */
/* Possible next state: AFTER_CLOSE_TAG_NAME */
advance_to_name_end (context);
if (context->iter == context->current_text_end)
{
/* The name hasn't necessarily ended. Merge with
* partial chunk, leave state unchanged.
*/
add_to_partial (context, context->start, context->iter);
}
else
if (context->iter != context->current_text_end)
context->state = STATE_AFTER_CLOSE_TAG_NAME;
break;
case STATE_AFTER_CLOSE_TAG_NAME:
/* Possible next state: AFTER_CLOSE_TAG_SLASH */
skip_spaces (context);
if (context->iter != context->current_text_end)
{
gchar *close_name;
/* The name has ended. Combine it with the partial chunk
* if any; check that it matches stack top and pop
* stack; invoke proper callback; enter next state.
*/
gchar *close_name;
add_to_partial (context, context->start, context->iter);
close_name = g_string_free (context->partial_chunk, FALSE);
context->partial_chunk = NULL;

View File

@ -0,0 +1 @@
< foo>

View File

@ -0,0 +1 @@
<foo>data< /foo>

View File

@ -0,0 +1 @@
<foo>data</ foo>

View File

@ -0,0 +1,6 @@
<foo
bar="baz"
bar2 = "baz2"
bar3 =
"baz3"
>data</foo>

View File

@ -0,0 +1,2 @@
<foo
>data</foo>

View File

@ -0,0 +1,2 @@
<foo>data</foo
>