summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-04 10:29:41 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-04 10:29:41 +0000
commit26beb70c0c977cb0ac61d2120a952e854ed7a277 (patch)
treea344faaf85604e907510653cf60c4e5050e037f8
parent41394e59b698fac5412e3a0f5405a777debd033f (diff)
downloadmandoc-26beb70c0c977cb0ac61d2120a952e854ed7a277.tar.gz
Add skeleton for -T[x]html tbl stuff. Also start to put in some bits about
the up-coming version, although we're not quite there yet.
-rw-r--r--Makefile6
-rw-r--r--html.h1
-rw-r--r--index.sgml12
-rw-r--r--man_html.c3
-rw-r--r--mdoc_html.c5
-rw-r--r--tbl_html.c72
6 files changed, 94 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b79f493e..13cb9e3e 100644
--- a/Makefile
+++ b/Makefile
@@ -66,15 +66,15 @@ MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \
compat.ln man_term.ln html.ln mdoc_html.ln \
man_html.ln out.ln term_ps.ln term_ascii.ln \
- tbl_term.ln
+ tbl_term.ln tbl_html.ln
MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
man_term.o html.o mdoc_html.o man_html.o out.o \
- term_ps.o term_ascii.o tbl_term.o
+ term_ps.o term_ascii.o tbl_term.o tbl_html.o
MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
man_term.c html.c mdoc_html.c man_html.c out.c \
- term_ps.c term_ascii.c tbl_term.c
+ term_ps.c term_ascii.c tbl_term.c tbl_html.c
LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln \
llib-llibmandoc.ln llib-llibroff.ln
diff --git a/html.h b/html.h
index 2a955115..e5d3b14e 100644
--- a/html.h
+++ b/html.h
@@ -138,6 +138,7 @@ struct tag *print_otag(struct html *, enum htmltag,
void print_tagq(struct html *, const struct tag *);
void print_stagq(struct html *, const struct tag *);
void print_text(struct html *, const char *);
+void print_tbl(struct html *, const struct tbl_span *);
void bufcat_su(struct html *, const char *,
const struct roffsu *);
diff --git a/index.sgml b/index.sgml
index 92892b02..495a6106 100644
--- a/index.sgml
+++ b/index.sgml
@@ -327,6 +327,18 @@
</H1>
<DIV CLASS="news">
<P>
+ <SPAN CLASS="date">03-01-2011</SPAN>:
+ version 1.10.9
+ </P>
+ <P>
+ Table functionality (see the <A HREF="roff.7.html#x5c265453">roff</A> manual) has been
+ merged from <A CLASS="external" HREF="http://tbl.bsd.lv">tbl.bsd.lv</A>. Many back-end
+ fixes have also been implemented, primarily in argument handling (quoting) and <A
+ HREF="man.7.html">man</A> documents.
+ </P>
+ </DIV>
+ <DIV CLASS="news">
+ <P>
<SPAN CLASS="date">24-12-2010</SPAN>:
version 1.10.8
</P>
diff --git a/man_html.c b/man_html.c
index fa21a402..02031e20 100644
--- a/man_html.c
+++ b/man_html.c
@@ -202,7 +202,8 @@ print_man_node(MAN_ARGS)
print_otag(h, TAG_BR, 0, NULL);
return;
case (MAN_TBL):
- return;
+ print_tbl(h, n->span);
+ break;
default:
/*
* Close out scope of font prior to opening a macro
diff --git a/mdoc_html.c b/mdoc_html.c
index bb2d0b3f..093b5607 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -423,7 +423,8 @@ print_mdoc_node(MDOC_ARGS)
print_text(h, n->string);
return;
case (MDOC_TBL):
- return;
+ print_tbl(h, n->span);
+ break;
default:
if (mdocs[n->tok].pre && ENDBODY_NOT == n->end)
child = (*mdocs[n->tok].pre)(m, n, h);
@@ -452,6 +453,8 @@ print_mdoc_node(MDOC_ARGS)
case (MDOC_ROOT):
mdoc_root_post(m, n, h);
break;
+ case (MDOC_TBL):
+ break;
default:
if (mdocs[n->tok].post && ENDBODY_NOT == n->end)
(*mdocs[n->tok].post)(m, n, h);
diff --git a/tbl_html.c b/tbl_html.c
new file mode 100644
index 00000000..b892060f
--- /dev/null
+++ b/tbl_html.c
@@ -0,0 +1,72 @@
+/* $Id$ */
+/*
+ * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mandoc.h"
+#include "out.h"
+#include "html.h"
+
+void
+print_tbl(struct html *h, const struct tbl_span *sp)
+{
+ const struct tbl_head *hp;
+ const struct tbl_dat *dp;
+ struct tag *tt;
+
+ switch (sp->pos) {
+ case (TBL_SPAN_HORIZ):
+ /* FALLTHROUGH */
+ case (TBL_SPAN_DHORIZ):
+ return;
+ default:
+ break;
+ }
+
+ /* Inhibit printing of spaces: we do padding ourselves. */
+
+ h->flags |= HTML_NONOSPACE;
+ h->flags |= HTML_NOSPACE;
+
+ print_otag(h, TAG_TABLE, 0, NULL);
+ print_otag(h, TAG_TR, 0, NULL);
+
+ dp = sp->first;
+ for (hp = sp->head; hp; hp = hp->next) {
+ switch (hp->pos) {
+ case (TBL_HEAD_VERT):
+ /* FALLTHROUGH */
+ case (TBL_HEAD_DVERT):
+ continue;
+ case (TBL_HEAD_DATA):
+ break;
+ }
+ tt = print_otag(h, TAG_TD, 0, NULL);
+ if (dp) {
+ print_text(h, dp->string);
+ dp = dp->next;
+ }
+ print_tagq(h, tt);
+ }
+ h->flags &= ~HTML_NONOSPACE;
+}