From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: implement -Tman .Bd -offset and -compact; OpenBSD rev.
Date: Sat, 7 Jul 2012 09:46:59 -0400 (EDT) [thread overview]
Message-ID: <201207071346.q67DkxYt005679@krisdoz.my.domain> (raw)
Log Message:
-----------
implement -Tman .Bd -offset and -compact; OpenBSD rev. 1.8
Modified Files:
--------------
mdocml:
mdoc_man.c
Revision Data
-------------
Index: mdoc_man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.10 -r1.11
--- mdoc_man.c
+++ mdoc_man.c
@@ -1,6 +1,6 @@
/* $Id$ */
/*
- * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -22,6 +22,7 @@
#include <string.h>
#include "mandoc.h"
+#include "out.h"
#include "man.h"
#include "mdoc.h"
#include "main.h"
@@ -68,6 +69,7 @@ static int pre_sect(DECL_ARGS);
static int pre_ux(DECL_ARGS);
static int pre_xr(DECL_ARGS);
static void print_word(struct mman *, const char *);
+static void print_offs(struct mman *, const char *);
static void print_node(DECL_ARGS);
static const struct manact manacts[MDOC_MAX + 1] = {
@@ -245,6 +247,29 @@ print_word(struct mman *mm, const char *
}
}
+static void
+print_offs(struct mman *mm, const char *v)
+{
+ char buf[24];
+ struct roffsu su;
+ size_t sz;
+
+ if (NULL == v || '\0' == *v || 0 == strcmp(v, "left"))
+ sz = 0;
+ else if (0 == strcmp(v, "indent"))
+ sz = 6;
+ else if (0 == strcmp(v, "indent-two"))
+ sz = 12;
+ else if (a2roffsu(v, &su, SCALE_MAX)) {
+ print_word(mm, v);
+ return;
+ } else
+ sz = strlen(v);
+
+ snprintf(buf, sizeof(buf), "%ldn", sz);
+ print_word(mm, buf);
+}
+
void
man_man(void *arg, const struct man *man)
{
@@ -445,12 +470,19 @@ static int
pre_bd(DECL_ARGS)
{
+ if (0 == n->norm->Bd.comp) {
+ mm->need_nl = 1;
+ print_word(mm, ".sp");
+ }
if (DISP_unfilled == n->norm->Bd.type ||
DISP_literal == n->norm->Bd.type) {
mm->need_nl = 1;
print_word(mm, ".nf");
}
mm->need_nl = 1;
+ print_word(mm, ".RS");
+ print_offs(mm, n->norm->Bd.offs);
+ mm->need_nl = 1;
return(1);
}
@@ -458,6 +490,8 @@ static void
post_bd(DECL_ARGS)
{
+ mm->need_nl = 1;
+ print_word(mm, ".RE");
if (DISP_unfilled == n->norm->Bd.type ||
DISP_literal == n->norm->Bd.type) {
mm->need_nl = 1;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2012-07-07 13:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201207071346.q67DkxYt005679@krisdoz.my.domain \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).