From 24ca6b6c497fdd0db41b4dcd4172e20ee02df76e Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 24 Oct 2009 05:52:13 +0000 Subject: Added `%U' to -mdoc (doesn't render in a nice way yet). --- mdoc.7 | 5 +++++ mdoc.c | 4 +++- mdoc.h | 3 ++- mdoc_action.c | 1 + mdoc_argv.c | 1 + mdoc_html.c | 3 +++ mdoc_macro.c | 1 + mdoc_term.c | 3 +++ mdoc_validate.c | 3 +++ 9 files changed, 22 insertions(+), 2 deletions(-) diff --git a/mdoc.7 b/mdoc.7 index b2c099ab..9e5d69d3 100644 --- a/mdoc.7 +++ b/mdoc.7 @@ -611,8 +611,10 @@ then the macro accepts an arbitrary number of arguments. .It Sx \&%N Ta \&No Ta \&No Ta >0 .It Sx \&%O Ta \&No Ta \&No Ta >0 .It Sx \&%P Ta \&No Ta \&No Ta >0 +.It Sx \&%Q Ta \&No Ta \&No Ta >0 .It Sx \&%R Ta \&No Ta \&No Ta >0 .It Sx \&%T Ta \&No Ta \&No Ta >0 +.It Sx \&%U Ta \&No Ta \&No Ta >0 .It Sx \&%V Ta \&No Ta \&No Ta >0 .It Sx \&Ad Ta Yes Ta Yes Ta n .It Sx \&An Ta Yes Ta Yes Ta n @@ -756,6 +758,9 @@ Article title of an block. This macro may also be used in a non-bibliographical context when referring to article titles. . +.Ss \&%U +URI of current document. +. .Ss \&%V Volume number of an .Sx \&Rs diff --git a/mdoc.c b/mdoc.c index 1f7ca31f..e153c0dd 100644 --- a/mdoc.c +++ b/mdoc.c @@ -116,7 +116,9 @@ const char *const __mdoc_macronames[MDOC_MAX] = { /* LINTED */ "Brc", "\%C", "Es", "En", /* LINTED */ - "Dx", "\%Q", "br", "sp" + "Dx", "\%Q", "br", "sp", + /* LINTED */ + "\%U" }; const char *const __mdoc_argnames[MDOC_ARG_MAX] = { diff --git a/mdoc.h b/mdoc.h index a6deac65..553a425a 100644 --- a/mdoc.h +++ b/mdoc.h @@ -149,7 +149,8 @@ #define MDOC__Q 117 #define MDOC_br 118 #define MDOC_sp 119 -#define MDOC_MAX 120 +#define MDOC__U 120 +#define MDOC_MAX 121 /* What follows is a list of ALL possible macro arguments. */ diff --git a/mdoc_action.c b/mdoc_action.c index b9d11289..83fa5835 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -186,6 +186,7 @@ static const struct actions mdoc_actions[MDOC_MAX] = { { NULL, NULL }, /* %Q */ { NULL, NULL }, /* br */ { NULL, NULL }, /* sp */ + { NULL, NULL }, /* %U */ }; #define RSORD_MAX 13 diff --git a/mdoc_argv.c b/mdoc_argv.c index 47b80ab6..f325d5ba 100644 --- a/mdoc_argv.c +++ b/mdoc_argv.c @@ -203,6 +203,7 @@ static int mdoc_argflags[MDOC_MAX] = { 0, /* %Q */ 0, /* br */ 0, /* sp */ + 0, /* %U */ }; diff --git a/mdoc_html.c b/mdoc_html.c index d0c2ff7c..29dc8849 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -254,6 +254,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = { {mdoc__x_pre, mdoc__x_post}, /* %Q */ {mdoc_sp_pre, NULL}, /* br */ {mdoc_sp_pre, NULL}, /* sp */ + {mdoc__x_pre, mdoc__x_post}, /* %U */ }; @@ -2148,6 +2149,8 @@ mdoc__x_pre(MDOC_ARGS) { struct htmlpair tag; + /* TODO: %U. */ + switch (n->tok) { case(MDOC__A): PAIR_CLASS_INIT(&tag, "ref-auth"); diff --git a/mdoc_macro.c b/mdoc_macro.c index a00ecab7..1d753a80 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -174,6 +174,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { in_line_eoln, 0 }, /* %Q */ { in_line_eoln, 0 }, /* br */ { in_line_eoln, 0 }, /* sp */ + { in_line_eoln, 0 }, /* %U */ }; const struct mdoc_macro * const mdoc_macros = __mdoc_macros; diff --git a/mdoc_term.c b/mdoc_term.c index c59c42b6..7461950a 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -236,6 +236,7 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, termp____post }, /* %Q */ { termp_sp_pre, NULL }, /* br */ { termp_sp_pre, NULL }, /* sp */ + { NULL, termp____post }, /* %U */ }; #ifdef __linux__ @@ -2006,6 +2007,8 @@ static void termp____post(DECL_ARGS) { + /* TODO: %U. */ + p->flags |= TERMP_NOSPACE; switch (n->tok) { case (MDOC__T): diff --git a/mdoc_validate.c b/mdoc_validate.c index 4df96ae4..d9af17ea 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -273,6 +273,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, posts_text }, /* %Q */ { NULL, posts_notext }, /* br */ { NULL, posts_sp }, /* sp */ + { NULL, posts_text }, /* %U */ }; @@ -1155,6 +1156,8 @@ post_rs(POST_ARGS) for (nn = mdoc->last->child; nn; nn = nn->next) switch (nn->tok) { + case(MDOC__U): + /* FALLTHROUGH */ case(MDOC__Q): /* FALLTHROUGH */ case(MDOC__C): -- cgit