aboutsummaryrefslogtreecommitdiffstatshomepage
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
commite13ccc532ba5c065e0ead1d88a8e7243d296baf5 (patch)
treed79e0cbd857fecfe80eb9dbee5ec5bf30dd3fa2c
parent338031ae4701478d0057ccc08643c74da3a9eab2 (diff)
downloadmandoc-e13ccc532ba5c065e0ead1d88a8e7243d296baf5.tar.gz
mandoc-e13ccc532ba5c065e0ead1d88a8e7243d296baf5.tar.zst
mandoc-e13ccc532ba5c065e0ead1d88a8e7243d296baf5.zip
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.h3
-rw-r--r--index.sgml14
-rw-r--r--man_html.c5
-rw-r--r--mdoc_html.c7
-rw-r--r--tbl_html.c72
6 files changed, 98 insertions, 9 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 3bce9835..c39658bb 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.36 2010/12/24 14:14:00 kristaps Exp $ */
+/* $Id: html.h,v 1.37 2011/01/04 10:29:41 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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 83e2b18e..02f48d77 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>
@@ -490,7 +502,7 @@
<TR>
<TD>
<DIV CLASS="foot">
- Copyright &#169; 2008&#8211;2010 Kristaps Dzonsons, $Date: 2010/12/24 14:14:00 $
+ Copyright &#169; 2008&#8211;2010 Kristaps Dzonsons, $Date: 2011/01/04 10:29:41 $
</DIV>
</TD>
</TR>
diff --git a/man_html.c b/man_html.c
index 54feada9..f9f72c8d 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.59 2011/01/04 01:23:18 schwarze Exp $ */
+/* $Id: man_html.c,v 1.60 2011/01/04 10:29:41 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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 3cfab636..52169447 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.140 2011/01/01 12:18:37 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.141 2011/01/04 10:29:41 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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..e3c710dc
--- /dev/null
+++ b/tbl_html.c
@@ -0,0 +1,72 @@
+/* $Id: tbl_html.c,v 1.1 2011/01/04 10:29:41 kristaps Exp $ */
+/*
+ * 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;
+}