-/* $Id: xml.c,v 1.16 2008/12/05 19:45:15 kristaps Exp $ */
+/* $Id: xml.c,v 1.23 2008/12/10 10:43:57 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
#include <stdlib.h>
#include <string.h>
-#include "libmdocml.h"
#include "private.h"
#include "ml.h"
const struct md_args *,
enum md_ns, int,
const int *, const char **);
+static ssize_t xml_beginstring(struct md_mbuf *,
+ const struct md_args *,
+ const char *, size_t);
+static ssize_t xml_endstring(struct md_mbuf *,
+ const struct md_args *,
+ const char *, size_t);
static int xml_begin(struct md_mbuf *,
const struct md_args *,
const struct tm *,
const char *, const char *,
- const char *, const char *);
+ enum roffmsec, enum roffvol);
static int xml_end(struct md_mbuf *,
const struct md_args *);
static ssize_t xml_printtagname(struct md_mbuf *,
return(0);
assert(argc && argv);
+ /* LINTED */
for (res = 0, i = 0; ROFF_ARGMAX != (c = argc[i]); i++) {
if ( ! ml_nputs(mbuf, " ", 1, &res))
return(-1);
+ /* FIXME: should puke on some, no? */
+
if ( ! ml_puts(mbuf, tokargnames[c], &res))
return(-1);
if ( ! ml_nputs(mbuf, "=\"", 2, &res))
static int
xml_begin(struct md_mbuf *mbuf, const struct md_args *args,
const struct tm *tm, const char *os,
- const char *title, const char *section,
- const char *vol)
+ const char *title, enum roffmsec sec, enum roffvol vol)
{
if ( ! ml_puts(mbuf, "<?xml version=\"1.0\" "
"encoding=\"UTF-8\"?>\n", NULL))
return(0);
return(ml_puts(mbuf, "<mdoc xmlns:block=\"block\" "
- "xmlns:special=\"special\" "
+ "xmlns:body=\"body\" "
+ "xmlns:head=\"head\" "
"xmlns:inline=\"inline\">", NULL));
}
}
+/* ARGSUSED */
+static ssize_t
+xml_beginstring(struct md_mbuf *mbuf,
+ const struct md_args *args,
+ const char *buf, size_t sz)
+{
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static ssize_t
+xml_endstring(struct md_mbuf *mbuf,
+ const struct md_args *args,
+ const char *buf, size_t sz)
+{
+
+ return(0);
+}
+
+
/* ARGSUSED */
static ssize_t
xml_begintag(struct md_mbuf *mbuf, void *data,
xml_alloc(void **p)
{
+ *p = NULL;
return(1);
}
cbs.ml_endtag = xml_endtag;
cbs.ml_begin = xml_begin;
cbs.ml_end = xml_end;
+ cbs.ml_beginstring = xml_beginstring;
+ cbs.ml_endstring = xml_endstring;
return(mlg_alloc(args, rbuf, mbuf, &cbs));
}