summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2021-05-16 18:11:20 +0000
committerIngo Schwarze <schwarze@openbsd.org>2021-05-16 18:11:20 +0000
commita7aea729f48f4aaec131fc08bf37f6ef245cac0d (patch)
tree16a81541e86862140bfb4d82f2c920aaebdd5f96
parente423fd0bcabdf280084ef41611c320fd29821fd2 (diff)
downloadmandoc-a7aea729f48f4aaec131fc08bf37f6ef245cac0d.tar.gz
implement the tbl(7) layout modifiers "b" (bold) and "i" (italic)
in HTML output mode, similar to tbl_term.c, function tbl_word(); issue reported by Oliver dot Corff at email dot de
-rw-r--r--html.c1
-rw-r--r--tbl_html.c12
2 files changed, 11 insertions, 2 deletions
diff --git a/html.c b/html.c
index 96dc8cd8..338529d4 100644
--- a/html.c
+++ b/html.c
@@ -140,6 +140,7 @@ html_alloc(const struct manoutput *outopts)
h = mandoc_calloc(1, sizeof(struct html));
h->tag = NULL;
+ h->metac = h->metal = ESCAPE_FONTROMAN;
h->style = outopts->style;
if ((h->base_man1 = outopts->man) == NULL)
h->base_man2 = NULL;
diff --git a/tbl_html.c b/tbl_html.c
index 29bafa3d..16257df8 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014,2015,2017,2018,2021 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -119,6 +119,7 @@ print_tbl(struct html *h, const struct tbl_span *sp)
const char *hspans, *vspans, *halign, *valign;
const char *bborder, *lborder, *rborder;
char hbuf[4], vbuf[4];
+ enum mandoc_esc save_font;
int i;
if (h->tblt == NULL)
@@ -240,8 +241,15 @@ print_tbl(struct html *h, const struct tbl_span *sp)
"vertical-align", valign,
"text-align", halign,
"border-right-style", rborder);
- if (dp->string != NULL)
+ if (dp->string != NULL) {
+ save_font = h->metac;
+ if (dp->layout->flags & TBL_CELL_BOLD)
+ html_setfont(h, ESCAPE_FONTBOLD);
+ else if (dp->layout->flags & TBL_CELL_ITALIC)
+ html_setfont(h, ESCAPE_FONTITALIC);
print_text(h, dp->string);
+ html_setfont(h, save_font);
+ }
}
print_tagq(h, tt);