From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hz1.yz.to (hz1.yz.to [178.63.61.147]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id f8cc3118 for ; Mon, 13 Mar 2017 04:42:16 -0500 (EST) Received: from [172.17.6.34] (unknown [146.0.121.193]) by hz1.yz.to (Postfix) with ESMTPSA id 38331817C329; Mon, 13 Mar 2017 10:42:09 +0100 (CET) Subject: Re: Links into HTML page would be great To: discuss@mdocml.bsd.lv, schwarze@usta.de References: <8ffc686a-f898-4952-ae6f-3b8881469f17@thomas-guettler.de> <20170312180832.GE69791@athene.usta.de> <20170312193940.GA91520@athene.usta.de> From: =?UTF-8?Q?Thomas_G=c3=bcttler?= Message-ID: <0dbf9b44-499d-dabc-f759-17c5a0f2f6da@thomas-guettler.de> Date: Mon, 13 Mar 2017 10:42:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 In-Reply-To: <20170312193940.GA91520@athene.usta.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Wow, this link works now - great :-) http://man.openbsd.org/OpenBSD-current/man5/ssh_config.5#ServerAliveInterval Sometimes it is like paradise. You just need to speak out your whish. Thank you! Am 12.03.2017 um 20:39 schrieb Ingo Schwarze: > Hi, > > Ingo Schwarze wrote on Sun, Mar 12, 2017 at 07:08:32PM +0100: >> Thomas Guettler wrote on Tue, Feb 28, 2017 at 03:33:00PM +0100: > >>> it would be great if you could create a link which points to this: >>> http://man.openbsd.org/OpenBSD-current/man5/ssh_config.5#ServerAliveInterval > >> You have a point. > >>> I have no clue how nroff works. I guess it is not easy to implement. > >> You may be wrong, it is likely not difficult. > > It turns out to be even easier than i anticipated. > > Here is a proof-of-concept patch that i just installed on man.openbsd.org. > For now, it only does .Cm, merely because that's what Thomas used as > his example, and also because it is one of the macros where this is > useful. > > If people speak up here who like that, or if i come to the > conclusion that i like it myself (which seems likely), > i will probably add support for some more macros, probably > .Ev .Fl .Ic .Ms .Dv .Li .No .Er .Sy .Em , > do some polishing (for example making sure the tag contains no > invalid characters), then commit it in a few days. > > The two macros .Fn and .Fd are slightly more tricky and may need > a bit of deliberation, but are probably feasible, too. > > At first, i was a bit worried because what exactly such a tagging > facility will tag may not be completely stable over time. But then > it occurred to me that really isn't a big deal. I mean, even if > some external deep links sometimes go dead due to algorithmic changes, > we are not worse off than right now. Even if those links are never > updated, they still point to the right page, only to the beginning > of it. > > Yours, > Ingo > > > Index: mdoc_html.c > =================================================================== > RCS file: /cvs/src/usr.bin/mandoc/mdoc_html.c,v > retrieving revision 1.148 > diff -u -p -r1.148 mdoc_html.c > --- mdoc_html.c 3 Mar 2017 13:55:06 -0000 1.148 > +++ mdoc_html.c 12 Mar 2017 19:23:54 -0000 > @@ -46,6 +46,7 @@ struct htmlmdoc { > void (*post)(MDOC_ARGS); > }; > > +static const char *cond_id(const struct roff_node *); > static char *make_id(const struct roff_node *); > static void print_mdoc_head(MDOC_ARGS); > static void print_mdoc_node(MDOC_ARGS); > @@ -496,6 +497,22 @@ make_id(const struct roff_node *n) > return buf; > } > > +static const char * > +cond_id(const struct roff_node *n) > +{ > + if (n->child != NULL && > + n->child->type == ROFFT_TEXT && > + (n->prev == NULL || > + (n->prev->type == ROFFT_TEXT && > + strcmp(n->prev->string, "|") == 0)) && > + (n->parent->tok == MDOC_It || > + (n->parent->tok == MDOC_Xo && > + n->parent->parent->prev == NULL && > + n->parent->parent->parent->tok == MDOC_It))) > + return n->child->string; > + return NULL; > +} > + > static int > mdoc_sh_pre(MDOC_ARGS) > { > @@ -549,7 +566,7 @@ mdoc_fl_pre(MDOC_ARGS) > static int > mdoc_cm_pre(MDOC_ARGS) > { > - print_otag(h, TAG_B, "c", "Cm"); > + print_otag(h, TAG_B, "ci", "Cm", cond_id(n)); > return 1; > } > > -- > To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv > -- Thomas Guettler http://www.thomas-guettler.de/ -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv