summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-02-12 17:41:20 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-02-12 17:41:20 +0000
commitef911d4bdf376009474bf4d068bbd96eebb15a47 (patch)
tree2ba8fb23385c77e39ee39212bb82182d23bd7229
parentb345ad001b1a962ccfb151f99a3432aa93154edb (diff)
downloaddocutils-ef911d4bdf376009474bf4d068bbd96eebb15a47.tar.gz
Fix bug #358: Non-breaking space removed from fixed-width literal.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8244 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--docutils/HISTORY.txt12
-rw-r--r--docutils/docutils/writers/_html_base.py2
-rwxr-xr-xdocutils/test/test_writers/test_html4css1_parts.py10
3 files changed, 19 insertions, 5 deletions
diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt
index 4ea1a042a..dbbdd059b 100644
--- a/docutils/HISTORY.txt
+++ b/docutils/HISTORY.txt
@@ -62,6 +62,10 @@ Changes Since 0.14
- Fix bug #331: fixed the "trim" options of the "unicode" directive.
+* docutils/utils/__init__.py:
+
+ - Deprecate `unique_combinations` (obsoleted by `itertools.combinations`).
+
* docutils/utils/smartquotes.py:
- Fix bug #332: use open quote after whitespace, ZWSP, and ZWNJ.
@@ -71,6 +75,10 @@ Changes Since 0.14
- automatically add HTML5-compatible meta tags for docinfo items
"authors", "date", and "copyright".
+* docutils/writers/_html_base.py
+
+ - Fix bug #358: Non-breaking space removed from fixed-width literal.
+
* docutils/writers/latex2e/__init__.py:
- Fix bug #323: spurious ``\phantomsection`` and whitespace in
@@ -78,10 +86,6 @@ Changes Since 0.14
- Fix bug #324: Invalid LaTeX for table with empty multicolumn cell.
- Fixes to literal block handling.
-* docutils/utils/__init__.py:
-
- - Deprecate `unique_combinations` (obsoleted by `itertools.combinations`).
-
Release 0.14 (2017-08-03)
=========================
diff --git a/docutils/docutils/writers/_html_base.py b/docutils/docutils/writers/_html_base.py
index bca1db922..fe1b64e10 100644
--- a/docutils/docutils/writers/_html_base.py
+++ b/docutils/docutils/writers/_html_base.py
@@ -183,7 +183,7 @@ class HTMLTranslator(nodes.NodeVisitor):
stylesheet_link = '<link rel="stylesheet" href="%s" type="text/css" />\n'
embedded_stylesheet = '<style type="text/css">\n\n%s\n</style>\n'
- words_and_spaces = re.compile(r'\S+| +|\n')
+ words_and_spaces = re.compile(r'[^ \n]+| +|\n')
# wrap point inside word:
in_word_wrap_point = re.compile(r'.+\W\W.+|[-?].+', re.U)
lang_attribute = 'lang' # name changes to 'xml:lang' in XHTML 1.1
diff --git a/docutils/test/test_writers/test_html4css1_parts.py b/docutils/test/test_writers/test_html4css1_parts.py
index 97affbf7e..3f02b5e0e 100755
--- a/docutils/test/test_writers/test_html4css1_parts.py
+++ b/docutils/test/test_writers/test_html4css1_parts.py
@@ -56,6 +56,16 @@ Simple String with an even simpler ``inline literal``
'html_head': '''...<title>&lt;string&gt;</title>\\n'''}
"""],
["""\
+Simple ``inline\xA0literal`` with NBSP
+""",
+"""\
+{'fragment': '''<p>Simple <tt class="docutils literal">inline&nbsp;literal</tt> with NBSP</p>\\n''',
+ 'html_body': '''<div class="document">
+<p>Simple <tt class="docutils literal">inline&nbsp;literal</tt> with NBSP</p>
+</div>\\n''',
+ 'html_head': '''...<title>&lt;string&gt;</title>\\n'''}
+"""],
+["""\
A simple `anonymous reference`__
__ http://www.test.com/test_url