summaryrefslogtreecommitdiffstatshomepage
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
commit47256a532d0082f2218355ef2693af7e78d4790b (patch)
tree00dec12ad4755f06ff1b2e1618b7585d607b7d99
parent8acb3c90fb3c3f33d986c8a11474138a497e1ec9 (diff)
downloadmandoc-47256a532d0082f2218355ef2693af7e78d4790b.tar.gz
mandoc-47256a532d0082f2218355ef2693af7e78d4790b.tar.zst
mandoc-47256a532d0082f2218355ef2693af7e78d4790b.zip
Added `Mt' and `Lk' macros (NetBSD).
-rw-r--r--action.c4
-rw-r--r--argv.c6
-rw-r--r--macro.c4
-rw-r--r--mdoc.c4
-rw-r--r--mdoc.h6
-rw-r--r--term.c54
-rw-r--r--validate.c7
7 files changed, 73 insertions, 12 deletions
diff --git a/action.c b/action.c
index bb48c917..b776d9e1 100644
--- a/action.c
+++ b/action.c
@@ -1,4 +1,4 @@
-/* $Id: action.c,v 1.38 2009/03/09 13:17:49 kristaps Exp $ */
+/* $Id: action.c,v 1.39 2009/03/09 14:19:59 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -172,6 +172,8 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL }, /* Lb */
{ NULL }, /* Ap */
{ NULL }, /* Lp */
+ { NULL }, /* Lk */
+ { NULL }, /* Mt */
};
diff --git a/argv.c b/argv.c
index ce7ba9bb..99eb9f86 100644
--- a/argv.c
+++ b/argv.c
@@ -1,4 +1,4 @@
-/* $Id: argv.c,v 1.44 2009/03/09 13:17:49 kristaps Exp $ */
+/* $Id: argv.c,v 1.45 2009/03/09 14:19:59 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -210,7 +210,9 @@ static int mdoc_argflags[MDOC_MAX] = {
0, /* Ud */
0, /* Lb */
0, /* Ap */
- 0, /* Lp */
+ ARGS_DELIM, /* Lp */
+ ARGS_DELIM | ARGS_QUOTED, /* Lk */
+ ARGS_DELIM | ARGS_QUOTED, /* Mt */
};
diff --git a/macro.c b/macro.c
index db537a72..1384d6f6 100644
--- a/macro.c
+++ b/macro.c
@@ -1,4 +1,4 @@
-/* $Id: macro.c,v 1.63 2009/03/09 13:17:49 kristaps Exp $ */
+/* $Id: macro.c,v 1.64 2009/03/09 14:19:59 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -180,6 +180,8 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ macro_constant, 0 }, /* Lb */
{ macro_constant_delimited, MDOC_CALLABLE | MDOC_PARSED }, /* Ap */
{ macro_text, 0 }, /* Lp */
+ { macro_text, MDOC_PARSED }, /* Lk */
+ { macro_text, MDOC_PARSED }, /* Mt */
};
const struct mdoc_macro * const mdoc_macros = __mdoc_macros;
diff --git a/mdoc.c b/mdoc.c
index ff8a3ba4..b45f7802 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.59 2009/03/09 13:35:09 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.60 2009/03/09 14:19:59 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -72,7 +72,7 @@ const char *const __mdoc_macronames[MDOC_MAX] = {
"Fo", "Fc", "Oo", "Oc",
"Bk", "Ek", "Bt", "Hf",
"Fr", "Ud", "Lb", "Ap",
- "Lp"
+ "Lp", "Lk", "Mt"
};
const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
diff --git a/mdoc.h b/mdoc.h
index f79e42ec..069d9e3a 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.44 2009/03/09 13:17:49 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.45 2009/03/09 14:19:59 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -142,7 +142,9 @@
#define MDOC_Lb 106
#define MDOC_Ap 107
#define MDOC_Lp 108
-#define MDOC_MAX 109
+#define MDOC_Lk 109
+#define MDOC_Mt 110
+#define MDOC_MAX 111
/* What follows is a list of ALL possible macro arguments. */
diff --git a/term.c b/term.c
index 0317de85..e129e6f5 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.50 2009/03/09 13:17:49 kristaps Exp $ */
+/* $Id: term.c,v 1.51 2009/03/09 14:19:59 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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);
+}
+
diff --git a/validate.c b/validate.c
index da76fe6e..9e36cb0f 100644
--- a/validate.c
+++ b/validate.c
@@ -1,4 +1,4 @@
-/* $Id: validate.c,v 1.77 2009/03/09 13:17:50 kristaps Exp $ */
+/* $Id: validate.c,v 1.78 2009/03/09 14:19:59 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -137,6 +137,7 @@ static int bwarn_ge1(POST_ARGS);
static int hwarn_eq1(POST_ARGS);
static int ewarn_ge1(POST_ARGS);
static int ebool(POST_ARGS);
+
static int post_an(POST_ARGS);
static int post_at(POST_ARGS);
static int post_bf(POST_ARGS);
@@ -179,12 +180,14 @@ static v_post posts_in[] = { ewarn_eq1, NULL };
static v_post posts_ss[] = { herr_ge1, NULL };
static v_post posts_pf[] = { eerr_eq1, NULL };
static v_post posts_lb[] = { eerr_eq1, NULL };
+static v_post posts_mt[] = { eerr_ge1, NULL };
static v_post posts_st[] = { eerr_eq1, post_st, NULL };
static v_post posts_pp[] = { ewarn_eq0, NULL };
static v_post posts_ex[] = { eerr_eq0, post_ex, NULL };
static v_post posts_an[] = { post_an, NULL };
static v_post posts_at[] = { post_at, NULL };
static v_post posts_xr[] = { eerr_ge1, eerr_le2, NULL };
+static v_post posts_lk[] = { eerr_ge1, NULL };
static v_post posts_nm[] = { post_nm, NULL };
static v_post posts_bf[] = { hwarn_le1, post_bf, NULL };
static v_post posts_rs[] = { herr_eq0, bwarn_ge1, NULL };
@@ -302,6 +305,8 @@ const struct valids mdoc_valids[MDOC_MAX] = {
{ pres_lb, posts_lb }, /* Lb */
{ NULL, NULL }, /* Lb */
{ NULL, posts_pp }, /* Pp */
+ { NULL, posts_lk }, /* Lk */
+ { NULL, posts_mt }, /* Mt */
};