aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-04 21:49:39 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-04 21:49:39 +0000
commit67a51824265c8e0d0f41e8cacb1714e5671c7053 (patch)
treea42511e4878a1a70863b6e7ac3faa1e566a072a7
parent12bd5ba1acfc34cc1274b3b3d2c1a9e28978bb6e (diff)
downloadmandoc-67a51824265c8e0d0f41e8cacb1714e5671c7053.tar.gz
mandoc-67a51824265c8e0d0f41e8cacb1714e5671c7053.tar.zst
mandoc-67a51824265c8e0d0f41e8cacb1714e5671c7053.zip
Documented `In' in full.
Fixed `In' to behave properly: it wasn't properly breaking lines, formatting, or really anything else. Noted COMPATIBILITY with OpenBSD's groff, which pukes all over `In'.
-rw-r--r--mdoc.725
-rw-r--r--mdoc_html.c22
-rw-r--r--mdoc_term.c33
-rw-r--r--regress/mdoc/In/in.in24
4 files changed, 66 insertions, 38 deletions
diff --git a/mdoc.7 b/mdoc.7
index f8ae92e6..11d947ff 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.117 2010/06/04 20:57:26 kristaps Exp $
+.\" $Id: mdoc.7,v 1.118 2010/06/04 21:49:39 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@@ -33,7 +33,7 @@ section describes compatibility with other troff \-mdoc implementations.
.Pp
An
.Nm
-document follows simple rules: lines beginning with the control
+document follows simple rules: lines beginning with the control
character
.Sq \.
are parsed for macros. Other lines are interpreted within the scope of
@@ -122,7 +122,7 @@ escape followed by an indicator: B (bold), I, (italic), R (Roman), or P
A numerical representation 3, 2, or 1 (bold, italic, and Roman,
respectively) may be used instead.
A text decoration is valid within
-the current font scope only: if a macro opens a font scope alongside
+the current font scope only: if a macro opens a font scope alongside
its own scope, such as
.Sx \&Bf
.Cm \&Sy ,
@@ -1679,6 +1679,19 @@ and
.Ss \&Hf
.Ss \&Ic
.Ss \&In
+An
+.Qq include
+file.
+In the
+.Em SYNOPSIS
+section (only if invoked as the line macro), the first argument is
+preceded by
+.Qq #include ,
+the arguments is enclosed in angled braces, and a newline is asserted.
+In all other invocations, only angled braces will enclose the argument.
+.Pp
+Examples
+.D1 \&.In sys/types
.Ss \&It
A list item. The syntax of this macro depends on the list type.
.Pp
@@ -2035,6 +2048,12 @@ Heirloom troff, the other significant troff implementation accepting
.Pp
.Bl -dash -compact
.It
+Historic groff formats the
+.Sx \&In
+badly: trailing arguments are trashed and
+.Em SYNOPSIS
+is not specially treated.
+.It
groff does not accept the
.Sq \&Ta
pseudo-macro as a line macro.
diff --git a/mdoc_html.c b/mdoc_html.c
index 4506e127..e3ae9d9a 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.73 2010/06/04 21:05:39 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.74 2010/06/04 21:49:39 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1823,31 +1823,16 @@ mdoc_in_pre(MDOC_ARGS)
struct tag *t;
struct htmlpair tag[2];
int i;
- struct roffsu su;
-
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {
- if (n->next && MDOC_In != n->next->tok) {
- SCALE_VS_INIT(&su, 1);
- bufcat_su(h, "margin-bottom", &su);
- PAIR_STYLE_INIT(&tag[0], h);
- print_otag(h, TAG_DIV, 1, tag);
- } else
- print_otag(h, TAG_DIV, 0, NULL);
- }
-
- /* FIXME: there's a buffer bug in here somewhere. */
PAIR_CLASS_INIT(&tag[0], "includes");
print_otag(h, TAG_SPAN, 1, tag);
- if (SEC_SYNOPSIS == n->sec)
+ if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
print_text(h, "#include");
print_text(h, "<");
h->flags |= HTML_NOSPACE;
- /* XXX -- see warning in termp_in_post(). */
-
for (nn = n->child; nn; nn = nn->next) {
PAIR_CLASS_INIT(&tag[0], "link-includes");
i = 1;
@@ -1865,6 +1850,9 @@ mdoc_in_pre(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
print_text(h, ">");
+ if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
+ print_otag(h, TAG_BR, 0, NULL);
+
return(0);
}
diff --git a/mdoc_term.c b/mdoc_term.c
index 98ce0bbe..2c161d65 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.137 2010/06/04 21:05:39 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.138 2010/06/04 21:49:39 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1847,11 +1847,15 @@ static int
termp_in_pre(DECL_ARGS)
{
- term_fontpush(p, TERMFONT_BOLD);
- if (SEC_SYNOPSIS == n->sec)
+ if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {
+ term_fontpush(p, TERMFONT_BOLD);
term_word(p, "#include");
+ term_word(p, "<");
+ } else {
+ term_word(p, "<");
+ term_fontpush(p, TERMFONT_UNDER);
+ }
- term_word(p, "<");
p->flags |= TERMP_NOSPACE;
return(1);
}
@@ -1862,23 +1866,16 @@ static void
termp_in_post(DECL_ARGS)
{
- term_fontpush(p, TERMFONT_BOLD);
+ if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
+ term_fontpush(p, TERMFONT_BOLD);
+
p->flags |= TERMP_NOSPACE;
term_word(p, ">");
- term_fontpop(p);
-
- if (SEC_SYNOPSIS != n->sec || ! (MDOC_LINE & n->flags))
- return;
- term_newln(p);
- /*
- * XXX Not entirely correct. If `.In foo bar' is specified in
- * the SYNOPSIS section, then it produces a single break after
- * the <foo>; mandoc asserts a vertical space. Since this
- * construction is rarely used, I think it's fine.
- */
- if (n->next && MDOC_In != n->next->tok)
- term_vspace(p);
+ if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {
+ term_fontpop(p);
+ term_newln(p);
+ }
}
diff --git a/regress/mdoc/In/in.in b/regress/mdoc/In/in.in
new file mode 100644
index 00000000..ed89f0b4
--- /dev/null
+++ b/regress/mdoc/In/in.in
@@ -0,0 +1,24 @@
+.\" THIS WILL PUKE HORRIBLY ON OLD GROFF, WHICH HAS COMPLETELY
+.\" DIFFERENT ("BAD") BEHAVIOUR.
+.Dd $Mdocdate: June 4 2010 $
+.Dt FOO 1
+.Os
+.Sh NAME
+.Nm foo
+.Nd bar
+.Sh SYNOPSIS
+1
+.In 2 3
+6
+.In 2 3
+.Qq In 2
+.Fd a
+6
+.In 4
+5
+.Sh DESCRIPTION
+1
+.In 2 3
+6
+.In 4
+5