summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-10-09 15:59:08 +0000
committerschwarze <schwarze@openbsd.org>2014-10-09 15:59:08 +0000
commita3108a0a5cf9406eb1a0c601e030ce036c88793d (patch)
treee267dc3cb3983fcb4f46e0d805fc621902979c60
parentinitial bits of MathML rendering for eqn(7) -Thtml; (diff)
downloadwireguard-openbsd-a3108a0a5cf9406eb1a0c601e030ce036c88793d.tar.xz
wireguard-openbsd-a3108a0a5cf9406eb1a0c601e030ce036c88793d.zip
parse and render "from" and "to" clauses in eqn, and render matrices;
written by kristaps@ during EuroBSDCon
-rw-r--r--usr.bin/mandoc/eqn.c8
-rw-r--r--usr.bin/mandoc/eqn_html.c18
-rw-r--r--usr.bin/mandoc/html.c5
-rw-r--r--usr.bin/mandoc/html.h5
-rw-r--r--usr.bin/mandoc/mandoc.h5
5 files changed, 32 insertions, 9 deletions
diff --git a/usr.bin/mandoc/eqn.c b/usr.bin/mandoc/eqn.c
index 64c7b15adca..fe49244c2b5 100644
--- a/usr.bin/mandoc/eqn.c
+++ b/usr.bin/mandoc/eqn.c
@@ -1,6 +1,6 @@
-/* $Id: eqn.c,v 1.12 2014/10/09 15:21:46 schwarze Exp $ */
+/* $Id: eqn.c,v 1.13 2014/10/09 15:59:08 schwarze Exp $ */
/*
- * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -587,6 +587,10 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last)
NULL != last->last->prev &&
EQNPOS_SUB == last->last->prev->pos)
last->last->prev->pos = EQNPOS_SUBSUP;
+ else if (EQNPOS_TO == i &&
+ NULL != last->last->prev &&
+ EQNPOS_FROM == last->last->prev->pos)
+ last->last->prev->pos = EQNPOS_FROMTO;
else
last->last->pos = (enum eqn_post)i;
diff --git a/usr.bin/mandoc/eqn_html.c b/usr.bin/mandoc/eqn_html.c
index 004b7457cf4..8c75cb5e6ae 100644
--- a/usr.bin/mandoc/eqn_html.c
+++ b/usr.bin/mandoc/eqn_html.c
@@ -1,4 +1,4 @@
-/* $Id: eqn_html.c,v 1.3 2014/10/09 15:49:09 schwarze Exp $ */
+/* $Id: eqn_html.c,v 1.4 2014/10/09 15:59:08 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -84,6 +84,11 @@ eqn_box(struct html *p, const struct eqn_box *bp, int next)
pilet = print_otag(p, TAG_MTR, 0, NULL);
print_otag(p, TAG_MTD, 0, NULL);
}
+ if (NULL != bp->parent && bp->parent->type == EQN_MATRIX) {
+ pilet = print_otag(p, TAG_MTABLE, 0, NULL);
+ print_otag(p, TAG_MTR, 0, NULL);
+ print_otag(p, TAG_MTD, 0, NULL);
+ }
/*
* If we're establishing a pile, start the table mode now.
@@ -103,19 +108,26 @@ eqn_box(struct html *p, const struct eqn_box *bp, int next)
* single or double following expression.
*/
switch (bp->pos) {
+ case (EQNPOS_TO):
+ post = print_otag(p, TAG_MOVER, 0, NULL);
+ break;
case (EQNPOS_SUP):
post = print_otag(p, TAG_MSUP, 0, NULL);
break;
case (EQNPOS_FROM):
- /* FALLTHROUGH */
+ post = print_otag(p, TAG_MUNDER, 0, NULL);
+ break;
case (EQNPOS_SUB):
post = print_otag(p, TAG_MSUB, 0, NULL);
break;
case (EQNPOS_OVER):
post = print_otag(p, TAG_MFRAC, 0, NULL);
break;
+ case (EQNPOS_FROMTO):
+ post = print_otag(p, TAG_MUNDEROVER, 0, NULL);
+ skiptwo = 1;
+ break;
case (EQNPOS_SUBSUP):
- /* This requires two elements. */
post = print_otag(p, TAG_MSUBSUP, 0, NULL);
skiptwo = 1;
break;
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index ab0015cbbdd..bf84e3e6422 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.43 2014/10/09 15:49:09 schwarze Exp $ */
+/* $Id: html.c,v 1.44 2014/10/09 15:59:08 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -85,6 +85,9 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"mtable", 0}, /* TAG_MTABLE */
{"mtr", 0}, /* TAG_MTR */
{"mtd", 0}, /* TAG_MTD */
+ {"munderover", 0}, /* TAG_MUNDEROVER */
+ {"munder", 0}, /* TAG_MUNDER*/
+ {"mover", 0}, /* TAG_MOVER*/
};
static const char *const htmlattrs[ATTR_MAX] = {
diff --git a/usr.bin/mandoc/html.h b/usr.bin/mandoc/html.h
index f7b97d06f18..9e3f97c6e6e 100644
--- a/usr.bin/mandoc/html.h
+++ b/usr.bin/mandoc/html.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.h,v 1.26 2014/10/09 15:49:09 schwarze Exp $ */
+/* $OpenBSD: html.h,v 1.27 2014/10/09 15:59:08 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -63,6 +63,9 @@ enum htmltag {
TAG_MTABLE,
TAG_MTR,
TAG_MTD,
+ TAG_MUNDEROVER,
+ TAG_MUNDER,
+ TAG_MOVER,
TAG_MAX
};
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index c1c873dfba3..c79d99fa6f8 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,6 +1,6 @@
-/* $OpenBSD: mandoc.h,v 1.101 2014/10/09 15:21:46 schwarze Exp $ */
+/* $OpenBSD: mandoc.h,v 1.102 2014/10/09 15:59:08 schwarze Exp $ */
/*
- * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -340,6 +340,7 @@ enum eqn_post {
EQNPOS_SUB,
EQNPOS_TO,
EQNPOS_FROM,
+ EQNPOS_FROMTO,
EQNPOS__MAX
};