7

Is it possible to create hyperlinks without leading and trailing spaces? The following doesn't work:

re`Structured`_Text

.. _`Structured`: http://docutils.sourceforge.net/docs/user/rst/quickstart.html

The reason I'm asking is I'm working with Chinese text. Spaces are not used as word delimiters in Chinese. With the added spaces the text doesn't look well formatted, for example:

没有空格就对了。

versus

多了 空格 不好看。

Any ideas?

Wang Dingwei
  • 4,661
  • 6
  • 32
  • 43
  • I think you are stuck with spaces, unless you want to hack rst source. Are you open to post-processing the document and removing the spaces programmatically? – Mike Pennington May 22 '11 at 08:33
  • Or, are you open to using Markdown, which seems to handle such links successfully? – Greg Hewgill May 22 '11 at 08:54
  • @Mike, I guess your are right, I'm doing post-process for these docs now. @Greg, Unfortunately I'm working on some translation projects where .rst is used in the source. – Wang Dingwei May 22 '11 at 09:06

1 Answers1

7

Eventually this is how I get away with this problem. Awkward, but works:

没有\ 空格_\就对了。
我觉得\ `中文和 RST`_\不够兼容。

.. _空格: http://a-link-with-pure-zh-te.xt
.. _`中文和 RST`: http://a-link-with-mixed-zh-and.en

Update: Since docutils 0.13 we can enable character level inline markup. This way we can write like below and save a few backslashes.

没有\ 空格_就对了。
我觉得`中文和 RST`_不够兼容。

This option is enabled via the command line switch:

python rst2html.py --character-level-inline-markup 1.rst > 1.html
Wang Dingwei
  • 4,661
  • 6
  • 32
  • 43
  • 1
    Ironically, as with [other documentation tools](http://www.stack.nl/~dimitri/doxygen/), the project's internals are not very well documented... – André Caron May 27 '11 at 14:02