From 9a0c4c4571a9055eab5a14fcee755c5dde12f643 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 27 Sep 2014 09:20:03 +0000 Subject: HTML5-isation: remove more alignments. --- example.style.css | 6 +++--- html.c | 4 ++-- html.h | 1 - man_html.c | 47 +++++++++++++++++++++++------------------------ mdoc_html.c | 47 +++++++++++++++++++++++------------------------ style.css | 2 +- 6 files changed, 52 insertions(+), 55 deletions(-) diff --git a/example.style.css b/example.style.css index 08cccd2e..ee3121af 100644 --- a/example.style.css +++ b/example.style.css @@ -20,11 +20,11 @@ div.mandoc div.subsection { } /* Sub-sections (Ss, SS). */ div.mandoc table.synopsis { } /* SYNOPSIS section table. */ div.mandoc table.foot { } /* Document footer. */ div.mandoc td.foot-date { width: 50%; } /* Document footer: date. */ -div.mandoc td.foot-os { width: 50%; text-align: right; } /* Document footer: OS/source. */ +div.mandoc td.foot-os { width: 50%; } /* Document footer: OS/source. */ div.mandoc table.head { } /* Document header. */ div.mandoc td.head-ltitle { width: 10%; } /* Document header: left-title. */ -div.mandoc td.head-vol { width: 80%; text-align: center; } /* Document header: volume. */ -div.mandoc td.head-rtitle { width: 10%; text-align: right; } /* Document header: right-title. */ +div.mandoc td.head-vol { width: 80%; } /* Document header: volume. */ +div.mandoc td.head-rtitle { width: 10%; } /* Document header: right-title. */ div.mandoc .display { } /* All Bd, D1, Dl. */ div.mandoc .list { } /* All Bl. */ div.mandoc i { } /* Italic: BI, IB, I, (implicit). */ diff --git a/html.c b/html.c index 6220e223..86ec9452 100644 --- a/html.c +++ b/html.c @@ -87,7 +87,6 @@ static const char *const htmlattrs[ATTR_MAX] = { "style", /* ATTR_STYLE */ "width", /* ATTR_WIDTH */ "id", /* ATTR_ID */ - "align", /* ATTR_ALIGN */ "colspan", /* ATTR_COLSPAN */ "charset", /* ATTR_CHARSET */ }; @@ -202,7 +201,8 @@ print_gen_head(struct html *h) */ t = print_otag(h, TAG_STYLE, 0, NULL); print_text(h, "table.head, table.foot { width: 100%; }\n" - "td.head-rtitle, td.foot-os { text-align: right; }\n"); + "td.head-rtitle, td.foot-os { text-align: right; }\n" + "td.head-vol { text-align: center; }\n"); print_tagq(h, t); if (h->style) { diff --git a/html.h b/html.h index 5494c813..b2087049 100644 --- a/html.h +++ b/html.h @@ -64,7 +64,6 @@ enum htmlattr { ATTR_STYLE, ATTR_WIDTH, ATTR_ID, - ATTR_ALIGN, ATTR_COLSPAN, ATTR_CHARSET, ATTR_MAX diff --git a/man_html.c b/man_html.c index 6c43c864..ef51b8fd 100644 --- a/man_html.c +++ b/man_html.c @@ -299,7 +299,7 @@ a2width(const struct man_node *n, struct roffsu *su) static void man_root_pre(MAN_ARGS) { - struct htmlpair tag[2]; + struct htmlpair tag; struct tag *t, *tt; char *title; @@ -307,31 +307,30 @@ man_root_pre(MAN_ARGS) assert(man->msec); mandoc_asprintf(&title, "%s(%s)", man->title, man->msec); - PAIR_CLASS_INIT(&tag[0], "head"); - t = print_otag(h, TAG_TABLE, 1, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "30%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + PAIR_CLASS_INIT(&tag, "head"); + t = print_otag(h, TAG_TABLE, 1, &tag); + PAIR_INIT(&tag, ATTR_WIDTH, "30%"); + print_otag(h, TAG_COL, 1, &tag); + print_otag(h, TAG_COL, 1, &tag); + print_otag(h, TAG_COL, 1, &tag); print_otag(h, TAG_TBODY, 0, NULL); tt = print_otag(h, TAG_TR, 0, NULL); - PAIR_CLASS_INIT(&tag[0], "head-ltitle"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "head-ltitle"); + print_otag(h, TAG_TD, 1, &tag); print_text(h, title); print_stagq(h, tt); - PAIR_CLASS_INIT(&tag[0], "head-vol"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); - print_otag(h, TAG_TD, 2, tag); + PAIR_CLASS_INIT(&tag, "head-vol"); + print_otag(h, TAG_TD, 1, &tag); if (NULL != man->vol) print_text(h, man->vol); print_stagq(h, tt); - PAIR_CLASS_INIT(&tag[0], "head-rtitle"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "head-rtitle"); + print_otag(h, TAG_TD, 1, &tag); print_text(h, title); print_tagq(h, t); free(title); @@ -340,26 +339,26 @@ man_root_pre(MAN_ARGS) static void man_root_post(MAN_ARGS) { - struct htmlpair tag[2]; + struct htmlpair tag; struct tag *t, *tt; - PAIR_CLASS_INIT(&tag[0], "foot"); - t = print_otag(h, TAG_TABLE, 1, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "50%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + PAIR_CLASS_INIT(&tag, "foot"); + t = print_otag(h, TAG_TABLE, 1, &tag); + PAIR_INIT(&tag, ATTR_WIDTH, "50%"); + print_otag(h, TAG_COL, 1, &tag); + print_otag(h, TAG_COL, 1, &tag); tt = print_otag(h, TAG_TR, 0, NULL); - PAIR_CLASS_INIT(&tag[0], "foot-date"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "foot-date"); + print_otag(h, TAG_TD, 1, &tag); assert(man->date); print_text(h, man->date); print_stagq(h, tt); - PAIR_CLASS_INIT(&tag[0], "foot-os"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "foot-os"); + print_otag(h, TAG_TD, 1, &tag); if (man->source) print_text(h, man->source); diff --git a/mdoc_html.c b/mdoc_html.c index 3c6c3388..59eda03b 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -484,26 +484,26 @@ print_mdoc_node(MDOC_ARGS) static void mdoc_root_post(MDOC_ARGS) { - struct htmlpair tag[2]; + struct htmlpair tag; struct tag *t, *tt; - PAIR_CLASS_INIT(&tag[0], "foot"); - t = print_otag(h, TAG_TABLE, 1, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "50%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + PAIR_CLASS_INIT(&tag, "foot"); + t = print_otag(h, TAG_TABLE, 1, &tag); + PAIR_INIT(&tag, ATTR_WIDTH, "50%"); + print_otag(h, TAG_COL, 1, &tag); + print_otag(h, TAG_COL, 1, &tag); print_otag(h, TAG_TBODY, 0, NULL); tt = print_otag(h, TAG_TR, 0, NULL); - PAIR_CLASS_INIT(&tag[0], "foot-date"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "foot-date"); + print_otag(h, TAG_TD, 1, &tag); print_text(h, meta->date); print_stagq(h, tt); - PAIR_CLASS_INIT(&tag[0], "foot-os"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "foot-os"); + print_otag(h, TAG_TD, 1, &tag); print_text(h, meta->os); print_tagq(h, t); } @@ -511,7 +511,7 @@ mdoc_root_post(MDOC_ARGS) static int mdoc_root_pre(MDOC_ARGS) { - struct htmlpair tag[2]; + struct htmlpair tag; struct tag *t, *tt; char *volume, *title; @@ -527,30 +527,29 @@ mdoc_root_pre(MDOC_ARGS) mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); - PAIR_CLASS_INIT(&tag[0], "head"); - t = print_otag(h, TAG_TABLE, 1, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "30%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + PAIR_CLASS_INIT(&tag, "head"); + t = print_otag(h, TAG_TABLE, 1, &tag); + PAIR_INIT(&tag, ATTR_WIDTH, "30%"); + print_otag(h, TAG_COL, 1, &tag); + print_otag(h, TAG_COL, 1, &tag); + print_otag(h, TAG_COL, 1, &tag); print_otag(h, TAG_TBODY, 0, NULL); tt = print_otag(h, TAG_TR, 0, NULL); - PAIR_CLASS_INIT(&tag[0], "head-ltitle"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "head-ltitle"); + print_otag(h, TAG_TD, 1, &tag); print_text(h, title); print_stagq(h, tt); - PAIR_CLASS_INIT(&tag[0], "head-vol"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); - print_otag(h, TAG_TD, 2, tag); + PAIR_CLASS_INIT(&tag, "head-vol"); + print_otag(h, TAG_TD, 1, &tag); print_text(h, volume); print_stagq(h, tt); - PAIR_CLASS_INIT(&tag[0], "head-rtitle"); - print_otag(h, TAG_TD, 1, tag); + PAIR_CLASS_INIT(&tag, "head-rtitle"); + print_otag(h, TAG_TD, 1, &tag); print_text(h, title); print_tagq(h, t); diff --git a/style.css b/style.css index 1cf67ce3..fb072c4a 100644 --- a/style.css +++ b/style.css @@ -28,7 +28,7 @@ td.foot-date { width: 50%; } /* Document footer: date. */ td.foot-os { width: 50%; } /* Document footer: OS/source. */ table.head { font-size: smaller; margin-bottom: 1em; border-bottom: 1px dotted #dddddd; } /* Document header. */ td.head-ltitle { width: 10%; } /* Document header: left-title. */ -td.head-vol { width: 80%; text-align: center; } /* Document header: volume. */ +td.head-vol { width: 80%; } /* Document header: volume. */ td.head-rtitle { width: 10%; } /* Document header: right-title. */ /* General font modes. */ -- cgit