summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-09 14:19:59 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-09 14:19:59 +0000
commite5a9cad1c94b10a303a391c74d8b4dd29c494cce (patch)
tree9af1bcf9f9faedf1b3c6a1f29f3507e47d6f0b27 /term.c
parent028cb9cf2041bbee0ed488b669254a2a8bc9ccb9 (diff)
downloadmandoc-e5a9cad1c94b10a303a391c74d8b4dd29c494cce.tar.gz
Added `Mt' and `Lk' macros (NetBSD).
Diffstat (limited to 'term.c')
-rw-r--r--term.c52
1 files changed, 50 insertions, 2 deletions
diff --git a/term.c b/term.c
index 94f1423c..ae0482ba 100644
--- a/term.c
+++ b/term.c
@@ -53,7 +53,9 @@
#define TTYPE_SYMB 16
#define TTYPE_SYMBOL 17
#define TTYPE_DIAG 18
-#define TTYPE_NMAX 19
+#define TTYPE_LINK_ANCHOR 19
+#define TTYPE_LINK_TEXT 20
+#define TTYPE_NMAX 21
/*
* These define "styles" for element types, like command arguments or
@@ -82,7 +84,9 @@ const int ttypes[TTYPE_NMAX] = {
TERMP_BOLD, /* TTYPE_INCLUDE */
TERMP_BOLD, /* TTYPE_SYMB */
TERMP_BOLD, /* TTYPE_SYMBOL */
- TERMP_BOLD /* TTYPE_DIAG */
+ TERMP_BOLD, /* TTYPE_DIAG */
+ TERMP_UNDERLINE, /* TTYPE_LINK_ANCHOR */
+ TERMP_BOLD /* TTYPE_LINK_TEXT */
};
static int arg_hasattr(int, const struct mdoc_node *);
@@ -146,7 +150,9 @@ DECL_PRE(termp_fa);
DECL_PRE(termp_fl);
DECL_PRE(termp_fx);
DECL_PRE(termp_ic);
+DECL_PRE(termp_lk);
DECL_PRE(termp_ms);
+DECL_PRE(termp_mt);
DECL_PRE(termp_nd);
DECL_PRE(termp_nm);
DECL_PRE(termp_ns);
@@ -279,6 +285,8 @@ const struct termact __termacts[MDOC_MAX] = {
{ termp_lb_pre, termp_lb_post }, /* Lb */
{ termp_ap_pre, NULL }, /* Lb */
{ termp_pp_pre, NULL }, /* Pp */
+ { termp_lk_pre, NULL }, /* Lk */
+ { termp_mt_pre, NULL }, /* Mt */
};
const struct termact *termacts = __termacts;
@@ -1747,3 +1755,43 @@ termp____post(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
word(p, node->next ? "," : ".");
}
+
+
+/* ARGSUSED */
+static int
+termp_lk_pre(DECL_ARGS)
+{
+ const struct mdoc_node *n;
+
+ if (NULL == (n = node->child))
+ errx(1, "expected text line argument");
+ if (MDOC_TEXT != n->type)
+ errx(1, "expected text line argument");
+
+ p->flags |= ttypes[TTYPE_LINK_ANCHOR];
+ word(p, n->string);
+ p->flags &= ~ttypes[TTYPE_LINK_ANCHOR];
+ p->flags |= TERMP_NOSPACE;
+ word(p, ":");
+
+ p->flags |= ttypes[TTYPE_LINK_TEXT];
+ for ( ; n; n = n->next) {
+ if (MDOC_TEXT != n->type)
+ errx(1, "expected text line argument");
+ word(p, n->string);
+ }
+ p->flags &= ~ttypes[TTYPE_LINK_TEXT];
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+termp_mt_pre(DECL_ARGS)
+{
+
+ TERMPAIR_SETFLAG(p, pair, ttypes[TTYPE_LINK_ANCHOR]);
+ return(1);
+}
+