diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2013-10-17 20:54:58 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2013-10-17 20:54:58 +0000 |
commit | a24894c279cda3d965668a3548d070489a8aceed (patch) | |
tree | 802cd2c3ea9060f30b957ad4a052608a76fe9b4a /man_html.c | |
parent | 9680b7282e62aa4b1c49f8ee927df097cbe37246 (diff) | |
download | mandoc-a24894c279cda3d965668a3548d070489a8aceed.tar.gz |
Implement the .UR/.UE block (uniform resource identifier) introduced in the
man-ext macros by Eric S. Raymond, enabled by default in groff_man(7).
Usual disclaimer: You don't write new man(7) code, so you are not going
to use these, either.
Improves e.g. the bzr(1) and etherape(1) manuals.
Thanks to naddy@ for bringing these to my attention.
Diffstat (limited to 'man_html.c')
-rw-r--r-- | man_html.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -1,6 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> + * Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -70,6 +71,7 @@ static int man_RS_pre(MAN_ARGS); static int man_SH_pre(MAN_ARGS); static int man_SM_pre(MAN_ARGS); static int man_SS_pre(MAN_ARGS); +static int man_UR_pre(MAN_ARGS); static int man_alt_pre(MAN_ARGS); static int man_br_pre(MAN_ARGS); static int man_ign_pre(MAN_ARGS); @@ -115,6 +117,8 @@ static const struct htmlman mans[MAN_MAX] = { { man_OP_pre, NULL }, /* OP */ { man_literal_pre, NULL }, /* EX */ { man_literal_pre, NULL }, /* EE */ + { man_UR_pre, NULL }, /* UR */ + { NULL, NULL }, /* UE */ }; /* @@ -688,3 +692,27 @@ man_RS_pre(MAN_ARGS) print_otag(h, TAG_DIV, 1, &tag); return(1); } + +/* ARGSUSED */ +static int +man_UR_pre(MAN_ARGS) +{ + struct htmlpair tag[2]; + + n = n->child; + assert(MAN_HEAD == n->type); + if (n->nchild) { + assert(MAN_TEXT == n->child->type); + PAIR_CLASS_INIT(&tag[0], "link-ext"); + PAIR_HREF_INIT(&tag[1], n->child->string); + print_otag(h, TAG_A, 2, tag); + } + + assert(MAN_BODY == n->next->type); + if (n->next->nchild) + n = n->next; + + print_man_nodelist(man, n->child, mh, h); + + return(0); +} |