discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: "Thomas Güttler" <guettliml@thomas-guettler.de>
To: discuss@mdocml.bsd.lv, schwarze@usta.de
Subject: Re: Links into HTML page would be great
Date: Mon, 13 Mar 2017 10:59:24 +0100	[thread overview]
Message-ID: <52d83eb6-052a-0f71-5c01-650956753c76@thomas-guettler.de> (raw)
In-Reply-To: <0dbf9b44-499d-dabc-f759-17c5a0f2f6da@thomas-guettler.de>

I discovered, that this works for systemd man page, too:

https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=

I am unsure, but I think this is new.

The above systemd page makes it easy for you to create a link inclusive "#....". If you click
on this sign ¶, then your browser gets pointed to this part in the page.... nice.

Thank you for your support.

Regards,
   Thomas

Am 13.03.2017 um 10:42 schrieb Thomas Güttler:
> 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

  parent reply	other threads:[~2017-03-13  9:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 14:33 Thomas Güttler
2017-03-12 18:08 ` Ingo Schwarze
2017-03-12 19:39   ` Ingo Schwarze
2017-03-13  9:42     ` Thomas Güttler
2017-03-13  9:56       ` Jan Stary
2017-03-14  1:49         ` Ingo Schwarze
2017-03-14  9:39         ` Jan Stary
2017-03-14 17:17           ` Ingo Schwarze
2017-03-13  9:59       ` Thomas Güttler [this message]
2017-03-13 15:32         ` Ingo Schwarze
2017-03-13 21:35       ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52d83eb6-052a-0f71-5c01-650956753c76@thomas-guettler.de \
    --to=guettliml@thomas-guettler.de \
    --cc=discuss@mdocml.bsd.lv \
    --cc=schwarze@usta.de \
    --subject='Re: Links into HTML page would be great' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).