Discussion:
[Docutils-users] Links in Chinese
Dariusz Suchojad
2015-03-06 13:18:27 UTC
Permalink
Hello,

I'm on docutils 0.12 and I'm having a bit of difficulties with making
links containing characters in Chinese to work.

Consider the example over here converted to HTML using rst2html ..

https://zato.io/support/docutils/link-cn.txt
https://zato.io/support/docutils/link-cn.html

.. which works as expected as long as the contents in ``_ is within
ASCII but fails as soon as Chinese copy is included.

Will appreciate any assistance on that front - it's difficult to use
Chinese texts and docutils without the feature.

cheers,
--
Dariusz Suchojad

https://zato.io
ESB, SOA, REST, APIs and Cloud Integrations in Python

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Dariusz Suchojad
2015-03-06 14:16:18 UTC
Permalink
Try unicode.
.. |_| unicode:: 0x80
To insert a trimmed space.
For example: word |_| word.
The builder will replace |_| with the specified Unicode symbol (a trimmed space).
A good technique is to build a unicode symbols table (either a .rst or a .txt file), then use the insert directive (via epilog) to
insert the table at the end of every file.
Then you don't have to worry about adding the declaration every time you create a new page.
Hi Jay,

thanks for the tip - I'll give it a go, I wasn't aware of this approach.

cheers,
--
Dariusz Suchojad

https://zato.io
ESB, SOA, REST, APIs and Cloud Integrations in Python

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
David Goodger
2015-03-06 15:41:31 UTC
Permalink
On Fri, Mar 6, 2015 at 7:18 AM, Dariusz Suchojad
Post by Dariusz Suchojad
Hello,
I'm on docutils 0.12 and I'm having a bit of difficulties with making
links containing characters in Chinese to work.
Consider the example over here converted to HTML using rst2html ..
https://zato.io/support/docutils/link-cn.txt
https://zato.io/support/docutils/link-cn.html
.. which works as expected as long as the contents in ``_ is within
ASCII but fails as soon as Chinese copy is included.
Will appreciate any assistance on that front - it's difficult to use
Chinese texts and docutils without the feature.
The problem has nothing to do with ASCII vs. Chinese text (UTF-8 or
any encoding). The link with Chinese text simply lacks whitespace
between the end of the link text and the <URL>. Just add a space (or a
newline, etc.) after the "。" and before the "<":

`Zato 是ESB,并且服务都是用Python写的。 <https://zato.io>`_

It may look like there was a space there already, but that's because
of the small Chinese period offset to the left in a full-width glyph.

The space is necessary to allow for link text that contains "<" and
">" characters.
--
David Goodger <http://python.net/~goodger>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All
Dariusz Suchojad
2015-03-06 17:32:11 UTC
Permalink
Post by David Goodger
`Zato 是ESB,并且服务都是用Python写的。 <https://zato.io>`_
It may look like there was a space there already, but that's because
of the small Chinese period offset to the left in a full-width glyph.
Oh, that's a great catch, David.

Yes, that was it - works perfectly now!

thanks a lot again,
--
Dariusz Suchojad

https://zato.io
ESB, SOA, REST, APIs and Cloud Integrations in Python


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use
Loading...