Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jan 2012 15:50:54 +0900 (JST)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        wblock@wonkity.com
Cc:        freebsd-doc@FreeBSD.org
Subject:   Re: Tidy and HTML tab spacing
Message-ID:  <20120127.155054.2121952239893273004.hrs@allbsd.org>
In-Reply-To: <alpine.BSF.2.00.1201262148480.25316@wonkity.com>
References:  <alpine.BSF.2.00.1201261121550.21319@wonkity.com> <20120127.124619.1645166101623286100.hrs@allbsd.org> <alpine.BSF.2.00.1201262148480.25316@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart0(Fri_Jan_27_15_50_54_2012_707)--
Content-Type: Multipart/Mixed;
	boundary="--Next_Part(Fri_Jan_27_15_50_54_2012_985)--"
Content-Transfer-Encoding: 7bit

----Next_Part(Fri_Jan_27_15_50_54_2012_985)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Warren Block <wblock@wonkity.com> wrote
  in <alpine.BSF.2.00.1201262148480.25316@wonkity.com>:

wb> On Fri, 27 Jan 2012, Hiroki Sato wrote:
wb>
wb> > Changes look good to me, but it is better to use something like this
wb> >
wb> > REINPLACE_TABS_CMD?=${SED} -i -e 's/	/\&#09;/g'
wb> >
wb> > in doc.common.mk (with some comments explaining this is a hack to
wb> > preserve literal tab characters) and use it in these three.
wb>
wb> Revised patch attached (for real, this time).  Only lightly tested but
wb> no problems noticed.
wb>
wb> On Windows XP, IE8 and Firefox 9 render the tabs in the new version
wb> correctly.
wb>
wb>
wb> There is another issue: PDFs.  A PDF version with the patch above is
wb> at http://www.wonkity.com/~wblock/porters/book.pdf.bz2
wb>
wb> Actual tabs come out as a single space in the PDF.  Compare that with
wb> the unpatched tabs-to-spaces version at
wb> ftp://ftp.freebsd.org/pub/FreeBSD/doc/en_US.ISO8859-1/books/porters-handbook/book.pdf.bz2
wb>
wb> ...which still isn't quite right.  Tabs at the beginning of lines are
wb> removed.  (That file has not been rebuilt in quite a while, either.)
wb>
wb> I'm thinking the conversion will be different with DocBook XML,
wb> possibly more correct.  There are other problems with the current PDFs
wb> that might also be cured.
wb>
wb> As far as the other formats, book.txt looks somewhat okay, but I've
wb> honestly never looked at the .txt or .rtf formats before.

 Ah, okay.  It is due to the DSSSL processor.  Jade and OpenJade do
 not implement expand-tabs: characteristics in paragraph flow object
 class.

 I think the attached patch should fix the issue in the PDF format.
 Could you test it?

-- Hiroki

----Next_Part(Fri_Jan_27_15_50_54_2012_985)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
	filename="expand-tabs-freebsd-print.20120127-1.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 06:46:51 -0000
@@ -616,6 +616,56 @@
             (with-mode section-title-mode
 	      (process-node-list subtitles))
             ($section-info$ info))))
+
+	(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)))
+				   (res (empty-sosofo)))
+			  (if (node-list-empty? kl)
+			      res
+			      (loop
+			       (node-list-rest kl)
+			       (let ((c (node-list-first kl)))
+				 (if (char=? (node-property 'char c
+							    default: #\U-0000) #\U-0009)
+				     (sosofo-append res (literal "        ") (process-node-list c))
+				     (sosofo-append res (process-node-list c)))))))))))
       ]]>

       <![ %output.print.pdf; [

----Next_Part(Fri_Jan_27_15_50_54_2012_985)----

----Security_Multipart0(Fri_Jan_27_15_50_54_2012_707)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEABECAAYFAk8iSU4ACgkQTyzT2CeTzy3IaACgnqSXGGBqtGHUF5PV1qBaTieM
TKUAn1lIIfq0fXL4r9zu7OcSa5HRNtAx
=8mZE
-----END PGP SIGNATURE-----

----Security_Multipart0(Fri_Jan_27_15_50_54_2012_707)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120127.155054.2121952239893273004.hrs>