-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
manuals: Fix escaping for (some) backslashes #1526
base: main
Are you sure you want to change the base?
Conversation
According to mandoc_char(7), we should use '\e' rather than '\\'. The rendered output (in ascii and html) is not affected by this commit. Fixes made by script in https://github.com/Tarsnap/freebsd-doc-scripts, limited to 30 files. Signed-off-by: Graham Percival <[email protected]> Sponsored by: Tarsnap Backup Inc. Pull Request: freebsd#1526
I'm in the odd situation of submitting a PR which I hope we don't accept. The rendered output (in ascii and html) is not affected by this commit. According to mandoc_char(7), we should use '\e' rather than '\'. In particular, mandoc_char(7) says:
Based on that, I find it hard to argue that we shouldn't make this change. On the other hand, it makes the document source harder to read, and thus harder to maintain. shrug If we want these changes, I have the script ready. There's around 100 files; this PR fixes 30 of them. Happy to split up the changes as requested (all 100 at once? batches of 20, or 30, or 50?) OTOH, if you decide that mandoc_char's concerns are not worth the extra maintenance burden, I'm happy to drop the matter. |
FWIW, |
@@ -92,7 +92,7 @@ manual page. | |||
.Sh EXAMPLES | |||
Special treatment of options and backslashes: | |||
.Bd -literal -offset indent | |||
$ /bin/echo "-hello\\tworld" | |||
$ /bin/echo "-hello\etworld" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to elaborate on the "maintainability" thing... anybody looking at the source code for echo.1
will recognize the previous text. "Ok, it says \\tworld
, which is clearly a \t
tab, but with the backslashes escaped."
Whereas the "correct" source is \etworld
. Which to my eyes, looks like "some kind of special \e
command, followed by tworld
. What on earth does tworld
mean? That must be a typo, surely!"
Even if I suspect "complete roff(7) implementations" that we care about actually handle |
That doesn't follow -- we can make changes to mandoc_char in FreeBSD, if we are so inclined. There may be several reasons such a change is a bad idea, but there's no hard requirement that Ingo approves of it. |
I think \ is clearer than \e. It's a sane extension. It's limited. It's not full roff(7). It doesn't have to be either or. It can be just one thing. I think this change isn't such a great idea since \ works. |
Interesting discovery: apparently \e is not a backslash per se, but is an escape that represents the current escape. Apparently |
When I get home, I'm happy to check it in groff and heirloom-doctools. What other roff compilers are there? |
Bad news for I tested replacing
That currently renders as
However, if we change
If we remove the
Out of curiosity, I tried adding more ... I suppose we could allow |
No description provided.