* Rename P_STAR as P_DISC and P_PLUS as P_SQUARE.

* Delete P_NONE because it was used only as the default flag in init_html_parser
  and a list with P_NONE then got bullets, so instead use P_DISC by default (as
  per the CSS specification), and P_NO_BULLET for lists with no bullets.

* Use as bullets the characters:
  - U+25E6 WHITE BULLET for the circle style;
  - U+25AA BLACK SMALL SQUARE (alias square bullet) for the square style;
  - U+2022 BULLET for the disc style (default).

Signed-off-by: Fabienne Ducroquet <fabi...@gmail.com>
---
 src/document/css/apply.c           |    4 ++--
 src/document/html/parser.c         |    2 +-
 src/document/html/parser.h         |    7 +++----
 src/document/html/parser/general.c |   17 +++++++++++------
 4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/document/css/apply.c b/src/document/css/apply.c
index 233d8bd..8c3bd85 100644
--- a/src/document/css/apply.c
+++ b/src/document/css/apply.c
@@ -104,9 +104,9 @@ css_apply_list_style(struct html_context *html_context,
        element->parattr.list_number = (prop->value.list_style > 
CSS_LIST_ORDINAL);
        switch (prop->value.list_style) {
        case CSS_LIST_NONE: element->parattr.flags = P_NO_BULLET; break;
-       case CSS_LIST_DISC: element->parattr.flags = P_O; break;
+       case CSS_LIST_DISC: element->parattr.flags = P_DISC; break;
        case CSS_LIST_CIRCLE: element->parattr.flags = P_O; break;
-       case CSS_LIST_SQUARE: element->parattr.flags = P_PLUS; break;
+       case CSS_LIST_SQUARE: element->parattr.flags = P_SQUARE; break;
        case CSS_LIST_DECIMAL: element->parattr.flags = P_NUMBER; break;
        case CSS_LIST_DECIMAL_LEADING_ZERO: element->parattr.flags = P_NUMBER; 
break;
        case CSS_LIST_LOWER_ROMAN: element->parattr.flags = P_roman; break;
diff --git a/src/document/html/parser.c b/src/document/html/parser.c
index c10fd9d..332b527 100644
--- a/src/document/html/parser.c
+++ b/src/document/html/parser.c
@@ -805,7 +805,7 @@ init_html_parser(struct uri *uri, struct document_options 
*options,
        par_format.width = options->box.width;
        par_format.list_level = par_format.list_number = 0;
        par_format.dd_margin = options->margin;
-       par_format.flags = P_NONE;
+       par_format.flags = P_DISC;
 
        par_format.color.background = options->default_style.color.background;
 
diff --git a/src/document/html/parser.h b/src/document/html/parser.h
index e0e74db..cbc438d 100644
--- a/src/document/html/parser.h
+++ b/src/document/html/parser.h
@@ -73,18 +73,17 @@ struct text_attrib {
 
 /* This enum is pretty ugly, yes ;). */
 enum format_list_flag {
-       P_NONE = 0,
+       P_NO_BULLET = 0,
 
        P_NUMBER = 1,
        P_alpha = 2,
        P_ALPHA = 3,
        P_roman = 4,
        P_ROMAN = 5,
-       P_NO_BULLET = 6,
 
-       P_STAR = 1,
+       P_DISC = 1,
        P_O = 2,
-       P_PLUS = 3,
+       P_SQUARE = 3,
 
        P_LISTMASK = 7,
 
diff --git a/src/document/html/parser/general.c 
b/src/document/html/parser/general.c
index 1bcef8a..570e061 100644
--- a/src/document/html/parser/general.c
+++ b/src/document/html/parser/general.c
@@ -744,14 +744,16 @@ html_ul(struct html_context *html_context, unsigned char 
*a,
        /* dump_html_stack(html_context); */
        par_format.list_level++;
        par_format.list_number = 0;
-       par_format.flags = P_STAR;
+       par_format.flags = P_DISC;
 
        al = get_attr_val(a, "type", html_context->doc_cp);
        if (al) {
-               if (!c_strcasecmp(al, "disc") || !c_strcasecmp(al, "circle"))
+               if (!c_strcasecmp(al, "disc"))
+                       par_format.flags = P_DISC;
+               else if (!c_strcasecmp(al, "circle"))
                        par_format.flags = P_O;
                else if (!c_strcasecmp(al, "square"))
-                       par_format.flags = P_PLUS;
+                       par_format.flags = P_SQUARE;
                mem_free(al);
        }
        par_format.leftmargin += 2 + (par_format.list_level > 1);
@@ -867,9 +869,12 @@ html_li(struct html_context *html_context, unsigned char 
*a,
        if (t == P_NO_BULLET) {
                /* Print nothing. */
        } else if (!par_format.list_number) {
-               if (t == P_O) put_chrs(html_context, "&#9675;", 7); /* o */
-               else if (t == P_PLUS) put_chrs(html_context, "&#9109;", 7); /* 
+ */
-               else put_chrs(html_context, "&#8226;", 7); /* * */
+               if (t == P_O) /* Print U+25E6 WHITE BULLET. */
+                       put_chrs(html_context, "&#9702;", 7);
+               else if (t == P_SQUARE) /* Print U+25AA BLACK SMALL SQUARE. */
+                       put_chrs(html_context, "&#9642;", 7);
+               else /* Print U+2022 BULLET. */
+                       put_chrs(html_context, "&#8226;", 7);
                put_chrs(html_context, "&nbsp;", 6);
                par_format.leftmargin += 2;
                par_format.align = ALIGN_LEFT;
-- 
1.7.10.4

_______________________________________________
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to