1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Changes in the handling of the format flags for list elements

* 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 <fabiduc@gmail.com>
This commit is contained in:
Fabienne Ducroquet 2013-04-02 20:51:55 +02:00 committed by Witold Filipczyk
parent a229adb19a
commit ad7ff0386d
4 changed files with 17 additions and 13 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;