summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-06-22 12:04:05 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-06-22 12:04:05 +0000
commit74605f6540401164e8a214ee34d6de4094e5347f (patch)
tree27dfc45ed0a3d335bbcf0158183a24709339b8e9 /mdoc_term.c
parent947f73805b11d9580b0ab9b7cbca918f44567314 (diff)
downloadmandoc-74605f6540401164e8a214ee34d6de4094e5347f.tar.gz
mandoc-74605f6540401164e8a214ee34d6de4094e5347f.tar.zst
mandoc-74605f6540401164e8a214ee34d6de4094e5347f.zip
Added "Spacing" part of "Punctuation and Spacing" in mandoc.1 manual.
Fixed `Ds' meta-macro default width. Fixed -width and -offset "indent", "indent-two", and "left" widths. Fixed -width and -offset literal-word and numeric widths. Fixed off-by-one errors in whitespace output (schwarze@openbsd.org).
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 2f55a2e0..92e2ca87 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.15 2009/06/17 18:42:42 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.16 2009/06/22 12:04:05 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -533,9 +533,9 @@ arg_width(const struct mdoc_argv *arg, int pos)
assert(pos < (int)arg->sz && pos >= 0);
assert(arg->value[pos]);
if (0 == strcmp(arg->value[pos], "indent"))
- return(INDENT);
+ return(INDENT + 3);
if (0 == strcmp(arg->value[pos], "indent-two"))
- return(INDENT * 2);
+ return(INDENT * 2 + 2);
if (0 == (len = (int)strlen(arg->value[pos])))
return(0);
@@ -545,13 +545,14 @@ arg_width(const struct mdoc_argv *arg, int pos)
break;
if (i == len - 1) {
- if ('n' == arg->value[pos][len - 1]) {
+ if ('n' == arg->value[pos][len - 1] ||
+ 'm' == arg->value[pos][len - 1]) {
v = (size_t)atoi(arg->value[pos]);
- return(v);
+ return(v + 2);
}
}
- return(strlen(arg->value[pos]) + 1);
+ return(strlen(arg->value[pos]) + 2);
}
@@ -603,9 +604,9 @@ arg_offset(const struct mdoc_argv *arg)
assert(*arg->value);
if (0 == strcmp(*arg->value, "left"))
- return(0);
+ return(INDENT - 1);
if (0 == strcmp(*arg->value, "indent"))
- return(INDENT);
+ return(INDENT + 1);
if (0 == strcmp(*arg->value, "indent-two"))
return(INDENT * 2);
@@ -1340,7 +1341,8 @@ termp_d1_pre(DECL_ARGS)
if (MDOC_BLOCK != node->type)
return(1);
term_newln(p);
- p->offset += (pair->offset = INDENT);
+ pair->offset = INDENT + 1;
+ p->offset += pair->offset;
return(1);
}