From owner-freebsd-doc Thu May 31 21:57:39 2001 Delivered-To: freebsd-doc@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 5A4DD37B42C; Thu, 31 May 2001 21:57:34 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 1CA303E30; Thu, 31 May 2001 21:57:34 -0700 (PDT) To: doc@freebsd.org Cc: nik@freebsd.org Subject: Nested hrefs (also known as: ) Date: Thu, 31 May 2001 21:57:34 -0700 From: Dima Dorfman Message-Id: <20010601045734.1CA303E30@bazooka.unixfreak.org> Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org As you probably know, we have customized to create an href to an HTML rendering of the corresponding manual page when the document is being rendered to HTML. The problem is when one of these entities is used inside a tag which will cause a link to be created, such as (if a table of contents is to be created for this document): Using the &man.ls.1; command This will cause an equivilent of the following to be generated when rendering to HTML: Using the ls(1) command Obviously, nested hrefs simply don't work. Also, the canonical solution of "then don't do that" is unsatisfying. The (IMO) ideal solution would be for the customization of to detect if its output will appear inside an href, and not generate an href itself in that case. This would be much easier if all links were created with a procedure, e.g. (create-link), instead of using (make element gi: "A"). Once that's done, all that's needed to fix the problem described above is to have (create-link) call another function, e.g. (can-link-here), to determine if it's okay to make an link in the current place. Comments? Suggestions? Regards, Dima Dorfman dima@unixfreak.org Index: freebsd.dsl =================================================================== RCS file: /stl/src/FreeBSD/doc/share/sgml/freebsd.dsl,v retrieving revision 1.30 diff -u -r1.30 freebsd.dsl --- freebsd.dsl 2001/05/22 03:32:17 1.30 +++ freebsd.dsl 2001/05/28 05:55:33 @@ -116,12 +116,12 @@ (href ($create-refentry-xref-link$ (data refentrytitle) (data manvolnum)))) - (if %refentry-xref-link% - (make element gi: "A" - attributes: (list (list "HREF" href)) + (if %refentry-xref-link% + (create-link (if %refentry-xref-italic% ($italic-seq$) - ($charseq$))) + ($charseq$)) + (list (list "HREF" href))) (if %refentry-xref-italic% ($italic-seq$) ($charseq$))))) @@ -447,6 +447,41 @@ (process-node-list abbrev)) (make sequence (literal "[" (id target) "]")))))))) + + + (define (can-link-here) + (cond ((has-ancestor-member? (current-node) + '("TITLE" "QUESTION")) #f) + (#t #t))) + + (define (create-link target attrlist) + (if (can-link-here) + (make element gi: "A" + attributes: attrlist + target) + target)) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message