From 5328a945994f66136b209f8e2c717cb969c7f013 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 | 9 +++++++-- mdoc.c | 6 ++++-- mdoc.h | 5 +++-- mdoc_action.c | 3 ++- mdoc_argv.c | 3 ++- mdoc_html.c | 5 ++++- mdoc_macro.c | 3 ++- mdoc_term.c | 5 ++++- mdoc_validate.c | 5 ++++- 9 files changed, 32 insertions(+), 12 deletions(-) diff --git a/mdoc.7 b/mdoc.7 index 091e8b99..47410dc5 100644 --- a/mdoc.7 +++ b/mdoc.7 @@ -1,4 +1,4 @@ -.\" $Id: mdoc.7,v 1.68 2009/10/22 10:36:20 kristaps Exp $ +.\" $Id: mdoc.7,v 1.69 2009/10/24 05:52:13 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 22 2009 $ +.Dd $Mdocdate: October 24 2009 $ .Dt MDOC 7 .Os . @@ -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 9db754ee..e4f76c03 100644 --- a/mdoc.c +++ b/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.109 2009/10/15 02:56:51 kristaps Exp $ */ +/* $Id: mdoc.c,v 1.110 2009/10/24 05:52:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 eabffcbc..8691db80 100644 --- a/mdoc.h +++ b/mdoc.h @@ -1,4 +1,4 @@ -/* $Id: mdoc.h,v 1.70 2009/10/15 01:33:12 kristaps Exp $ */ +/* $Id: mdoc.h,v 1.71 2009/10/24 05:52:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 da44e937..52533b23 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.42 2009/10/22 17:54:24 kristaps Exp $ */ +/* $Id: mdoc_action.c,v 1.43 2009/10/24 05:52:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 a8119c1e..9ed4d68a 100644 --- a/mdoc_argv.c +++ b/mdoc_argv.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_argv.c,v 1.29 2009/10/19 09:40:23 kristaps Exp $ */ +/* $Id: mdoc_argv.c,v 1.30 2009/10/24 05:52:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 74d06cff..5dbad7c2 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.36 2009/10/22 18:55:32 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.37 2009/10/24 05:52:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 66e5faf0..c9e69fbd 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.36 2009/09/20 17:24:57 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.37 2009/10/24 05:52:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 d427c1d0..bda0a669 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.94 2009/10/22 18:55:32 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.95 2009/10/24 05:52:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 77cdd396..f8e58afc 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.49 2009/10/22 10:35:33 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.50 2009/10/24 05:52:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 v1.2.3-56-ge451