-/* $Id: mdoc_html.c,v 1.50 2010/01/01 13:17:58 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.54 2010/01/30 08:42:20 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
* 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 <sys/types.h>
-#include <sys/param.h>
#include <assert.h>
#include <ctype.h>
const struct mdoc_node *n, \
struct html *h
+#ifndef MIN
+#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b))
+#endif
+
struct htmlmdoc {
int (*pre)(MDOC_ARGS);
void (*post)(MDOC_ARGS);
static int mdoc_xr_pre(MDOC_ARGS);
static int mdoc_xx_pre(MDOC_ARGS);
-#ifdef __linux__
-extern size_t strlcpy(char *, const char *, size_t);
-extern size_t strlcat(char *, const char *, size_t);
-#endif
-
static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_ap_pre, NULL}, /* Ap */
{NULL, NULL}, /* Dd */
h = (struct html *)arg;
- print_gen_doctype(h);
+ print_gen_decls(h);
t = print_otag(h, TAG_HTML, 0, NULL);
print_mdoc(mdoc_meta(m), mdoc_node(m), h);
print_tagq(h, t);
{
struct htmlpair tag;
+ PAIR_CLASS_INIT(&tag, "flag");
+ print_otag(h, TAG_SPAN, 1, &tag);
+
/* `Cm' has no leading hyphen. */
- if (MDOC_Cm == n->tok) {
- PAIR_CLASS_INIT(&tag, "flag");
- print_otag(h, TAG_SPAN, 1, &tag);
+ if (MDOC_Cm == n->tok)
return(1);
- }
-
- /* A zero-length child shouldn't get a dash. */
-
- if (n->child) {
- assert(MDOC_TEXT == n->child->type);
- assert(n->child->string);
- if ('\0' == *n->child->string)
- return(0);
- }
-
- PAIR_CLASS_INIT(&tag, "flag");
- print_otag(h, TAG_SPAN, 1, &tag);
print_text(h, "\\-");
struct htmlpair tag;
struct roffsu su;
- if (SEC_SYNOPSIS == n->sec) {
+ if (MDOC_BLOCK == n->type) {
if (n->prev && MDOC_Vt != n->prev->tok) {
SCALE_VS_INIT(&su, 1);
bufcat_su(h, "margin-top", &su);
print_otag(h, TAG_DIV, 1, &tag);
} else
print_otag(h, TAG_DIV, 0, NULL);
- }
+
+ return(1);
+ } else if (MDOC_HEAD == n->type)
+ return(0);
PAIR_CLASS_INIT(&tag, "type");
print_otag(h, TAG_SPAN, 1, &tag);