]> git.cameronkatri.com Git - mandoc.git/commitdiff
basic tag support for function names; written at YYC
authorIngo Schwarze <schwarze@openbsd.org>
Sat, 25 Jul 2015 14:18:04 +0000 (14:18 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Sat, 25 Jul 2015 14:18:04 +0000 (14:18 +0000)
mdoc_term.c

index bed304c18544da0232251efaba8717eead68bbb0..7486fa4424031567ecf996357cd721dcbde38118 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: mdoc_term.c,v 1.321 2015/07/25 14:02:06 schwarze Exp $ */
+/*     $Id: mdoc_term.c,v 1.322 2015/07/25 14:18:04 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -251,6 +251,7 @@ static      const struct termact termacts[MDOC_MAX] = {
        { termp_ll_pre, NULL }, /* ll */
 };
 
+static int      fn_prio;
 
 void
 terminal_mdoc(void *arg, const struct roff_man *mdoc)
@@ -1364,7 +1365,7 @@ termp_sh_pre(DECL_ARGS)
                 * when the previous section was empty.
                 */
                if (n->prev == NULL ||
-                   MDOC_Sh != n->prev->tok ||
+                   n->prev->tok != MDOC_Sh ||
                    (n->prev->body != NULL &&
                     n->prev->body->child != NULL))
                        term_vspace(p);
@@ -1374,8 +1375,16 @@ termp_sh_pre(DECL_ARGS)
                break;
        case ROFFT_BODY:
                p->offset = term_len(p, p->defindent);
-               if (SEC_AUTHORS == n->sec)
+               switch (n->sec) {
+               case SEC_DESCRIPTION:
+                       fn_prio = 0;
+                       break;
+               case SEC_AUTHORS:
                        p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT);
+                       break;
+               default:
+                       break;
+               }
                break;
        default:
                break;
@@ -1471,6 +1480,11 @@ termp_fn_pre(DECL_ARGS)
        term_word(p, n->string);
        term_fontpop(p);
 
+       if (n->sec == SEC_DESCRIPTION) {
+               if ( ! tag_get(n->string, 0, ++fn_prio))
+                       tag_put(n->string, 0, fn_prio, p->line);
+       }
+
        if (pretty) {
                term_flushln(p);
                p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG);
@@ -1823,6 +1837,7 @@ termp_sp_pre(DECL_ARGS)
                break;
        default:
                len = 1;
+               fn_prio = 0;
                break;
        }