From owner-freebsd-doc@FreeBSD.ORG Fri Jan 27 16:59:14 2012 Return-Path: Delivered-To: freebsd-doc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B149B106566B for ; Fri, 27 Jan 2012 16:59:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id 1FE988FC14 for ; Fri, 27 Jan 2012 16:59:13 +0000 (UTC) Received: from alph.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.4) with ESMTP id q0RGwxN2081573; Sat, 28 Jan 2012 01:59:09 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id q0RGwvDK056748; Sat, 28 Jan 2012 01:58:59 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sat, 28 Jan 2012 01:58:46 +0900 (JST) Message-Id: <20120128.015846.1752534900695634367.hrs@allbsd.org> To: wblock@wonkity.com From: Hiroki Sato In-Reply-To: References: <20120127.155054.2121952239893273004.hrs@allbsd.org> <20120127.222427.2203865340894432901.hrs@allbsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.4 on Emacs 23.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Sat_Jan_28_01_58_46_2012_885)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Sat, 28 Jan 2012 01:59:10 +0900 (JST) X-Spam-Status: No, score=-104.1 required=13.0 tests=BAYES_00, CONTENT_TYPE_PRESENT, FAKEDWORD_ZERO, RDNS_NONE, SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on gatekeeper.allbsd.org Cc: freebsd-doc@FreeBSD.org Subject: Re: Tidy and HTML tab spacing X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2012 16:59:14 -0000 ----Security_Multipart0(Sat_Jan_28_01_58_46_2012_885)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Sat_Jan_28_01_58_46_2012_017)--" Content-Transfer-Encoding: 7bit ----Next_Part(Sat_Jan_28_01_58_46_2012_017)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Warren Block wrote in : wb> On Fri, 27 Jan 2012, Hiroki Sato wrote: wb> wb> > Hiroki Sato wrote wb> > in <20120127.155054.2121952239893273004.hrs@allbsd.org>: wb> > wb> > hr> I think the attached patch should fix the issue in the PDF format. wb> > hr> Could you test it? wb> > wb> > The previous patch did not include width calculation of the tab wb> > expansion (always used 8 spaces). The attached one does it for a wb> > simple character sequence. wb> wb> That helps a lot! Single tabs and multiple tabs are slightly wb> different, but it's close. wb> http://www.wonkity.com/~wblock/porters/tab1.png (good!) wb> http://www.wonkity.com/~wblock/porters/tab2.png (close) wb> wb> http://www.wonkity.com/~wblock/porters/tab3.png wb> wb> Should be: wb> LIB_DEPENDS+= foo.0:${PORTSDIR}/devel/foo wb> CONFIGURE_ARGS+= --enable-foo wb> wb> The second line '=' lands right before a tab stop, and the tab is wb> replaced with a single space. wb> wb> Thanks! How about the attached one? A bug that could cause an extra space was fixed. -- Hiroki ----Next_Part(Sat_Jan_28_01_58_46_2012_017)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="expand-tabs-freebsd-print.20120127-3.diff" Index: freebsd-print.dsl =================================================================== RCS file: /home/ncvs/doc/share/sgml/freebsd-print.dsl,v retrieving revision 1.2 diff -d -u -I \$FreeBSD:.*\$ -I \$NetBSD:.*\$ -I \$OpenBSD:.*\$ -I \$DragonFly:.*\$ -I \$Id:.*\$ -I \$Translation:.*\$ -I \$hrs:.*\$ -r1.2 freebsd-print.dsl --- freebsd-print.dsl 8 Dec 2010 06:25:59 -0000 1.2 +++ freebsd-print.dsl 27 Jan 2012 16:56:59 -0000 @@ -6,12 +6,12 @@ + %freebsd.l10n; %freebsd.l10n-common; -]]> ]> @@ -616,6 +616,99 @@ (with-mode section-title-mode (process-node-list subtitles)) ($section-info$ info)))) + + ;; Expand a literal tab character to spaces in elements like + ;; programlisting. + (define %default-tab-spacing% 8) + + (define ($verbatim-display$ indent line-numbers?) + (let* ((width-in-chars (if (attribute-string (normalize "width")) + (string->number + (attribute-string (normalize "width"))) + %verbatim-default-width%)) + (fsize (lambda () (if (or (attribute-string (normalize "width")) + (not %verbatim-size-factor%)) + (/ (/ (- %text-width% + (inherited-start-indent)) + width-in-chars) + 0.7) + (* (inherited-font-size) + %verbatim-size-factor%)))) + (vspace-before (if (INBLOCK?) + 0pt + (if (INLIST?) + %para-sep% + %block-sep%))) + (vspace-after (if (INBLOCK?) + 0pt + (if (INLIST?) + 0pt + %block-sep%)))) + (make paragraph + use: verbatim-style + space-before: (if (and (string=? (gi (parent)) + (normalize "entry")) + (absolute-first-sibling?)) + 0pt + vspace-before) + space-after: (if (and (string=? (gi (parent)) + (normalize "entry")) + (absolute-last-sibling?)) + 0pt + vspace-after) + font-size: (fsize) + line-spacing: (* (fsize) %line-spacing-factor%) + start-indent: (if (INBLOCK?) + (inherited-start-indent) + (+ %block-start-indent% + (inherited-start-indent))) + (if (or indent line-numbers?) + ($linespecific-line-by-line$ indent line-numbers?) + (let loop ((kl (children (current-node))) + (tabsp %default-tab-spacing%) + (res (empty-sosofo))) + (if (node-list-empty? kl) + res + (loop + (node-list-rest kl) + (cond + ((char=? (node-property + 'char (node-list-first kl) + default: #\U-0000) #\U-0009) + %default-tab-spacing%) + ((char=? (node-property + 'char (node-list-first kl) + default: #\U-0000) #\U-000D) + %default-tab-spacing%) + ((char? (node-property + 'char (node-list-first kl) + default: #f)) + (- (if (= (modulo tabsp %default-tab-spacing%) 0) + %default-tab-spacing% + (modulo tabsp %default-tab-spacing%)) + 1)) + (#t + (- (if (= (modulo tabsp %default-tab-spacing%) 0) + %default-tab-spacing% + (modulo tabsp %default-tab-spacing%)) + (modulo (string-length (data (node-list-first kl))) + %default-tab-spacing%)))) + (let ((c (node-list-first kl))) + (if (char=? (node-property + 'char c + default: #\U-0000) #\U-0009) + (sosofo-append res + (let sploop ((spc + (if (= tabsp 0) + %default-tab-spacing% + tabsp))) + (if (> spc 0) + (sosofo-append + (literal " ") + (sploop (- spc 1))) + (empty-sosofo)))) + (sosofo-append res + (process-node-list c))))))))))) ]]>