]> git.cameronkatri.com Git - mandoc.git/blobdiff - man_term.c
Use <span> for .Ad rather than <i>; also suggested by John Gardner.
[mandoc.git] / man_term.c
index a2cc1f0c844bd7dbe4819af24da8b280941558d0..1404602beb87e1b2f340086d62588cc3414d7c11 100644 (file)
@@ -1,7 +1,7 @@
-/*     $Id: man_term.c,v 1.205 2017/06/14 17:51:15 schwarze Exp $ */
+/*     $Id: man_term.c,v 1.210 2018/04/11 17:11:13 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2015, 2017, 2018 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
@@ -128,6 +128,8 @@ static      const struct termact __termacts[MAN_MAX - MAN_TH] = {
        { pre_literal, NULL, 0 }, /* EE */
        { pre_UR, post_UR, 0 }, /* UR */
        { NULL, NULL, 0 }, /* UE */
+       { pre_UR, post_UR, 0 }, /* MT */
+       { NULL, NULL, 0 }, /* ME */
 };
 static const struct termact *termacts = __termacts - MAN_TH;
 
@@ -141,6 +143,9 @@ terminal_man(void *arg, const struct roff_man *man)
        size_t                   save_defindent;
 
        p = (struct termp *)arg;
+       save_defindent = p->defindent;
+       if (p->synopsisonly == 0 && p->defindent == 0)
+               p->defindent = 7;
        p->tcol->rmargin = p->maxrmargin = p->defrmargin;
        term_tab_set(p, NULL);
        term_tab_set(p, "T");
@@ -167,16 +172,13 @@ terminal_man(void *arg, const struct roff_man *man)
                        n = n->next;
                }
        } else {
-               save_defindent = p->defindent;
-               if (p->defindent == 0)
-                       p->defindent = 7;
                term_begin(p, print_man_head, print_man_foot, &man->meta);
                p->flags |= TERMP_NOSPACE;
                if (n != NULL)
                        print_man_nodelist(p, &mt, n, &man->meta);
                term_end(p);
-               p->defindent = save_defindent;
        }
+       p->defindent = save_defindent;
 }
 
 /*
@@ -671,9 +673,10 @@ pre_SS(DECL_ARGS)
 
                do {
                        n = n->prev;
-               } while (n != NULL && n->tok != TOKEN_NONE &&
+               } while (n != NULL && n->tok >= MAN_TH &&
                    termacts[n->tok].flags & MAN_NOTEXT);
-               if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
+               if (n == NULL || n->type == ROFFT_COMMENT ||
+                   (n->tok == MAN_SS && n->body->child == NULL))
                        break;
 
                for (i = 0; i < mt->pardist; i++)
@@ -733,9 +736,10 @@ pre_SH(DECL_ARGS)
 
                do {
                        n = n->prev;
-               } while (n != NULL && n->tok != TOKEN_NONE &&
+               } while (n != NULL && n->tok >= MAN_TH &&
                    termacts[n->tok].flags & MAN_NOTEXT);
-               if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
+               if (n == NULL || n->type == ROFFT_COMMENT ||
+                   (n->tok == MAN_SH && n->body->child == NULL))
                        break;
 
                for (i = 0; i < mt->pardist; i++)
@@ -872,7 +876,10 @@ print_man_node(DECL_ARGS)
                 * before printing the line's data.
                 */
                if (*n->string == '\0') {
-                       term_vspace(p);
+                       if (p->flags & TERMP_NONEWLINE)
+                               term_newln(p);
+                       else
+                               term_vspace(p);
                        return;
                } else if (*n->string == ' ' && n->flags & NODE_LINE &&
                    (p->flags & TERMP_NONEWLINE) == 0)
@@ -880,7 +887,8 @@ print_man_node(DECL_ARGS)
 
                term_word(p, n->string);
                goto out;
-
+       case ROFFT_COMMENT:
+               return;
        case ROFFT_EQN:
                if ( ! (n->flags & NODE_LINE))
                        p->flags |= TERMP_NOSPACE;