[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Zero-width space as line-wrapping workaround?
Hi Stefan,
On Mon, 26 Nov 2012 15:09:24 +0100
Stefan Hinz <stefan.hinz@oracle.com> wrote:
> Does anyone have experience using ​ -- the Unicode "zero-width
> space" character (see
> http://www.fileformat.info/info/unicode/char/200b/index.htm)?
Yes. :)
> [...]
> I presume the idea is to have a character that has no visible effect
> within a keyword, but allows it to be split across lines anyway.
>
> Personally, I don't like invisible things like this that could get in
> the way of grepping through the source.
>
> Any other pros and cons? Maybe other/better ways to work around the
> problem?
I had the same concerns with grepping through the sources.
For URLs, the solution is very easy. Use the following two parameters:
* $ulink.hyphenate
Set it to the ZERO WIDTH SPACE character (​ or ​). By
default, it is empty.
* $ulink.hyphenate.chars
Defines which characters are considered to contain the ZWS after
that character. By default, it's "/", but you could extend it with
other characters like "_", "-", "&", ...
These two parameters are used in the "hyphenate-url" template. This
template goes through the string and checks each character, if it's in
the set of $ulink.hyphenate.chars. You could use this template as a
base for your <option> template.
You can find an example of my modification of hyphenate-url in the daps
repository. I needed a finer control which characters should contain the
ZWS before or after that character. You can find the code here:
https://svn.code.sf.net/p/daps/svn/trunk/daps/suse/xslt/fo/hyphenate-url.xsl
Hope this helps. :)
--
Gruß/Regards,
Thomas Schraitle
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]