just like the default right margin already is. This may be useful for
people with expensive screen real estate. Besides, it helps automated
man(7) to mdoc(7) output comparisons to validate -Tman output.
ok kristaps@ on an earlier version
-/* $Id: man_term.c,v 1.121 2011/09/21 09:57:13 schwarze Exp $ */
+/* $Id: man_term.c,v 1.122 2011/11/13 13:15:14 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
#include "term.h"
#include "main.h"
#include "term.h"
#include "main.h"
-#define INDENT 7 /* fixed-width char full-indent */
-#define HALFINDENT 3 /* fixed-width char half-indent */
#define MAXMARGINS 64 /* maximum number of indented scopes */
/* FIXME: have PD set the default vspace width. */
#define MAXMARGINS 64 /* maximum number of indented scopes */
/* FIXME: have PD set the default vspace width. */
+ if (0 == p->defindent)
+ p->defindent = 7;
+
p->overstep = 0;
p->maxrmargin = p->defrmargin;
p->tabwidth = term_len(p, 5);
p->overstep = 0;
p->maxrmargin = p->defrmargin;
p->tabwidth = term_len(p, 5);
memset(&mt, 0, sizeof(struct mtermp));
memset(&mt, 0, sizeof(struct mtermp));
- mt.lmargin[mt.lmargincur] = term_len(p, INDENT);
- mt.offset = term_len(p, INDENT);
+ mt.lmargin[mt.lmargincur] = term_len(p, p->defindent);
+ mt.offset = term_len(p, p->defindent);
if (n->child)
print_man_nodelist(p, &mt, n->child, m);
if (n->child)
print_man_nodelist(p, &mt, n->child, m);
switch (n->type) {
case (MAN_BLOCK):
switch (n->type) {
case (MAN_BLOCK):
- mt->lmargin[mt->lmargincur] = term_len(p, INDENT);
+ mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
print_bvspace(p, n);
break;
default:
print_bvspace(p, n);
break;
default:
switch (n->type) {
case (MAN_BLOCK):
mt->fl &= ~MANT_LITERAL;
switch (n->type) {
case (MAN_BLOCK):
mt->fl &= ~MANT_LITERAL;
- mt->lmargin[mt->lmargincur] = term_len(p, INDENT);
- mt->offset = term_len(p, INDENT);
+ mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
+ mt->offset = term_len(p, p->defindent);
/* If following a prior empty `SS', no vspace. */
if (n->prev && MAN_SS == n->prev->tok)
if (NULL == n->prev->body->child)
/* If following a prior empty `SS', no vspace. */
if (n->prev && MAN_SS == n->prev->tok)
if (NULL == n->prev->body->child)
break;
case (MAN_HEAD):
term_fontrepl(p, TERMFONT_BOLD);
break;
case (MAN_HEAD):
term_fontrepl(p, TERMFONT_BOLD);
- p->offset = term_len(p, HALFINDENT);
+ p->offset = term_len(p, p->defindent/2);
break;
case (MAN_BODY):
p->offset = mt->offset;
break;
case (MAN_BODY):
p->offset = mt->offset;
switch (n->type) {
case (MAN_BLOCK):
mt->fl &= ~MANT_LITERAL;
switch (n->type) {
case (MAN_BLOCK):
mt->fl &= ~MANT_LITERAL;
- mt->lmargin[mt->lmargincur] = term_len(p, INDENT);
- mt->offset = term_len(p, INDENT);
+ mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
+ mt->offset = term_len(p, p->defindent);
/* If following a prior empty `SH', no vspace. */
if (n->prev && MAN_SH == n->prev->tok)
if (NULL == n->prev->body->child)
/* If following a prior empty `SH', no vspace. */
if (n->prev && MAN_SH == n->prev->tok)
if (NULL == n->prev->body->child)
- sz = term_len(p, INDENT);
+ sz = term_len(p, p->defindent);
if (NULL != (n = n->parent->head->child))
if ((ival = a2width(p, n->string)) >= 0)
if (NULL != (n = n->parent->head->child))
if ((ival = a2width(p, n->string)) >= 0)
- sz = term_len(p, INDENT);
+ sz = term_len(p, p->defindent);
if (NULL != (n = n->parent->head->child))
if ((ival = a2width(p, n->string)) >= 0)
if (NULL != (n = n->parent->head->child))
if ((ival = a2width(p, n->string)) >= 0)
-.\" $Id: mandoc.1,v 1.97 2011/10/09 21:37:06 schwarze Exp $
+.\" $Id: mandoc.1,v 1.98 2011/11/13 13:15:14 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 9 2011 $
+.Dd $Mdocdate: November 13 2011 $
.Dt MANDOC 1
.Os
.Sh NAME
.Dt MANDOC 1
.Os
.Sh NAME
.Fl O
arguments are accepted:
.Bl -tag -width Ds
.Fl O
arguments are accepted:
.Bl -tag -width Ds
+.It Cm indent Ns = Ns Ar indent
+The left margin for normal text is set to
+.Ar indent
+blank characters instead of the default of five for
+.Xr mdoc 7
+and seven for
+.Xr man 7 .
+Increasing this is not recommended; it may result in degraded formatting,
+for example overful lines or ugly line breaks.
.It Cm width Ns = Ns Ar width
The output width is set to
.Ar width ,
.It Cm width Ns = Ns Ar width
The output width is set to
.Ar width ,
-/* $Id: mdoc_term.c,v 1.237 2011/11/03 20:36:59 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.238 2011/11/13 13:15:14 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
#include "mdoc.h"
#include "main.h"
#include "mdoc.h"
#include "main.h"
-#define INDENT 5
-#define HALFINDENT 3
-
struct termpair {
struct termpair *ppair;
int count;
struct termpair {
struct termpair *ppair;
int count;
+ if (0 == p->defindent)
+ p->defindent = 5;
+
p->overstep = 0;
p->maxrmargin = p->defrmargin;
p->tabwidth = term_len(p, 5);
p->overstep = 0;
p->maxrmargin = p->defrmargin;
p->tabwidth = term_len(p, 5);
else if (0 == strcmp(v, "left"))
return(0);
else if (0 == strcmp(v, "indent"))
else if (0 == strcmp(v, "left"))
return(0);
else if (0 == strcmp(v, "indent"))
- return(term_len(p, INDENT + 1));
+ return(term_len(p, p->defindent + 1));
else if (0 == strcmp(v, "indent-two"))
else if (0 == strcmp(v, "indent-two"))
- return(term_len(p, (INDENT + 1) * 2));
+ return(term_len(p, (p->defindent + 1) * 2));
else if ( ! a2roffsu(v, &su, SCALE_MAX))
SCALE_HS_INIT(&su, term_strlen(p, v));
else if ( ! a2roffsu(v, &su, SCALE_MAX))
SCALE_HS_INIT(&su, term_strlen(p, v));
term_fontpush(p, TERMFONT_BOLD);
break;
case (MDOC_BODY):
term_fontpush(p, TERMFONT_BOLD);
break;
case (MDOC_BODY):
- p->offset = term_len(p, INDENT);
+ p->offset = term_len(p, p->defindent);
if (MDOC_BLOCK != n->type)
return(1);
term_newln(p);
if (MDOC_BLOCK != n->type)
return(1);
term_newln(p);
- p->offset += term_len(p, (INDENT + 1));
+ p->offset += term_len(p, p->defindent + 1);
break;
case (MDOC_HEAD):
term_fontpush(p, TERMFONT_BOLD);
break;
case (MDOC_HEAD):
term_fontpush(p, TERMFONT_BOLD);
- p->offset = term_len(p, HALFINDENT);
+ p->offset = term_len(p, (p->defindent+1)/2);
-/* $Id: term.h,v 1.88 2011/09/19 22:36:16 schwarze Exp $ */
+/* $Id: term.h,v 1.89 2011/11/13 13:15:14 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
struct termp {
enum termtype type;
struct rofftbl tbl; /* table configuration */
struct termp {
enum termtype type;
struct rofftbl tbl; /* table configuration */
+ size_t defindent; /* Default indent for text. */
size_t defrmargin; /* Right margin of the device. */
size_t rmargin; /* Current right margin. */
size_t maxrmargin; /* Max right margin. */
size_t defrmargin; /* Right margin of the device. */
size_t rmargin; /* Current right margin. */
size_t maxrmargin; /* Max right margin. */
-/* $Id: term_ascii.c,v 1.18 2011/09/18 14:14:15 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.19 2011/11/13 13:15:14 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
static struct termp *
ascii_init(enum termenc enc, char *outopts)
{
static struct termp *
ascii_init(enum termenc enc, char *outopts)
{
char *v;
struct termp *p;
char *v;
struct termp *p;
- toks[0] = "width";
- toks[1] = NULL;
+ toks[0] = "indent";
+ toks[1] = "width";
+ toks[2] = NULL;
while (outopts && *outopts)
switch (getsubopt(&outopts, UNCONST(toks), &v)) {
case (0):
while (outopts && *outopts)
switch (getsubopt(&outopts, UNCONST(toks), &v)) {
case (0):
+ p->defindent = (size_t)atoi(v);
+ break;
+ case (1):
p->defrmargin = (size_t)atoi(v);
break;
default:
p->defrmargin = (size_t)atoi(v);
break;
default: