discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* bug: quoted punctuation behaves strangely
@ 2024-03-12 11:56 Lennart Jablonka
  2024-03-12 13:21 ` Jan Stary
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Jablonka @ 2024-03-12 11:56 UTC (permalink / raw)
  To: discuss

Consider:

	.Pq asdf .
	.Pq asdf "."

The expected output:

	(asdf).  (asdf).

Mandoc’s output:

	(asdf).  (asdf.)
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug: quoted punctuation behaves strangely
  2024-03-12 11:56 bug: quoted punctuation behaves strangely Lennart Jablonka
@ 2024-03-12 13:21 ` Jan Stary
  2024-03-16 13:54   ` Lennart Jablonka
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stary @ 2024-03-12 13:21 UTC (permalink / raw)
  To: discuss

On Mar 12 11:56:39, humm@ljabl.com wrote:
> Consider:
> 
> 	.Pq asdf .
> 	.Pq asdf "."
> 
> The expected output:
> 
> 	(asdf).  (asdf).

If I'm reading mdoc(7) right, this is what the
Delimiters section has to say on that:

        When a macro argument consists of one single input character
        considered as a delimiter, the argument gets special handling.
        This does not apply when delimiters appear in arguments
        containing more than one character.

Your "." (quotes included) contains more than one character,
so it is not a delimiter.

Also, why would you ever do this?

Jan


> Mandoc’s output:
> 
> 	(asdf).  (asdf.)
> --
> To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv
> 
> 
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug: quoted punctuation behaves strangely
  2024-03-12 13:21 ` Jan Stary
@ 2024-03-16 13:54   ` Lennart Jablonka
  0 siblings, 0 replies; 3+ messages in thread
From: Lennart Jablonka @ 2024-03-16 13:54 UTC (permalink / raw)
  To: discuss

Quoth Jan Stary:
>On Mar 12 11:56:39, humm@ljabl.com wrote:
>> Consider:
>>
>> 	.Pq asdf .
>> 	.Pq asdf "."
>>
>> The expected output:
>>
>> 	(asdf).  (asdf).
>
>If I'm reading mdoc(7) right, this is what the
>Delimiters section has to say on that:
>
>        When a macro argument consists of one single input character
>        considered as a delimiter, the argument gets special handling.
>        This does not apply when delimiters appear in arguments
>        containing more than one character.
>
>Your "." (quotes included) contains more than one character,
>so it is not a delimiter.

In the troff language, a macro does not see the quotes surrounding 
an argument.  An argument can be quoted to contain spaces or 
quotes; that’s transparent to the macro.  So here, the argument 
does contain a single character and troff -mdoc treats it that 
way.  (Tested 4.4BSD-Lite2’s -mdoc, OpenBSD’s 
/usr/share/tmac/doc.tmac, and groff -mdoc.)

Further, even if that was not the case, the output would still be 
wrong:

	.Pq asdf \&.
	.Pq asdf "."

results in

	(asdf .) (asdf.)

>Also, why would you ever do this?

You wouldn’t.  And yet I did find it in the wild.
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-16 13:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 11:56 bug: quoted punctuation behaves strangely Lennart Jablonka
2024-03-12 13:21 ` Jan Stary
2024-03-16 13:54   ` Lennart Jablonka

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).