aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-06 10:50:56 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-06 10:50:56 +0000
commit55591c02f9e55af205461f7ee1e172fad85586c8 (patch)
tree7c56b4ed771deb25caadbe820f721a023f642893 /mdoc_term.c
parent7e2c70e4c592c2dd58f254e10b2cacecb4660130 (diff)
downloadmandoc-55591c02f9e55af205461f7ee1e172fad85586c8.tar.gz
mandoc-55591c02f9e55af205461f7ee1e172fad85586c8.tar.zst
mandoc-55591c02f9e55af205461f7ee1e172fad85586c8.zip
Fixed -Tascii and -Thtml rendering of `Ft' and `Fo'.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index fec3bf48..a3226b83 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.140 2010/06/04 22:26:13 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.141 2010/06/06 10:50:56 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -82,7 +82,6 @@ static void termp_dq_post(DECL_ARGS);
static void termp_fd_post(DECL_ARGS);
static void termp_fn_post(DECL_ARGS);
static void termp_fo_post(DECL_ARGS);
-static void termp_ft_post(DECL_ARGS);
static void termp_in_post(DECL_ARGS);
static void termp_it_post(DECL_ARGS);
static void termp_lb_post(DECL_ARGS);
@@ -166,7 +165,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_bold_pre, termp_fd_post }, /* Fd */
{ termp_fl_pre, NULL }, /* Fl */
{ termp_fn_pre, termp_fn_post }, /* Fn */
- { termp_ft_pre, termp_ft_post }, /* Ft */
+ { termp_ft_pre, NULL }, /* Ft */
{ termp_bold_pre, NULL }, /* Ic */
{ termp_in_pre, termp_in_post }, /* In */
{ termp_li_pre, NULL }, /* Li */
@@ -1511,9 +1510,9 @@ static int
termp_ft_pre(DECL_ARGS)
{
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
- if (n->prev && MDOC_Fo == n->prev->tok)
- term_vspace(p);
+ /* NB: MDOC_LINE does not effect this! */
+ if (SEC_SYNOPSIS == n->sec && n->prev)
+ term_vspace(p);
term_fontpush(p, TERMFONT_UNDER);
return(1);
@@ -1521,16 +1520,6 @@ termp_ft_pre(DECL_ARGS)
/* ARGSUSED */
-static void
-termp_ft_post(DECL_ARGS)
-{
-
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
- term_newln(p);
-}
-
-
-/* ARGSUSED */
static int
termp_fn_pre(DECL_ARGS)
{
@@ -1993,23 +1982,29 @@ termp_pq_post(DECL_ARGS)
static int
termp_fo_pre(DECL_ARGS)
{
- const struct mdoc_node *nn;
- if (MDOC_BODY == n->type) {
+ if (MDOC_BLOCK == n->type) {
+ /* NB: MDOC_LINE has no effect on this macro! */
+ if (SEC_SYNOPSIS != n->sec)
+ return(1);
+ if (n->prev && MDOC_Ft == n->prev->tok)
+ term_newln(p);
+ else if (n->prev)
+ term_vspace(p);
+ return(1);
+ } else if (MDOC_BODY == n->type) {
p->flags |= TERMP_NOSPACE;
term_word(p, "(");
p->flags |= TERMP_NOSPACE;
return(1);
- } else if (MDOC_HEAD != n->type)
- return(1);
+ }
- term_fontpush(p, TERMFONT_BOLD);
- for (nn = n->child; nn; nn = nn->next) {
- assert(MDOC_TEXT == nn->type);
- term_word(p, nn->string);
- }
- term_fontpop(p);
+ /* XXX: we drop non-initial arguments as per groff. */
+ assert(n->child);
+ assert(n->child->string);
+ term_fontpush(p, TERMFONT_BOLD);
+ term_word(p, n->child->string);
return(0);
}
@@ -2019,13 +2014,18 @@ static void
termp_fo_post(DECL_ARGS)
{
- if (MDOC_BODY != n->type)
- return;
- p->flags |= TERMP_NOSPACE;
- term_word(p, ")");
- p->flags |= TERMP_NOSPACE;
- term_word(p, ";");
- term_newln(p);
+ if (MDOC_BLOCK == n->type) {
+ /* NB: MDOC_LINE has no effect on this macro! */
+ if (SEC_SYNOPSIS == n->sec)
+ term_newln(p);
+ } else if (MDOC_BODY == n->type) {
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, ")");
+ if (SEC_SYNOPSIS == n->sec) {
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, ";");
+ }
+ }
}