OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] make.clean.html and Firefox handling of white-space: pre ?


Hi Mark,
That solution could work but the general case makes it a bit complicated.

A programlisting can have inlines, so the solution has to be able to process text inside those inlines as well. I think a template that matches on text node descendants of programlisting could work:

<xsl:template match="text()[ancestor::programlisting]">

Making the substitutions in the text in XSLT 1.0 requires using a recursive template to step through each text node. The risk with recursive processing is getting too deeply nested in the recursions so that the XSLT processor gives ups. I think Saxon 6 breaks at about 300 nested recusions. A long programlisting with many spaces and newlines could easily exceed that. I've solved that problem in the past by doing two levels of recursion, processing the content in, say, 50 line chunks.

I don't know that we would put this in the stylesheet distribution because it's so complicated. It might be easier to just add a note (perhaps Javascript triggered by the Firefox user agent string) that if the user wants to cut and paste that they should use a browser other than Firefox. 8^)

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: "Mark Craig" <mark.craig@gmail.com>
To: "Bob Stayton" <bobs@sagehill.net>
Cc: <docbook-apps@lists.oasis-open.org>
Sent: Friday, February 10, 2012 9:11 AM
Subject: Re: [docbook-apps] make.clean.html and Firefox handling of white-space: pre ?


Hi Bob,

I was thinking of trying https://bugzilla.mozilla.org/show_bug.cgi?id=116083#c43 :

Joseph Lenton 2011-09-28 09:45:06 PDT
Workaround:

Convert each new line character into a '<br>' tag, and each space into '&nbsp;'. The browser will convert these back into newlines and spaces when they are copied by the user.
Regards,
Mark

On Feb 10, 2012, at 6:01 PM, Bob Stayton wrote:

Hi Mark,
The 'make.clean.html=1' setting replaces <pre> with <div> and class attribute in the HTML output. What sort of workaround did you have in mind? Adding another param that would keep make.clean.html for other things but override this output to <pre>?

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: "Mark Craig" <mark.craig@gmail.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Friday, February 10, 2012 5:17 AM
Subject: [docbook-apps] make.clean.html and Firefox handling of white-space: pre ?


Hello,

I liked setting <xsl:param name="make.clean.html" select="1" /> and using "white-space: pre;" in the CSS. Of course, I did this expecting readers to be able to copy/paste the pre formatted content in a sort of WYSIWYG way.

But I didn't test in Firefox until a reviewer mentioned that all the newlines were gone when he pasted. Then I saw https://bugzilla.mozilla.org/show_bug.cgi?id=116083 : copy paste of CSS "white-space: pre;" content does not preserve whitespace.

This Firefox bug has been around for some time. It doesn't seem to be going away soon. Are there any plans to work around it in a future version of the DocBook XSL stylesheets?

Regards,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org








[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]