ral) font. -Deprecated because on terminal output devices, this is usually -indistinguishable from normal text. -For literal displays, use -.Ic \&Ql Pq in-line , -.Ic \&Dl Pq single line , +Unquoted in-line literal display, always set in a constant-width font. +In most cases, use +.Ic \&Ql +instead because on terminal output devices, +.Ic \&Li +is usually indistinguishable from normal text. +This macro is only useful when enclosing the argument in quotes +is explicitly not desired, for example because it already stands out +due to being wrapped in another macro, e.g. in an +.Ic \&It +head. +.Pp +For longer literal displays, use +.Ic \&Dl Pq single line or .Ic \&Bd Fl literal Pq multi-line instead. @@ -2207,15 +2218,17 @@ Close quoted context opened by .Ic \&Qo . .Tg Ql .It Ic \&Ql Ar line -In-line literal display. +Normal in-line literal display, always set in constant-width font and +additionally enclosed in quotes by many formatters in many cases. This can be used for complete command invocations and for multi-word code examples when an indented display is not desired. .Pp See also -.Ic \&Dl -and +.Ic \&Dl , .Ic \&Bd -.Fl literal . +.Fl literal , +and +.Ic \&Li . .It Ic \&Qo Ar block Multi-line version of .Ic \&Qq . @@ -3031,7 +3044,7 @@ then the macro accepts an arbitrary number of arguments. .It Ic \&Hf Ta \&No Ta \&No Ta n .It Ic \&Ic Ta Yes Ta Yes Ta >0 .It Ic \&In Ta Yes Ta Yes Ta 1 -.It Ic \&Lb Ta \&No Ta \&No Ta 1 +.It Ic \&Lb Ta \&No Ta \&No Ta >0 .It Ic \&Li Ta Yes Ta Yes Ta >0 .It Ic \&Lk Ta Yes Ta Yes Ta >0 .It Ic \&Lp Ta \&No Ta \&No Ta 0 diff --git a/contrib/mandoc/mdoc_macro.c b/contrib/mandoc/mdoc_macro.c index 889b80a64a68..14b1ba0d228a 100644 --- a/contrib/mandoc/mdoc_macro.c +++ b/contrib/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.235 2022/04/14 16:43:44 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.237 2025/06/13 14:24:56 schwarze Exp $ */ /* * Copyright (c) 2010, 2012-2021 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -92,7 +92,7 @@ static const struct mdoc_macro mdoc_macros[MDOC_MAX - MDOC_Dd] = { { in_line_eoln, 0 }, /* Fd */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fl */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fn */ - { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ft */ + { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ft */ { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ic */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* In */ { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Li */ @@ -448,8 +448,7 @@ dword(struct roff_man *mdoc, int line, int col, const char *p, if (d == DELIM_MAX) d = mdoc_isdelim(p); - if (may_append && - ! (mdoc->flags & (MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF)) && + if (may_append && ! (mdoc->flags & (MDOC_KEEP | MDOC_SMOFF)) && d == DELIM_NONE && mdoc->last->type == ROFFT_TEXT && mdoc_isdelim(mdoc->last->string) == DELIM_NONE) { roff_word_append(mdoc, p); diff --git a/contrib/mandoc/mdoc_validate.c b/contrib/mandoc/mdoc_validate.c index 5271dfb523b9..4ca1253e4b70 100644 --- a/contrib/mandoc/mdoc_validate.c +++ b/contrib/mandoc/mdoc_validate.c @@ -1,6 +1,6 @@ -/* $Id: mdoc_validate.c,v 1.391 2022/06/08 16:31:46 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.393 2025/06/05 12:38:26 schwarze Exp $ */ /* - * Copyright (c) 2010-2021 Ingo Schwarze + * Copyright (c) 2010-2022, 2025 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010 Joerg Sonnenberger * @@ -991,18 +991,39 @@ post_ex(POST_ARGS) static void post_lb(POST_ARGS) { - struct roff_node *n; - const char *p; + struct roff_node *n, *nch; + const char *ccp; + char *cp; post_delim_nb(mdoc); n = mdoc->last; - assert(n->child->type == ROFFT_TEXT); + nch = n->child; + assert(nch->type == ROFFT_TEXT); mdoc->next = ROFF_NEXT_CHILD; - if ((p = mdoc_a2lib(n->child->string)) != NULL) { + if (n->sec == SEC_SYNOPSIS) { + roff_word_alloc(mdoc, n->line, n->pos, "/*"); + mdoc->last->flags = NODE_NOSRC; + while (nch != NULL) { + roff_word_alloc(mdoc, n->line, n->pos, "-l"); + mdoc->last->flags = NODE_DELIMO | NODE_NOSRC; + mdoc->last = nch; + assert(nch->type == ROFFT_TEXT); + cp = nch->string; + if (strncmp(cp, "lib", 3) == 0) + memmove(cp, cp + 3, strlen(cp) - 3 + 1); + nch = nch->next; + } + roff_word_alloc(mdoc, n->line, n->pos, "*/"); + mdoc->last->flags = NODE_NOSRC; + mdoc->last = n; + return; + } + + if ((ccp = mdoc_a2lib(n->child->string)) != NULL) { n->child->flags |= NODE_NOPRT; - roff_word_alloc(mdoc, n->line, n->pos, p); + roff_word_alloc(mdoc, n->line, n->pos, ccp); mdoc->last->flags = NODE_NOSRC; mdoc->last = n; return; @@ -3101,6 +3122,6 @@ macro2len(enum roff_tok macro) return 10; default: break; - }; + } return 0; }