summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/mdoc_man.c33
-rw-r--r--usr.bin/mandoc/mdoc_term.c33
2 files changed, 47 insertions, 19 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 0085bdf020b..ef354c1c151 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.21 2012/07/08 18:38:07 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.22 2012/07/08 22:48:38 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -66,6 +66,7 @@ static int pre_fo(DECL_ARGS);
static int pre_ft(DECL_ARGS);
static int pre_in(DECL_ARGS);
static int pre_it(DECL_ARGS);
+static int pre_lk(DECL_ARGS);
static int pre_nm(DECL_ARGS);
static int pre_ns(DECL_ARGS);
static int pre_pp(DECL_ARGS);
@@ -195,7 +196,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ NULL, pre_ux, NULL, "currently under development.", NULL }, /* Ud */
{ NULL, NULL, post_lb, NULL, NULL }, /* Lb */
{ NULL, pre_pp, NULL, NULL, NULL }, /* Lp */
- { NULL, NULL, NULL, NULL, NULL }, /* _Lk */
+ { NULL, pre_lk, NULL, NULL, NULL }, /* Lk */
{ NULL, NULL, NULL, NULL, NULL }, /* _Mt */
{ cond_body, pre_enc, post_enc, "{", "}" }, /* Brq */
{ cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */
@@ -827,6 +828,34 @@ post_lb(DECL_ARGS)
}
static int
+pre_lk(DECL_ARGS)
+{
+ const struct mdoc_node *link, *descr;
+
+ if (NULL == (link = n->child))
+ return(0);
+
+ if (NULL != (descr = link->next)) {
+ print_word("\\fI");
+ outflags &= ~MMAN_spc;
+ while (NULL != descr) {
+ print_word(descr->string);
+ descr = descr->next;
+ }
+ print_word(":");
+ outflags &= ~MMAN_spc;
+ print_word("\\fP");
+ }
+
+ print_word("\\fB");
+ outflags &= ~MMAN_spc;
+ print_word(link->string);
+ outflags &= ~MMAN_spc;
+ print_word("\\fP");
+ return(0);
+}
+
+static int
pre_nm(DECL_ARGS)
{
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index c1b0a4e5957..4f724dadf2c 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,7 +1,7 @@
-/* $Id: mdoc_term.c,v 1.141 2012/07/08 16:50:36 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.142 2012/07/08 22:48:38 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2012 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
@@ -2155,25 +2155,24 @@ termp_li_pre(DECL_ARGS)
static int
termp_lk_pre(DECL_ARGS)
{
- const struct mdoc_node *nn, *sv;
+ const struct mdoc_node *link, *descr;
- term_fontpush(p, TERMFONT_UNDER);
-
- nn = sv = n->child;
-
- if (NULL == nn || NULL == nn->next)
- return(1);
-
- for (nn = nn->next; nn; nn = nn->next)
- term_word(p, nn->string);
-
- term_fontpop(p);
+ if (NULL == (link = n->child))
+ return(0);
- p->flags |= TERMP_NOSPACE;
- term_word(p, ":");
+ if (NULL != (descr = link->next)) {
+ term_fontpush(p, TERMFONT_UNDER);
+ while (NULL != descr) {
+ term_word(p, descr->string);
+ descr = descr->next;
+ }
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, ":");
+ term_fontpop(p);
+ }
term_fontpush(p, TERMFONT_BOLD);
- term_word(p, sv->string);
+ term_word(p, link->string);
term_fontpop(p);
return(0);