summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-23 00:08:57 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-23 00:08:57 +0000
commitc0be1fbed2b6723c63c27df2ef9c35a42aed2502 (patch)
tree7e969bb62b1eba2e73474808534be7476ed51e94
parentb3eb7aa0ea2f065c5e7b4a9585bd716d2f27839d (diff)
downloadmandoc-c0be1fbed2b6723c63c27df2ef9c35a42aed2502.tar.gz
mandoc-c0be1fbed2b6723c63c27df2ef9c35a42aed2502.tar.zst
mandoc-c0be1fbed2b6723c63c27df2ef9c35a42aed2502.zip
Add support for `Sm' in -T[x]html -mdoc.
-rw-r--r--html.c8
-rw-r--r--html.h3
-rw-r--r--mdoc_html.c22
3 files changed, 28 insertions, 5 deletions
diff --git a/html.c b/html.c
index 070562fb..e90644a1 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.108 2010/07/21 20:35:03 kristaps Exp $ */
+/* $Id: html.c,v 1.109 2010/07/23 00:08:57 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -417,6 +417,9 @@ print_otag(struct html *h, enum htmltag tag,
printf("&#160;");
}
+ if ( ! (h->flags & HTML_NONOSPACE))
+ h->flags &= ~HTML_NOSPACE;
+
/* Print out the tag name and attributes. */
printf("<%s", htmltags[tag].name);
@@ -544,7 +547,8 @@ print_text(struct html *h, const char *word)
assert(word);
if ( ! print_encode(h, word, 0))
- h->flags &= ~HTML_NOSPACE;
+ if ( ! (h->flags & HTML_NONOSPACE))
+ h->flags &= ~HTML_NOSPACE;
/*
* Note that we don't process the pipe: the parser sees it as
diff --git a/html.h b/html.h
index b9c5d3ff..b2f9e8c3 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.26 2010/07/13 23:53:20 schwarze Exp $ */
+/* $Id: html.h,v 1.27 2010/07/23 00:08:57 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -113,6 +113,7 @@ struct html {
#define HTML_IGNDELIM (1 << 1)
#define HTML_KEEP (1 << 2)
#define HTML_PREKEEP (1 << 3)
+#define HTML_NONOSPACE (1 << 4)
struct tagq tags;
struct ordq ords;
void *symtab;
diff --git a/mdoc_html.c b/mdoc_html.c
index c41124d7..f109bd69 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.98 2010/07/19 11:11:54 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.99 2010/07/23 00:08:57 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -125,6 +125,7 @@ static int mdoc_pq_pre(MDOC_ARGS);
static int mdoc_rs_pre(MDOC_ARGS);
static int mdoc_rv_pre(MDOC_ARGS);
static int mdoc_sh_pre(MDOC_ARGS);
+static int mdoc_sm_pre(MDOC_ARGS);
static int mdoc_sp_pre(MDOC_ARGS);
static void mdoc_sq_post(MDOC_ARGS);
static int mdoc_sq_pre(MDOC_ARGS);
@@ -227,7 +228,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{NULL, NULL}, /* Sc */
{mdoc_sq_pre, mdoc_sq_post}, /* So */
{mdoc_sq_pre, mdoc_sq_post}, /* Sq */
- {NULL, NULL}, /* Sm */ /* FIXME - no idea. */
+ {mdoc_sm_pre, NULL}, /* Sm */
{mdoc_sx_pre, NULL}, /* Sx */
{mdoc_sy_pre, NULL}, /* Sy */
{NULL, NULL}, /* Tn */
@@ -1722,6 +1723,23 @@ mdoc_fn_pre(MDOC_ARGS)
/* ARGSUSED */
static int
+mdoc_sm_pre(MDOC_ARGS)
+{
+
+ assert(n->child && MDOC_TEXT == n->child->type);
+ if (0 == strcmp("on", n->child->string)) {
+ /* FIXME: no p->col to check... */
+ h->flags &= ~HTML_NOSPACE;
+ h->flags &= ~HTML_NONOSPACE;
+ } else
+ h->flags |= HTML_NONOSPACE;
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
mdoc_sp_pre(MDOC_ARGS)
{
int len;