aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--man_html.c99
-rw-r--r--man_term.c5
-rw-r--r--mdoc_html.c19
3 files changed, 107 insertions, 16 deletions
diff --git a/man_html.c b/man_html.c
index 059f2392..1924db41 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.2 2009/10/03 15:08:09 kristaps Exp $ */
+/* $Id: man_html.c,v 1.3 2009/10/03 19:57:53 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -23,9 +23,104 @@
#include "html.h"
#include "man.h"
+#define MAN_ARGS const struct man_meta *m, \
+ const struct man_node *n, \
+ struct html *h
+
+struct htmlman {
+ int (*pre)(MAN_ARGS);
+ int (*post)(MAN_ARGS);
+};
+
+
+static void print_man(MAN_ARGS);
+static void print_man_head(MAN_ARGS);
+
+
+static const struct htmlman mans[MAN_MAX] = {
+ { NULL, NULL }, /* br */
+ { NULL, NULL }, /* TH */
+ { NULL, NULL }, /* SH */
+ { NULL, NULL }, /* SS */
+ { NULL, NULL }, /* TP */
+ { NULL, NULL }, /* LP */
+ { NULL, NULL }, /* PP */
+ { NULL, NULL }, /* P */
+ { NULL, NULL }, /* IP */
+ { NULL, NULL }, /* HP */
+ { NULL, NULL }, /* SM */
+ { NULL, NULL }, /* SB */
+ { NULL, NULL }, /* BI */
+ { NULL, NULL }, /* IB */
+ { NULL, NULL }, /* BR */
+ { NULL, NULL }, /* RB */
+ { NULL, NULL }, /* R */
+ { NULL, NULL }, /* B */
+ { NULL, NULL }, /* I */
+ { NULL, NULL }, /* IR */
+ { NULL, NULL }, /* RI */
+ { NULL, NULL }, /* na */
+ { NULL, NULL }, /* i */
+ { NULL, NULL }, /* sp */
+ { NULL, NULL }, /* nf */
+ { NULL, NULL }, /* fi */
+ { NULL, NULL }, /* r */
+ { NULL, NULL }, /* RE */
+ { NULL, NULL }, /* RS */
+ { NULL, NULL }, /* DT */
+ { NULL, NULL }, /* UC */
+};
+
-/* ARGSUSED */
void
html_man(void *arg, const struct man *m)
{
+ struct html *h;
+ struct tag *t;
+
+ h = (struct html *)arg;
+
+ print_gen_doctype(h);
+
+ t = print_otag(h, TAG_HTML, 0, NULL);
+ print_man(man_meta(m), man_node(m), h);
+ print_tagq(h, t);
+
+ printf("\n");
+}
+
+
+static void
+print_man(MAN_ARGS)
+{
+ struct tag *t;
+ struct htmlpair tag;
+
+ t = print_otag(h, TAG_HEAD, 0, NULL);
+
+ print_man_head(m, n, h);
+ print_tagq(h, t);
+ t = print_otag(h, TAG_BODY, 0, NULL);
+
+ tag.key = ATTR_CLASS;
+ tag.val = "body";
+ print_otag(h, TAG_DIV, 1, &tag);
+
+ /*print_man_nodelist(m, n, h);*/
+
+ print_tagq(h, t);
+}
+
+
+/* ARGSUSED */
+static void
+print_man_head(MAN_ARGS)
+{
+
+ print_gen_head(h);
+ bufinit(h);
+ buffmt(h, "%s(%d)", m->title, m->msec);
+
+ print_otag(h, TAG_TITLE, 0, NULL);
+ print_text(h, h->buf);
}
diff --git a/man_term.c b/man_term.c
index b5b6891c..8093b7ab 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.31 2009/09/16 09:41:24 kristaps Exp $ */
+/* $Id: man_term.c,v 1.32 2009/10/03 19:57:53 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -91,7 +91,7 @@ static void post_SS(DECL_ARGS);
static void post_TP(DECL_ARGS);
static void post_i(DECL_ARGS);
-static const struct termact termacts[MAN_MAX] = {
+static const struct termact termacts[MAN_MAX] = {
{ pre_br, NULL }, /* br */
{ NULL, NULL }, /* TH */
{ pre_SH, post_SH }, /* SH */
@@ -160,6 +160,7 @@ man_run(struct termp *p, const struct man *m)
static void
+
fmt_block_vspace(struct termp *p, const struct man_node *n)
{
term_newln(p);
diff --git a/mdoc_html.c b/mdoc_html.c
index 7b472aeb..2a0b1529 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.19 2009/10/03 19:02:45 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.20 2009/10/03 19:57:53 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -35,9 +35,6 @@
#define MDOC_ARGS const struct mdoc_meta *m, \
const struct mdoc_node *n, \
struct html *h
-#define MAN_ARGS const struct man_meta *m, \
- const struct man_node *n, \
- struct html *h
struct htmlmdoc {
int (*pre)(MDOC_ARGS);
@@ -385,21 +382,19 @@ print_mdoc(MDOC_ARGS)
static void
print_mdoc_head(MDOC_ARGS)
{
- char b[BUFSIZ];
print_gen_head(h);
-
- (void)snprintf(b, BUFSIZ - 1,
- "%s(%d)", m->title, m->msec);
+ bufinit(h);
+ buffmt(h, "%s(%d)", m->title, m->msec);
if (m->arch) {
- (void)strlcat(b, " (", BUFSIZ);
- (void)strlcat(b, m->arch, BUFSIZ);
- (void)strlcat(b, ")", BUFSIZ);
+ bufcat(h, " (");
+ bufcat(h, m->arch);
+ bufcat(h, ")");
}
print_otag(h, TAG_TITLE, 0, NULL);
- print_text(h, b);
+ print_text(h, h->buf);
}