| From | Sent On | Attachments |
|---|---|---|
| Warren Block | Jan 18, 2012 2:49 pm | |
| Hiroki Sato | Jan 18, 2012 3:44 pm | |
| Warren Block | Jan 18, 2012 5:13 pm | |
| Hiroki Sato | Jan 18, 2012 10:57 pm | |
| Warren Block | Jan 20, 2012 12:05 pm | .c |
| Gabor Kovesdan | Jan 21, 2012 3:16 pm | |
| Warren Block | Jan 21, 2012 4:29 pm | |
| Gabor Kovesdan | Jan 23, 2012 9:07 am | |
| Warren Block | Jan 23, 2012 11:38 am | .py |
| Hiroki Sato | Jan 24, 2012 5:23 pm | |
| Gabor Kovesdan | Jan 24, 2012 6:15 pm | |
| Hiroki Sato | Jan 24, 2012 6:18 pm | |
| Warren Block | Jan 26, 2012 10:20 am | |
| Warren Block | Jan 26, 2012 10:22 am | .diff |
| Hiroki Sato | Jan 26, 2012 7:45 pm | |
| Warren Block | Jan 26, 2012 9:46 pm | .diff |
| Hiroki Sato | Jan 26, 2012 10:50 pm | .diff |
| Hiroki Sato | Jan 27, 2012 5:24 am | .diff |
| Warren Block | Jan 27, 2012 7:53 am | .diff |
| Hiroki Sato | Jan 27, 2012 8:58 am | .diff |
| Warren Block | Jan 27, 2012 11:43 am | |
| Hiroki Sato | Jan 28, 2012 12:57 am | |
| Warren Block | Jan 28, 2012 2:47 pm | |
| Hiroki Sato | Jan 28, 2012 10:24 pm |
| Subject: | Re: Tidy and HTML tab spacing | |
|---|---|---|
| From: | Warren Block (wbl...@wonkity.com) | |
| Date: | Jan 20, 2012 12:05:26 pm | |
| List: | org.freebsd.freebsd-doc | |
| Attachments: | ||
On Thu, 19 Jan 2012, Hiroki Sato wrote:
It is difficult to solve this issue completely because the result text can be obtained only by a complete HTML processor such as www browsers. I don't have a good idea, but I think it is not a bad idea to use a tab character (or replacing it to 	) in the result text by modifying Tidy and leave the processing to www browsers.
The suggestion of 	 is interesting. The problem is that tidy is changing tabs to spaces while still reading the file, when it really should be treating the tab as a special entity while processings tags.
So preprocessing still might be a way to preserve tabs. Just convert them all to 	 before tidy has a chance to change them.
perl -i -pe 's/\t/	/g' book.html
sed works also, but beware of the binary tab necessary for sed's paleolithic regexes:
sed -i -e 's/ /\	/g' book.html
Initial testing shows this does seem to work. The output has genuine tabs which display fine in Firefox but ought to be tested in other browsers. Note that there are some invisible tabs in the HTML output that come from the SGML source. For example, the copyright notice in the Porter's Handbook:
<holder role="mailto:do...@FreeBSD.org">The FreeBSD Documentation Project</holder>
That leading tab on the second line is in the HTML file. Still, replacing those invisible tabs with 	 instead of spaces should render the same.
Finally, before picking up on the idea of tab-as-an-entity, I worked up a patch to www/tidy-devel which uses the magic value of --tab-size 255 to mean "don't replace tabs". Attached, but I think the 	 is better.
--- src/streamio.c.orig 2008-03-22 15:00:18.000000000 -0600 +++ src/streamio.c 2012-01-20 12:25:58.000000000 -0700 @@ -351,11 +351,18 @@ added = yes; TY_(AddCharToOriginalText)(in, (tchar)c); #endif - in->tabs = tabsize > 0 ? - tabsize - ((in->curcol - 1) % tabsize) - 1 - : 0; - in->curcol++; - c = ' '; + if (tabsize == 255) { + in->curcol++; + c = '\t'; + } + else + { + in->tabs = tabsize > 0 ? + tabsize - ((in->curcol - 1) % tabsize) - 1 + : 0; + in->curcol++; + c = ' '; + } break; }
_______________________________________________ free...@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-doc To unsubscribe, send any mail to "free...@freebsd.org"






.c