* [9front] [PATCH] troff: we are not htmlroff
@ 2021-11-27 19:43 Humm
2021-12-04 23:23 ` Humm
2021-12-05 0:00 ` ori
0 siblings, 2 replies; 11+ messages in thread
From: Humm @ 2021-11-27 19:43 UTC (permalink / raw)
To: 9front
If we don’t explicitly check for ‘h’ in troff, we can’t reliably check
for non-htmlroff well.
Consider the following:
.if h \{\
. de M
. tm m
..\}
Without this change, this will print m and not define macro M.
---
diff 24b9a78ceb63234ef0b0e7d1da0d46119b7a297d c2f89dc6c142284fc3b4c38a4e9fbf5c0c5b2a1d
--- a/sys/src/cmd/troff/n5.c Wed Nov 24 15:41:36 2021
+++ b/sys/src/cmd/troff/n5.c Wed Nov 24 20:56:44 2021
@@ -683,6 +683,7 @@
if (TROFF)
true++;
break;
+ case 'h':
case ' ':
break;
default:
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-11-27 19:43 [9front] [PATCH] troff: we are not htmlroff Humm
@ 2021-12-04 23:23 ` Humm
2021-12-04 23:46 ` Sigrid Solveig Haflínudóttir
2021-12-05 0:46 ` Noam Preil
2021-12-05 0:00 ` ori
1 sibling, 2 replies; 11+ messages in thread
From: Humm @ 2021-12-04 23:23 UTC (permalink / raw)
To: 9front
ping
Anyone willing to look at this, to commit this, to send nice words, to
send any reply at all?
--
Humm
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-04 23:23 ` Humm
@ 2021-12-04 23:46 ` Sigrid Solveig Haflínudóttir
2021-12-05 1:24 ` Humm
2021-12-05 0:46 ` Noam Preil
1 sibling, 1 reply; 11+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2021-12-04 23:46 UTC (permalink / raw)
To: 9front
I tried applying this but all I get is
applying troff: we are not htmlroff
/rc/lib/rcmain: patch failed
/bin/git/import: rc 190991: patch failed
Can you perhaps git/export and send it as an attachment? Thank you.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-11-27 19:43 [9front] [PATCH] troff: we are not htmlroff Humm
2021-12-04 23:23 ` Humm
@ 2021-12-05 0:00 ` ori
1 sibling, 0 replies; 11+ messages in thread
From: ori @ 2021-12-05 0:00 UTC (permalink / raw)
To: 9front
Quoth Humm <hummsmith42@gmail.com>:
>
> If we don’t explicitly check for ‘h’ in troff, we can’t reliably check
> for non-htmlroff well.
>
> Consider the following:
>
> .if h \{\
> . de M
> . tm m
> ..\}
>
> Without this change, this will print m and not define macro M.
> ---
> diff 24b9a78ceb63234ef0b0e7d1da0d46119b7a297d c2f89dc6c142284fc3b4c38a4e9fbf5c0c5b2a1d
> --- a/sys/src/cmd/troff/n5.c Wed Nov 24 15:41:36 2021
> +++ b/sys/src/cmd/troff/n5.c Wed Nov 24 20:56:44 2021
> @@ -683,6 +683,7 @@
> if (TROFF)
> true++;
> break;
> + case 'h':
> case ' ':
> break;
> default:
>
Generally looks ok to me, but I'm not a troff expert.
Was hoping someone a bit more knowlegable would look,
but I'm willing to commit if nobody else pipes up.
thanks for pinging.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-04 23:23 ` Humm
2021-12-04 23:46 ` Sigrid Solveig Haflínudóttir
@ 2021-12-05 0:46 ` Noam Preil
2021-12-05 1:19 ` Noam Preil
2021-12-05 1:19 ` Humm
1 sibling, 2 replies; 11+ messages in thread
From: Noam Preil @ 2021-12-05 0:46 UTC (permalink / raw)
To: 9front
Hey,
htmlroff(6) says to use `.if !h .if t` to check for normal troff. What's
the issue with that approach?
- Noam Preil
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-05 0:46 ` Noam Preil
@ 2021-12-05 1:19 ` Noam Preil
2021-12-05 2:36 ` Humm
2021-12-05 1:19 ` Humm
1 sibling, 1 reply; 11+ messages in thread
From: Noam Preil @ 2021-12-05 1:19 UTC (permalink / raw)
To: 9front
Ah hm, I think I misunderstood.
The issue is that we don't correctly detect, in normal roff, that we're
NOT htmlroff, not the inverse? Is this related to the differing behavior
with conditionals between troff and htmlroff?
- Noam Preil
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-05 0:46 ` Noam Preil
2021-12-05 1:19 ` Noam Preil
@ 2021-12-05 1:19 ` Humm
1 sibling, 0 replies; 11+ messages in thread
From: Humm @ 2021-12-05 1:19 UTC (permalink / raw)
To: 9front
Quoth Noam Preil:
>Hey,
>
>htmlroff(6) says to use `.if !h .if t` to check for normal troff. What's
>the issue with that approach?
It does not work. If `.if h` would work correctly, that would check
for normal troff as opposed to both htmlroff and nroff, but as it is,
it does not work. Try:
; troff -a
.if !h .if t \{\
.de M
.tm m
← output
m ← output
Not what you expect at all: Yes, this is troff, but we should be
defining a macro. The `.tm` should not get executed, and there should
not be a blank line before its output.
--
Humm
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-04 23:46 ` Sigrid Solveig Haflínudóttir
@ 2021-12-05 1:24 ` Humm
2021-12-05 1:48 ` Sigrid Solveig Haflínudóttir
0 siblings, 1 reply; 11+ messages in thread
From: Humm @ 2021-12-05 1:24 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
Quoth Sigrid Solveig Haflínudóttir:
>I tried applying this but all I get is
>
>applying troff: we are not htmlroff
>/rc/lib/rcmain: patch failed
>/bin/git/import: rc 190991: patch failed
>
>Can you perhaps git/export and send it as an attachment? Thank you.
Sure thing. I suppose NeoVim, which I use to compose emails, thought
it had to double the spaces at the beginning of lines in the diff.
--
Humm
[-- Attachment #2: troff.diff --]
[-- Type: text/plain, Size: 645 bytes --]
From: Humm <hummsmith42@gmail.com>
Date: Wed, 24 Nov 2021 19:56:44 +0000
Subject: [PATCH] troff: we are not htmlroff
If we don’t explicitly check for ‘h’ in troff, we can’t reliably check
for non-htmlroff well.
Consider the following:
.if h \{\
. de M
. tm m
..\}
Without this change, this will print m and not define macro M.
---
diff 24b9a78ceb63234ef0b0e7d1da0d46119b7a297d c2f89dc6c142284fc3b4c38a4e9fbf5c0c5b2a1d
--- a/sys/src/cmd/troff/n5.c Wed Nov 24 15:41:36 2021
+++ b/sys/src/cmd/troff/n5.c Wed Nov 24 20:56:44 2021
@@ -683,6 +683,7 @@
if (TROFF)
true++;
break;
+ case 'h':
case ' ':
break;
default:
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-05 1:24 ` Humm
@ 2021-12-05 1:48 ` Sigrid Solveig Haflínudóttir
0 siblings, 0 replies; 11+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2021-12-05 1:48 UTC (permalink / raw)
To: 9front
Thanks, that worked.
On Sun, Dec 5, 2021 at 2:30 AM Humm <hummsmith42@gmail.com> wrote:
>
> Quoth Sigrid Solveig Haflínudóttir:
> >I tried applying this but all I get is
> >
> >applying troff: we are not htmlroff
> >/rc/lib/rcmain: patch failed
> >/bin/git/import: rc 190991: patch failed
> >
> >Can you perhaps git/export and send it as an attachment? Thank you.
>
> Sure thing. I suppose NeoVim, which I use to compose emails, thought
> it had to double the spaces at the beginning of lines in the diff.
>
> --
> Humm
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-05 1:19 ` Noam Preil
@ 2021-12-05 2:36 ` Humm
2021-12-05 13:22 ` Noam Preil
0 siblings, 1 reply; 11+ messages in thread
From: Humm @ 2021-12-05 2:36 UTC (permalink / raw)
To: 9front
Quoth Noam Preil:
>The issue is that we don't correctly detect, in normal roff, that
>we're NOT htmlroff, not the inverse?
Correct.
In normal troff, we don’t know that `h` can be used as condition in an
`.if` request. What we perhaps should do is to handle any character
we don’t know as false. What we do instead is weird and wonky
unexpected behavior. Some stuff gets executed when it shouldn’t.
Some stuff doesn’t get executed when it should. The current troff
behavior on `.if h` and `.if !h` is complete garbage.
What this patch does is not to improve troff’s general behavior on
unknown conditions, but to let it know `h` is false.
>Is this related to the differing behavior with conditionals between
>troff and htmlroff?
; troff -a # same with htmlroff
.de xx
.tm a
..
.if 0 \{\
.de xx
.tm b
..
.\}
.xx
a ← output
I guess htmlroff(6) is wrong.
--
Humm
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9front] [PATCH] troff: we are not htmlroff
2021-12-05 2:36 ` Humm
@ 2021-12-05 13:22 ` Noam Preil
0 siblings, 0 replies; 11+ messages in thread
From: Noam Preil @ 2021-12-05 13:22 UTC (permalink / raw)
To: 9front
I'd rather we fixed conditional evaluation in general, but it's probably
worth applying this in the meantime anyways.
- Noam Preil
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-12-06 1:56 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 19:43 [9front] [PATCH] troff: we are not htmlroff Humm
2021-12-04 23:23 ` Humm
2021-12-04 23:46 ` Sigrid Solveig Haflínudóttir
2021-12-05 1:24 ` Humm
2021-12-05 1:48 ` Sigrid Solveig Haflínudóttir
2021-12-05 0:46 ` Noam Preil
2021-12-05 1:19 ` Noam Preil
2021-12-05 2:36 ` Humm
2021-12-05 13:22 ` Noam Preil
2021-12-05 1:19 ` Humm
2021-12-05 0:00 ` ori
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).