[gtkhtml] Bug #602634 - Not fully supported list types



commit d84fd7347a3e6c8c667078a95184d60e87035270
Author: Denis Pauk <pauk denis gmail com>
Date:   Thu Apr 1 16:51:11 2010 +0200

    Bug #602634 - Not fully supported list types

 gtkhtml/htmlclueflow.c |   12 ++++++++++++
 gtkhtml/htmlengine.c   |   29 ++++++++++++++++++-----------
 gtkhtml/htmlenums.h    |    5 ++++-
 3 files changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/gtkhtml/htmlclueflow.c b/gtkhtml/htmlclueflow.c
index d3972fa..3206e5d 100644
--- a/gtkhtml/htmlclueflow.c
+++ b/gtkhtml/htmlclueflow.c
@@ -1191,6 +1191,12 @@ get_item_marker_str (HTMLClueFlow *flow, gboolean ascii_only)
 	case HTML_LIST_TYPE_ORDERED_LOWER_ROMAN:
 	case HTML_LIST_TYPE_ORDERED_UPPER_ROMAN:
 		return get_roman_value (flow->item_number, flow->item_type == HTML_LIST_TYPE_ORDERED_LOWER_ROMAN);
+	case HTML_LIST_TYPE_CIRCLE:
+		return g_strdup ("\342\227\213 "); /* U+25CB WHITE CIRCLE */
+	case HTML_LIST_TYPE_DISC:
+		return g_strdup ("\342\227\217 "); /* U+25CF BLACK CIRCLE */
+	case HTML_LIST_TYPE_SQUARE:
+		return g_strdup ("\342\226\240 "); /* U+25AA BLACK SQUARE */
 	case HTML_LIST_TYPE_UNORDERED:
 		if (ascii_only)
 			return g_strdup ("* ");
@@ -1572,6 +1578,12 @@ get_start_indent_item (HTMLListType type)
 		return "BLOCKQUOTE TYPE=CITE";
 	case HTML_LIST_TYPE_BLOCKQUOTE:
 		return "BLOCKQUOTE";
+	case HTML_LIST_TYPE_CIRCLE:
+		return "OL TYPE=CIRCLE";
+	case HTML_LIST_TYPE_DISC:
+		return "OL TYPE=DISC";
+	case HTML_LIST_TYPE_SQUARE:
+		return "OL TYPE=SQUARE";
 	}
 	return "";
 }
diff --git a/gtkhtml/htmlengine.c b/gtkhtml/htmlengine.c
index 4d8d758..059dcb9 100644
--- a/gtkhtml/htmlengine.c
+++ b/gtkhtml/htmlengine.c
@@ -2868,21 +2868,28 @@ element_parse_map (HTMLEngine *e, HTMLObject *clue, const gchar *str)
 
 /* list parsers */
 static HTMLListType
-get_list_type (gchar c)
+get_list_type (const gchar* value)
 {
-	switch (c) {
-	case 'i':
+	if (!value)
+		return HTML_LIST_TYPE_ORDERED_ARABIC;
+	else if (*value == 'i')
 		return HTML_LIST_TYPE_ORDERED_LOWER_ROMAN;
-	case 'I':
+	else if (*value == 'I')
 		return HTML_LIST_TYPE_ORDERED_UPPER_ROMAN;
-	case 'a':
+	else if (*value == 'a')
 		return HTML_LIST_TYPE_ORDERED_LOWER_ALPHA;
-	case 'A':
+	else if (*value == 'A')
 		return HTML_LIST_TYPE_ORDERED_UPPER_ALPHA;
-	case '1':
-	default:
+	else if (*value == '1')
 		return HTML_LIST_TYPE_ORDERED_ARABIC;
-	}
+	else if (!g_ascii_strcasecmp (value, "circle"))
+		return HTML_LIST_TYPE_CIRCLE;
+	else if (!g_ascii_strcasecmp (value, "disc"))
+		return HTML_LIST_TYPE_DISC;
+	else if (!g_ascii_strcasecmp (value, "square"))
+		return HTML_LIST_TYPE_SQUARE;
+
+	return HTML_LIST_TYPE_ORDERED_ARABIC;
 }
 
 static void
@@ -2923,7 +2930,7 @@ element_parse_li (HTMLEngine *e, HTMLObject *clue, const gchar *str)
 		if (!g_ascii_strncasecmp (token, "value=", 6))
 			itemNumber = atoi (token + 6);
 		else if (!g_ascii_strncasecmp (token, "type=", 5))
-			listType = get_list_type (token [5]);
+			listType = get_list_type (token + 5);
 	}
 
 	if (!html_stack_is_empty (e->listStack)) {
@@ -2969,7 +2976,7 @@ element_parse_ol (HTMLEngine *e, HTMLObject *clue, const gchar *str)
 
 		token = html_string_tokenizer_next_token (e->st);
 		if (g_ascii_strncasecmp( token, "type=", 5 ) == 0)
-			listType = get_list_type (token [5]);
+			listType = get_list_type (token + 5);
 	}
 
 	html_stack_push (e->listStack, html_list_new (listType));
diff --git a/gtkhtml/htmlenums.h b/gtkhtml/htmlenums.h
index f306941..36931ab 100644
--- a/gtkhtml/htmlenums.h
+++ b/gtkhtml/htmlenums.h
@@ -138,7 +138,10 @@ typedef enum {
 	HTML_LIST_TYPE_BLOCKQUOTE,
 	HTML_LIST_TYPE_BLOCKQUOTE_CITE,
 	HTML_LIST_TYPE_GLOSSARY_DL,
-	HTML_LIST_TYPE_GLOSSARY_DD
+	HTML_LIST_TYPE_GLOSSARY_DD,
+	HTML_LIST_TYPE_CIRCLE,
+	HTML_LIST_TYPE_DISC,
+	HTML_LIST_TYPE_SQUARE
 } HTMLListType;
 
 typedef enum {



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