summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-08-13 12:15:58 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-08-13 12:15:58 +0000
commit86fcbc2e37c7ce462902083265822b79401cecf7 (patch)
treeacc4eb25892b2f8176493981716d21c84a3b8952
parentf7add3eaf5bbb4a516a7dc5a828444b82ea8cd2d (diff)
downloadmandoc-86fcbc2e37c7ce462902083265822b79401cecf7.tar.gz
mandoc-86fcbc2e37c7ce462902083265822b79401cecf7.tar.zst
mandoc-86fcbc2e37c7ce462902083265822b79401cecf7.zip
Added full `HP' libman macro support.
-rw-r--r--man.728
-rw-r--r--man_term.c39
2 files changed, 58 insertions, 9 deletions
diff --git a/man.7 b/man.7
index 40d6543c..0bb26bc7 100644
--- a/man.7
+++ b/man.7
@@ -1,4 +1,4 @@
-.\" $Id: man.7,v 1.22 2009/08/13 11:45:29 kristaps Exp $
+.\" $Id: man.7,v 1.23 2009/08/13 12:15:58 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -262,7 +262,7 @@ and
This section is a canonical reference to all macros, arranged
alphabetically. For the scoping of individual macros, see
.Sx MACRO SYNTAX .
-.Bl -tag -width Ds -offset indent
+.Bl -tag -width Ds
.It \&B
Text is rendered in bold face.
.It \&BI
@@ -281,6 +281,8 @@ render in italics. Whitespace between arguments is omitted in output.
Text is rendered alternately in bold face and roman (the default font).
Whitespace between arguments is omitted in output.
.It \&HP
+Begin a paragraph whose initial output line is left-justified, but
+subsequent output lines are indented.
.\" TODO.
.It \&I
Text is rendered in italics.
@@ -363,9 +365,23 @@ macro.
.El
.\" SECTION
.Sh COMPATIBILITY
-See
-.Xr mdoc 7
-for groff compatibility notes.
+This section documents compatibility with other roff implementations, at
+this time limited to
+.Xr groff 1 .
+.Bl -hyphen
+.It
+In quoted literals, groff allowed pair-wise double-quotes to produce a
+standalone double-quote in formatted output. This idiosyncratic
+behaviour is no longer applicable.
+.It
+The
+.Sq \&sp
+macro does not accept negative numbers.
+.It
+Blocks of whitespace are stripped from both macro and free-form text
+lines (except when in literal mode), while groff would retain whitespace
+in free-form text lines.
+.El
.\" SECTION
.Sh SEE ALSO
.Xr mandoc 1 ,
@@ -374,7 +390,7 @@ for groff compatibility notes.
.Sh AUTHORS
The
.Nm
-utility was written by
+reference was written by
.An Kristaps Dzonsons Aq kristaps@kth.se .
.\" SECTION
.Sh CAVEATS
diff --git a/man_term.c b/man_term.c
index 63528761..4d411f24 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.19 2009/08/13 11:45:29 kristaps Exp $ */
+/* $Id: man_term.c,v 1.20 2009/08/13 12:15:58 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -66,6 +66,7 @@ static int pre_sp(DECL_ARGS);
static void post_B(DECL_ARGS);
static void post_I(DECL_ARGS);
+static void post_HP(DECL_ARGS);
static void post_SH(DECL_ARGS);
static void post_SS(DECL_ARGS);
static void post_i(DECL_ARGS);
@@ -80,7 +81,7 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_PP, NULL }, /* PP */
{ pre_PP, NULL }, /* P */
{ pre_IP, NULL }, /* IP */
- { pre_HP, NULL }, /* HP */
+ { pre_HP, post_HP }, /* HP */
{ NULL, NULL }, /* SM */
{ pre_B, post_B }, /* SB */
{ pre_BI, NULL }, /* BI */
@@ -407,12 +408,44 @@ static int
pre_HP(DECL_ARGS)
{
- /* TODO */
+ switch (n->type) {
+ case (MAN_BLOCK):
+ fmt_block_vspace(p, n);
+ break;
+ case (MAN_BODY):
+ p->flags |= TERMP_NOBREAK;
+ p->flags |= TERMP_TWOSPACE;
+ p->offset = INDENT;
+ p->rmargin = INDENT * 2;
+ break;
+ default:
+ return(0);
+ }
+
return(1);
}
/* ARGSUSED */
+static void
+post_HP(DECL_ARGS)
+{
+
+ switch (n->type) {
+ case (MAN_BODY):
+ term_flushln(p);
+ p->flags &= ~TERMP_NOBREAK;
+ p->flags &= ~TERMP_TWOSPACE;
+ p->offset = INDENT;
+ p->rmargin = p->maxrmargin;
+ break;
+ default:
+ break;
+ }
+}
+
+
+/* ARGSUSED */
static int
pre_PP(DECL_ARGS)
{