summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-12-10 13:41:58 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-12-10 13:41:58 +0000
commite4c3f51da30c67c5fb30b0b90af2f55a8631af37 (patch)
tree16f9b89ca563ecf456a0ea40ebc31036c0afe0b4
parent4787a4142e096d18cc8d1664421833e0e38bcb83 (diff)
downloadmandoc-e4c3f51da30c67c5fb30b0b90af2f55a8631af37.tar.gz
Sx to Sh anchors work.
-rw-r--r--Makefile2
-rw-r--r--html.c30
-rw-r--r--index.74
-rw-r--r--mlg.c41
-rw-r--r--roff.c9
5 files changed, 78 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 4494c3c5..d44977ae 100644
--- a/Makefile
+++ b/Makefile
@@ -42,7 +42,7 @@ SUCCEED = test.7 test.8 test.9 test.10 test.11 test.12 test.13 \
test.35 test.38 test.39 test.41 test.42 test.43 test.44 \
test.45 test.46 test.47 test.48 test.49 test.51 test.52 \
test.54 test.55 test.56 test.57 test.58 test.59 test.60 \
- test.62 test.63 test.67 test.68 test.71
+ test.62 test.63 test.67 test.68 test.71 test.72 test.73
all: mdocml
diff --git a/html.c b/html.c
index 6cc0c41a..c6c406b2 100644
--- a/html.c
+++ b/html.c
@@ -764,6 +764,25 @@ html_inlinetagargs(struct md_mbuf *mbuf,
return(0);
switch (tok) {
+ case (ROFF_Sh):
+
+ /* FIXME: use API in ml.h. */
+
+ assert(*argv);
+ if ( ! ml_nputs(mbuf, " name=\"", 7, res))
+ return(0);
+ if ( ! ml_putstring(mbuf, *argv++, res))
+ return(0);
+ while (*argv) {
+ if ( ! ml_putstring(mbuf, "_", res))
+ return(0);
+ if ( ! ml_putstring(mbuf, *argv++, res))
+ return(0);
+ }
+ if ( ! ml_nputs(mbuf, "\"", 1, res))
+ return(0);
+ break;
+
case (ROFF_Sx):
/* FIXME: use API in ml.h. */
@@ -771,10 +790,17 @@ html_inlinetagargs(struct md_mbuf *mbuf,
assert(*argv);
if ( ! ml_nputs(mbuf, " href=\"#", 8, res))
return(0);
- if ( ! ml_putstring(mbuf, *argv, res))
+ if ( ! ml_putstring(mbuf, *argv++, res))
return(0);
+ while (*argv) {
+ if ( ! ml_putstring(mbuf, "_", res))
+ return(0);
+ if ( ! ml_putstring(mbuf, *argv++, res))
+ return(0);
+ }
if ( ! ml_nputs(mbuf, "\"", 1, res))
return(0);
+
break;
default:
break;
@@ -791,6 +817,8 @@ html_inlinetagname(struct md_mbuf *mbuf,
{
switch (tok) {
+ case (ROFF_Sh):
+ return(html_stput(mbuf, HTML_TAG_A, res));
case (ROFF_Pp):
return(html_stput(mbuf, HTML_TAG_DIV, res));
case (ROFF_Sx):
diff --git a/index.7 b/index.7
index 62c38261..974b259d 100644
--- a/index.7
+++ b/index.7
@@ -22,6 +22,10 @@ and
is a full macro parser operating on source documents, specifically mdoc,
validating input and compiling to HTML and XML output types.
.Pp
+Downloads (source and ports) are available in the
+.Sx DOWNLOADS
+section.
+.Pp
The
.Nm
utility is tested specifically on
diff --git a/mlg.c b/mlg.c
index 33b99593..3e9f78be 100644
--- a/mlg.c
+++ b/mlg.c
@@ -92,6 +92,10 @@ static int mlg_function_special(struct md_mlg *,
const char *, const char **);
static int mlg_atom_special(struct md_mlg *, int,
const char *, const char **);
+static int mlg_link_special(struct md_mlg *, int,
+ const char *, const char **);
+static int mlg_anchor_special(struct md_mlg *,
+ int, const char **);
static int mlg_begintag(struct md_mlg *, enum md_ns,
int, int *, const char **);
@@ -534,7 +538,6 @@ mlg_atom_special(struct md_mlg *p, int tok,
if ( ! mlg_string(p, start, *more++))
return(0);
- /*assert(NULL == *more);*/ /* FIXME: ROFF_Sx */
return(mlg_endtag(p, MD_NS_INLINE, tok));
}
@@ -583,6 +586,34 @@ mlg_function_special(struct md_mlg *p,
}
+static int
+mlg_anchor_special(struct md_mlg *p, int tok, const char **more)
+{
+ if ( ! mlg_begintag(p, MD_NS_INLINE, tok, NULL, more))
+ return(0);
+ return(mlg_endtag(p, MD_NS_INLINE, tok));
+}
+
+
+static int
+mlg_link_special(struct md_mlg *p, int tok,
+ const char *start, const char **more)
+{
+
+ if ( ! mlg_begintag(p, MD_NS_INLINE, tok, NULL, more))
+ return(0);
+ if ( ! mlg_string(p, start, *more++))
+ return(0);
+ while (*more) {
+ if ( ! mlg_string(p, start, " "))
+ return(0);
+ if ( ! mlg_string(p, start, *more++))
+ return(0);
+ }
+ return(mlg_endtag(p, MD_NS_INLINE, tok));
+}
+
+
/* ARGSUSED */
static int
mlg_roffspecial(void *arg, int tok, const char *start,
@@ -611,9 +642,13 @@ mlg_roffspecial(void *arg, int tok, const char *start,
case (ROFF_Xr):
return(mlg_ref_special(p, tok, start, more));
+
+ case (ROFF_Sh):
+ return(mlg_anchor_special(p, tok, more));
- case (ROFF_Sx): /* FIXME */
- /* FALLTHROUGH */
+ case (ROFF_Sx):
+ return(mlg_link_special(p, tok, start, more));
+
case (ROFF_Nm):
return(mlg_atom_special(p, tok, start, more));
diff --git a/roff.c b/roff.c
index 8420b597..218b362c 100644
--- a/roff.c
+++ b/roff.c
@@ -38,7 +38,6 @@
/* TODO: (warn) some sections need specific elements. */
/* TODO: (warn) NAME section has particular order. */
/* TODO: macros with a set number of arguments? */
-/* TODO: validate Dt macro arguments. */
/* FIXME: Bl -diag supposed to ignore callable children. */
struct roffnode {
@@ -1166,7 +1165,7 @@ static int
roff_layout(ROFFCALL_ARGS)
{
int i, c, argcp[ROFF_MAXLINEARG];
- char *argvp[ROFF_MAXLINEARG];
+ char *argvp[ROFF_MAXLINEARG], *p;
/*
* The roff_layout function is for multi-line macros. A layout
@@ -1192,7 +1191,7 @@ roff_layout(ROFFCALL_ARGS)
return((*tree->cb.roffblkout)(tree->arg, tok));
}
- argv++;
+ p = *argv++;
assert( ! (ROFF_CALLABLE & tokens[tok].flags));
if ( ! roffparseopts(tree, tok, &argv, argcp, argvp))
@@ -1249,6 +1248,10 @@ roff_layout(ROFFCALL_ARGS)
return(0);
tree->asec |= tree->csec;
+
+ if ( ! roffspecial(tree, tok, p, argcp,
+ (const char **)argvp, 0, argv))
+ return(0);
break;
default:
break;