From: Martin B. <m....@gm...> - 2004-05-17 12:50:45
|
Hi, greeting you all. Is there a way to have entities generated in the resulting html file? MB -- Martin Bless |
From: Felix W. <Fel...@gm...> - 2004-05-17 15:48:33
|
Martin Bless wrote: > Is there a way to have entities generated in the resulting html > file? If you don't insist on really having ' ' in the HTML code, insert the character literally: "foo bar" contains a non-breakable space. With Emacs, use `C-q 0 2 4 0`. Other editors probably have similar possibilities. (Under Windows, it's AFAIK `1 6 0` on the numerical keypad while having the alt-key pressed.) -- When replying to my email address, ensure that the mail header contains 'Felix Wiemann'. Please don't send unrequested mails > 64 KB. <http://www.ososo.de/> |
From: David G. <go...@py...> - 2004-05-17 23:23:09
|
Martin Bless wrote: > Is there a way to have entities generated in the resulting > html file? Another way to get the equivalent of is using substitutions. First define the substitution: .. |nbsp| unicode:: U+00A0 Then use it: Here: |nbsp| If you need it between words, you must use backslash escapes to delineate, like\ |nbsp|\ this. If you insist on the text " " appearing in your output, you must use the "raw" directive: .. |nbsp| raw:: html Usage is the same as above. -- David Goodger |
From: Felix W. <Fel...@gm...> - 2004-05-18 21:10:12
|
David Goodger wrote: > Martin Bless wrote: > >> Is there a way to have entities generated in the resulting >> html file? > > Another way to get the equivalent of is using > substitutions. First define the substitution: > > .. |nbsp| unicode:: U+00A0 I tried to accomplish this using ``replace::``, but ... -------------------- |foo| .. |foo| replace:: -------------------- ... doesn't work for some reason, even though there is a non-breaking space after the ``replace:: ``. (Docutils behaves as if the nbsp was not there.) Is this behaviour intended? (I'm just nitpicking now, it's not *that* important...) By the way, with ``.. |foo| replace:: \ `` (an escaped space after the nbsp) it works as expected. -- When replying to my email address, ensure that the mail header contains 'Felix Wiemann'. Please don't send unrequested mails > 64 KB. <http://www.ososo.de/> |
From: David G. <go...@py...> - 2004-05-18 21:50:59
|
Felix Wiemann wrote: > I tried to accomplish this using ``replace::``, but ... > > -------------------- > |foo| > > .. |foo| replace:: > -------------------- > > ... doesn't work for some reason, even though there is a > non-breaking space after the ``replace:: ``. (Docutils behaves as > if the nbsp was not there.) > > Is this behaviour intended? Sort-of. The state machine does a lot of whitespace stripping, and non-breaking spaces (U+00A0) are recognized as whitespace by Python. Since tabs are explicitly converted to spaces, we could replace all ".strip()" calls with ".strip(' ')", adding an explicit space (also .lstrip & .rstrip). But support for the argument to .strip() is only in Python 2.2.2+. > By the way, with ``.. |foo| replace:: \ `` (an escaped space after > the nbsp) it works as expected. So it must be .rstrip() that's the culprit. -- David Goodger |
From: Felix W. <Fel...@gm...> - 2004-05-24 14:48:47
|
David Goodger wrote: > Felix Wiemann wrote: > >> |foo| >> >> .. |foo| replace:: >> -------------------- >> >> ... doesn't work for some reason, even though there is a non-breaking >> space after the ``replace:: ``. (Docutils behaves as if the nbsp was >> not there.) > > [...] So it must be .rstrip() that's the culprit. No, it isn't. (If it were, I wouldn't have asked, BTW.) rstrip() only strips breakable whitespace. But please don't bother investigating on this; I was mainly curious. -- When replying to my email address, ensure that the mail header contains 'Felix Wiemann'. Please don't send unrequested mails > 64 KB. <http://www.ososo.de/> |
From: David G. <go...@py...> - 2004-05-25 19:44:43
|
Felix Wiemann wrote: > rstrip() only strips breakable whitespace. Python 2.3.3 >>> s=u'\u00a0' # non-breaking space >>> s u'\xa0' >>> s.rstrip() u'' -- David Goodger |
From: Martin B. <m....@gm...> - 2004-05-19 19:48:19
|
Thank you David and Felix. I sort of knew about that non breaking space U+00A0 but didn't expect that a wide range of applications do. It seems I was wrong. I did a quick check (Windows machines): U+00A0 is at least respected by: - MSIE 6.x - Mozilla 1.2.1 - Netscape 4.75 - Mozilla Firefox 0.8 . Ultraedit, CSE_HTML_Validator, Dreamweaver 6.1 Interesting to know. So maybe we don't really need the ! MB - Martin Bless |