summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-06 12:37:17 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-06 12:37:17 +0000
commit8953dce6410913db1ce531b8f37750ee72bc45e7 (patch)
treeadc1699cfeb140a4e6efb7ef95be6681941ea2fe /mdoc_html.c
parent25b9ffe82ac5592b33241ae447d947f4dca24f7f (diff)
downloadmandoc-8953dce6410913db1ce531b8f37750ee72bc45e7.tar.gz
Give -T[x]html `Bk -words' capability.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 5de0f230..62f917fd 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -73,6 +73,8 @@ static int mdoc_aq_pre(MDOC_ARGS);
static int mdoc_ar_pre(MDOC_ARGS);
static int mdoc_bd_pre(MDOC_ARGS);
static int mdoc_bf_pre(MDOC_ARGS);
+static void mdoc_bk_post(MDOC_ARGS);
+static int mdoc_bk_pre(MDOC_ARGS);
static void mdoc_bl_post(MDOC_ARGS);
static int mdoc_bl_pre(MDOC_ARGS);
static void mdoc_bq_post(MDOC_ARGS);
@@ -237,7 +239,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{NULL, NULL}, /* Fc */
{mdoc_op_pre, mdoc_op_post}, /* Oo */
{NULL, NULL}, /* Oc */
- {NULL, NULL}, /* Bk */
+ {mdoc_bk_pre, mdoc_bk_post}, /* Bk */
{NULL, NULL}, /* Ek */
{mdoc_bt_pre, NULL}, /* Bt */
{NULL, NULL}, /* Hf */
@@ -442,6 +444,18 @@ print_mdoc_node(MDOC_ARGS)
break;
}
+ if (HTML_KEEP & h->flags) {
+ if (n->prev && n->prev->line != n->line) {
+ h->flags &= ~HTML_KEEP;
+ h->flags |= HTML_PREKEEP;
+ } else if (NULL == n->prev) {
+ if (n->parent && n->parent->line != n->line) {
+ h->flags &= ~HTML_KEEP;
+ h->flags |= HTML_PREKEEP;
+ }
+ }
+ }
+
if (child && n->child)
print_mdoc_nodelist(m, n->child, h);
@@ -2227,3 +2241,35 @@ mdoc__x_post(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
print_text(h, n->next ? "," : ".");
}
+
+
+/* ARGSUSED */
+static int
+mdoc_bk_pre(MDOC_ARGS)
+{
+
+ switch (n->type) {
+ case (MDOC_BLOCK):
+ break;
+ case (MDOC_HEAD):
+ return(0);
+ case (MDOC_BODY):
+ h->flags |= HTML_PREKEEP;
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc_bk_post(MDOC_ARGS)
+{
+
+ if (MDOC_BODY == n->type)
+ h->flags &= ~(HTML_KEEP | HTML_PREKEEP);
+}