summaryrefslogtreecommitdiffstatshomepage
path: root/mlg.c
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
commitd49b74004ed6d2134c947f8d4f978ab2c1de3a1d (patch)
tree912f5b540e3c30b824da6555687df2152eebf7cc /mlg.c
parent100d3bda4585670cac59ef74d9d74b9d35dbf2ec (diff)
downloadmandoc-d49b74004ed6d2134c947f8d4f978ab2c1de3a1d.tar.gz
mandoc-d49b74004ed6d2134c947f8d4f978ab2c1de3a1d.tar.zst
mandoc-d49b74004ed6d2134c947f8d4f978ab2c1de3a1d.zip
Sx to Sh anchors work.
Diffstat (limited to 'mlg.c')
-rw-r--r--mlg.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/mlg.c b/mlg.c
index 546217a6..31ec43d9 100644
--- a/mlg.c
+++ b/mlg.c
@@ -1,4 +1,4 @@
-/* $Id: mlg.c,v 1.27 2008/12/10 12:09:47 kristaps Exp $ */
+/* $Id: mlg.c,v 1.28 2008/12/10 13:41:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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));