discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: discuss@mdocml.bsd.lv
Cc: Nicolas Joly <njoly@NetBSD.org>, Thomas Klausner <wiz@NetBSD.org>
Subject: Re: Sx quoting and Header
Date: Mon, 27 Dec 2010 00:30:09 +0100	[thread overview]
Message-ID: <20101226233009.GM23914@iris.usta.de> (raw)
In-Reply-To: <20101225152204.GY21954@danbala.tuwien.ac.at>

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);
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2010-12-26 23:30 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 [this message]
2010-12-27  0:04   ` Kristaps Dzonsons
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=20101226233009.GM23914@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=discuss@mdocml.bsd.lv \
    --cc=njoly@NetBSD.org \
    --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).