aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mdoc_html.c9
-rw-r--r--mdoc_macro.c27
-rw-r--r--mdoc_man.c11
-rw-r--r--mdoc_term.c9
4 files changed, 30 insertions, 26 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 0dc32208..5b0497a8 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.198 2014/08/14 00:31:43 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.199 2014/08/21 12:57:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -640,9 +640,10 @@ mdoc_fl_pre(MDOC_ARGS)
print_text(h, "\\-");
- if (n->child)
- h->flags |= HTML_NOSPACE;
- else if (n->next && n->next->line == n->line)
+ if ( ! (n->nchild == 0 &&
+ (n->next == NULL ||
+ n->next->type == MDOC_TEXT ||
+ n->next->flags & MDOC_LINE)))
h->flags |= HTML_NOSPACE;
return(1);
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 4c5bf351..dfe350c8 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.141 2014/08/16 19:50:37 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.142 2014/08/21 12:57:17 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -843,7 +843,7 @@ blk_exp_close(MACRO_PROT_ARGS)
static int
in_line(MACRO_PROT_ARGS)
{
- int la, scope, cnt, nc, nl;
+ int la, scope, cnt, mayopen, nc, nl;
enum margverr av;
enum mdoct ntok;
enum margserr ac;
@@ -894,6 +894,7 @@ in_line(MACRO_PROT_ARGS)
return(0);
}
+ mayopen = 1;
for (cnt = scope = 0;; ) {
la = *pos;
ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
@@ -950,19 +951,19 @@ in_line(MACRO_PROT_ARGS)
* If we encounter closing punctuation, no word
* has been omitted, no scope is open, and we're
* allowed to have an empty element, then start
- * a new scope. `Ar', `Fl', and `Li', only do
- * this once per invocation. There may be more
- * of these (all of them?).
+ * a new scope.
*/
- if (0 == cnt && (nc || MDOC_Li == tok) &&
- DELIM_CLOSE == d && ! scope) {
+ if ((d == DELIM_CLOSE ||
+ (d == DELIM_MIDDLE && tok == MDOC_Fl)) &&
+ (nc || tok == MDOC_Li) &&
+ !scope && !cnt && mayopen) {
if ( ! mdoc_elem_alloc(mdoc,
line, ppos, tok, arg))
return(0);
- if (MDOC_Ar == tok || MDOC_Li == tok ||
- MDOC_Fl == tok)
- cnt++;
scope = 1;
+ cnt++;
+ if (MDOC_Li == tok || MDOC_Nm == tok)
+ mayopen = 0;
}
/*
* Close out our scope, if one is open, before
@@ -971,14 +972,12 @@ in_line(MACRO_PROT_ARGS)
if (scope && ! rew_elem(mdoc, tok))
return(0);
scope = 0;
- } else if ( ! scope) {
+ } else if (mayopen && !scope) {
if ( ! mdoc_elem_alloc(mdoc, line, ppos, tok, arg))
return(0);
scope = 1;
- }
-
- if (DELIM_NONE == d)
cnt++;
+ }
if ( ! dword(mdoc, line, la, p, d,
MDOC_JOIN & mdoc_macros[tok].flags))
diff --git a/mdoc_man.c b/mdoc_man.c
index 62c7cec2..6fa424ae 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.69 2014/08/10 23:54:41 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.70 2014/08/21 12:57:17 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -1166,7 +1166,8 @@ pre_fl(DECL_ARGS)
font_push('B');
print_word("\\-");
- outflags &= ~MMAN_spc;
+ if (n->nchild)
+ outflags &= ~MMAN_spc;
return(1);
}
@@ -1175,8 +1176,10 @@ post_fl(DECL_ARGS)
{
font_pop();
- if (0 == n->nchild && NULL != n->next &&
- n->next->line == n->line)
+ if ( ! (n->nchild ||
+ n->next == NULL ||
+ n->next->type == MDOC_TEXT ||
+ n->next->flags & MDOC_LINE))
outflags &= ~MMAN_spc;
}
diff --git a/mdoc_term.c b/mdoc_term.c
index 1f759399..f10b5c49 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.279 2014/08/17 16:51:55 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.280 2014/08/21 12:57:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1075,9 +1075,10 @@ termp_fl_pre(DECL_ARGS)
term_fontpush(p, TERMFONT_BOLD);
term_word(p, "\\-");
- if (n->child)
- p->flags |= TERMP_NOSPACE;
- else if (n->next && n->next->line == n->line)
+ if ( ! (n->nchild == 0 &&
+ (n->next == NULL ||
+ n->next->type == MDOC_TEXT ||
+ n->next->flags & MDOC_LINE)))
p->flags |= TERMP_NOSPACE;
return(1);