From: Kristaps Dzonsons <kristaps@bsd.lv>
To: discuss@mdocml.bsd.lv
Cc: Ingo Schwarze <schwarze@usta.de>, Nicolas Joly <njoly@NetBSD.org>,
Thomas Klausner <wiz@NetBSD.org>
Subject: Re: Sx quoting and Header
Date: Mon, 27 Dec 2010 02:04:09 +0200 [thread overview]
Message-ID: <4D17D7F9.2070904@bsd.lv> (raw)
In-Reply-To: <20101226233009.GM23914@iris.usta.de>
On 27/12/2010 01:30, Ingo Schwarze wrote:
> Hi Thomas and Nicolas,
>
> gah, you are making *me* fix -Thtml bugs... :)
>
> Thomas Klausner wrote on Sat, Dec 25, 2010 at 04:22:04PM +0100:
>
>> 1. When the argument for .Sx is not quoted and contains a space, it
>> breaks the link. Example attached. The .Sx links differ as follows:
>> the one without the quotes has "20" in a place where the other has
>> "x20x". Shouldn't the argument of .Sx be taken as one item independent
>> on if it has quotes or not?
>
> Well, whether it is handled as one AST node internally or not
> is not that important here (using -Ttree, you see that it is
> indeed not the same, which does make sense in other contexts),
> but the bug here is that the ID generator ought to handle
> two words in the same way as one word with a blank in the middle.
>
> OK to commit the following patch?
>
> It makes sure the "x" protecting the beginning of the ID
> only gets added before the first word, not before each word.
>
> Thanks for reporting!
>
> Yours,
> Ingo
>
>
>> .Dd December 25, 2010
>> .Dt TEST 1
>> .Os
>> .Sh NAME
>> .Nm test
>> .Nd test page
>> .Sh DESCRIPTION
>> .Ss Programming Guide
>> See
>> .Sx "Programming Guide"
>> or
>> .Sx Programming Guide
>
>
> Index: html.c
> ===================================================================
> RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
> retrieving revision 1.123
> diff -d -u -p -r1.123 html.c
> --- html.c 24 Dec 2010 14:14:00 -0000 1.123
> +++ html.c 26 Dec 2010 23:10:43 -0000
> @@ -771,20 +771,20 @@ html_idcat(char *dst, const char *src, i
> {
> int ssz;
>
> - assert(sz);
> + assert(sz> 2);
>
> /* Cf.<http://www.w3.org/TR/html4/types.html#h-6.2>. */
>
> - for ( ; *dst != '\0'&& sz; dst++, sz--)
> - /* Jump to end. */ ;
> -
> - assert(sz> 2);
> -
> /* We can't start with a number (bah). */
>
> - *dst++ = 'x';
> - *dst = '\0';
> - sz--;
> + if ('\0' == *dst) {
> + *dst++ = 'x';
> + *dst = '\0';
> + sz--;
> + }
> +
> + for ( ; *dst != '\0'&& sz; dst++, sz--)
> + /* Jump to end. */ ;
>
> for ( ; *src != '\0'&& sz> 1; src++) {
> ssz = snprintf(dst, (size_t)sz, "%.2x", *src);
Ingo,
Great!
To assuage the trauma of dealing with -T[x]html, I've a patch on hand
that stashes the mdoc_validate.c concatenated `Sh' string (see
post_sh()) into a mdoc_sh structure. This buffer is then pumped right
into html_idcat(), removing all those stupid loops over children.
The neat part about this is that, if I add a sorted list among these, I
can do the same in `Sx' and add a check that makes sure `Sx' links
actually go somewhere AND that sections/subsections/etc. aren't
duplicates. It's only little bits of code, but since this isn't checked
by nroff, I'll post it here for a relevancy check before it goes in.
Note, if I haven't ever explained myself, that the hex encoding is just
to get around the fact that IDs are case-insensitive, while -mdoc is
case-sensitive (NAME != name)...
Kristaps
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
next prev parent reply other threads:[~2010-12-27 0:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-25 15:22 Thomas Klausner
2010-12-26 23:30 ` Ingo Schwarze
2010-12-27 0:04 ` Kristaps Dzonsons [this message]
2010-12-27 0:36 ` Ingo Schwarze
2010-12-27 8:39 ` Kristaps Dzonsons
[not found] ` <20101227132623.GA285025@medusa.sis.pasteur.fr>
2010-12-27 21:57 ` Ingo Schwarze
2010-12-27 0:08 ` 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=4D17D7F9.2070904@bsd.lv \
--to=kristaps@bsd.lv \
--cc=discuss@mdocml.bsd.lv \
--cc=njoly@NetBSD.org \
--cc=schwarze@usta.de \
--cc=wiz@NetBSD.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).