On Jun 16 02:36:40, hacke...@member.fsf.org wrote:
> Ingo Schwarze <schwa...@usta.de> wrote:
> 
> > >> You say mdoc; shouldn't the links be Lk?
> > 
> > In mdoc(7): yes, absolutely.
> > Use .Lk in mdoc(7), .UR is not supported by mdoc(7) at all.
> 
> Thank you, Ingo, for letting me know that. I'll use Lk if I can figure
> out how to get it to format my text so it looks as nice as UR/UE, but
> I'm not sure it can. The BSD documentation for mdoc states that groff
> misformats Lk, so perhaps that is the problem.
> 
> There are three issues. First, Lk always adds a new line so I can't
> have a reference in the middle of a sentence.

That seems to depend on implementation. For example,
the ancient groff 1.19.2 that comes with the most recent MacOS
doas add a newline; the 1.22.4 that comes with OpenBSD doesn't,
and mandoc doesn't.

Here is a minimal example I am using:

.Dd June 16, 2020
.Dt LINKS 1
.Os
.Sh NAME
.Nm links
.Nd typeset links in mdoc documents
.Sh DESCRIPTION
The home page is
.Lk http://www.frijid.net/madness/madness.html
so go visit it now.

Attached please see the PDF output of groff 1.22.4 and mandoc 1.14.5;
neither of them adds a newline before or after the clickable link.

> Second, it always adds a
> colon after the link text, so it changes my grammatical meaning.

Being a macro of mdoc, I believe the inteded use is as in

  .Sh SEE ALSO
  .Lk https://www.gnu.org/software/groff/ the groff homepage

I agree that the output can interfere with the grammar
of straight running prose, as opposed to a list of links.

> Third, and worst of all, it then prints out the entire URL without
> wrapping, exceeding the right margin for long URLs.

How do you suggest a long URL should be typeset?
It's an honest question: I don't know. It seems weird
to e.g. hyphenate words in URLs, as in http://some.compli-
cated.doma.in/file.html

> So, if I set a 32 column width as a demonstration and use Lk like so:
> 
>       The main home page for the x86 port of Madness is
>       .Lk http://www.frijid.net/madness/madness.html \
>       http://www.frijid.net/\:madness/\:madness.html

I find it artificial to use the same URL both as the linked text
and the link itself, but I guess your point is that URLs can be
so long they wrap. Yes they can. What does UR/UE
(not suppported in mdoc) do about it?

> It comes out as:
>       |<---------------------------32->|
>       The main home page for the
>       x86 port of Madness is
>       http://www.frijid.net/madness/
>       madness.html:
>       http://www.frijid.net/madness/madness.html
>       |<---------------------------32->|
> 
> Note that these problems with Lk occur in both the nroff and PDF
> output from groff.

> > but i suggest a different perspective. Decide what it is that you
> > really want: if you want excellent typography from an mdoc(7)
> > document, use groff(1) PDF output.
> 
> Just nroff and PDF with very basic links. No need for HTML at the moment.

The recent groff seems to do that.

        Jan

Attachment: links-groff.pdf
Description: Adobe PDF document

Attachment: links-mandoc.pdf
Description: Adobe PDF document

Reply via email to