* mdocml: Documented `In' in full.
@ 2010-06-04 21:49 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-06-04 21:49 UTC (permalink / raw)
To: source
Log Message:
-----------
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'.
Modified Files:
--------------
mdocml:
mdoc_term.c
mdoc_html.c
mdoc.7
Added Files:
-----------
mdocml/regress/mdoc/In:
in.in
Revision Data
-------------
--- /dev/null
+++ 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
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.73 -r1.74
--- mdoc_html.c
+++ mdoc_html.c
@@ -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;
@@ -1864,6 +1849,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);
}
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.137 -r1.138
--- mdoc_term.c
+++ mdoc_term.c
@@ -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);
+ }
}
Index: mdoc.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.7,v
retrieving revision 1.117
retrieving revision 1.118
diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.117 -r1.118
--- mdoc.7
+++ mdoc.7
@@ -33,7 +33,7 @@ section describes compatibility with oth
.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
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
@@ -2034,6 +2047,12 @@ Heirloom troff, the other significant tr
\-mdoc, is similar to historic groff.
.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
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-04 21:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-04 21:49 mdocml: Documented `In' in full kristaps
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).