summaryrefslogtreecommitdiffstats
path: root/mdocml.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-12-04 11:25:29 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-12-04 11:25:29 +0000
commitbbaed73e9a14101e88d84225a902613116c536e9 (patch)
tree541891d0a3f52c023f0304922909e40b533d4204 /mdocml.c
parentf0f40906a39936e2d4cd4ddcb8bf4bdb33c2da08 (diff)
downloadmandoc-bbaed73e9a14101e88d84225a902613116c536e9.tar.gz
More html-css.
Diffstat (limited to 'mdocml.c')
-rw-r--r--mdocml.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/mdocml.c b/mdocml.c
index b3031c75..342e3ebb 100644
--- a/mdocml.c
+++ b/mdocml.c
@@ -33,6 +33,12 @@
#define BUFFER_IN_DEF BUFSIZ /* See begin_bufs. */
#define BUFFER_OUT_DEF BUFSIZ /* See begin_bufs. */
+#ifdef DEBUG
+#define CSS "mdocml.css"
+#else
+#define CSS "/usr/local/share/mdocml/mdocml.css"
+#endif
+
static void usage(void);
static int begin_io(const struct md_args *,
@@ -48,20 +54,37 @@ int
main(int argc, char *argv[])
{
int c;
- char *out, *in, *filter;
+ char *out, *in;
struct md_args args;
extern char *optarg;
extern int optind;
- out = in = filter = NULL;
+ out = in = NULL;
(void)memset(&args, 0, sizeof(struct md_args));
-
- while (-1 != (c = getopt(argc, argv, "f:o:vW")))
+
+ args.type = MD_XML;
+
+ while (-1 != (c = getopt(argc, argv, "c:ef:o:vW")))
switch (c) {
+ case ('c'):
+ if (args.type != MD_HTML)
+ errx(1, "-c only valid for -fhtml");
+ args.params.html.css = optarg;
+ break;
+ case ('e'):
+ if (args.type != MD_HTML)
+ errx(1, "-e only valid for -fhtml");
+ args.params.html.flags |= HTML_CSS_EMBED;
+ break;
case ('f'):
- filter = optarg;
+ if (0 == strcmp(optarg, "html"))
+ args.type = MD_HTML;
+ else if (0 == strcmp(optarg, "xml"))
+ args.type = MD_XML;
+ else
+ errx(1, "invalid filter type");
break;
case ('o'):
out = optarg;
@@ -77,22 +100,16 @@ main(int argc, char *argv[])
return(1);
}
+ if (MD_HTML == args.type)
+ if (NULL == args.params.html.css)
+ args.params.html.css = CSS;
+
argv += optind;
argc -= optind;
if (1 == argc)
in = *argv++;
- if (filter) {
- if (0 == strcmp(filter, "html"))
- args.type = MD_HTML;
- else if (0 == strcmp(filter, "xml"))
- args.type = MD_XML;
- else
- errx(1, "invalid filter type");
- } else
- args.type = MD_XML;
-
return(begin_io(&args, out ? out : "-", in ? in : "-"));
}