summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Kent Hoadley <chris.hoadley@gmail.com>2020-08-21 22:58:35 -0500
committerGitHub <noreply@github.com>2020-08-21 23:58:35 -0400
commit9b9dc0dba2f17bfd2c57c92dde29b5ca4d3d46c7 (patch)
treeebc64f74578b377f129c4be47bb2f091fe50a554
parent01fd9b7038de83f84921cbb4c4a077b4902ec578 (diff)
downloadasciidoc-py3-9b9dc0dba2f17bfd2c57c92dde29b5ca4d3d46c7.tar.gz
Disable universal newlines for writer (#140)
Problems noticed on Windows where preformatted blocks (e.g. source & literal blocks) have an extra space between each line. In fact, *all* lines have this extra space, but it is only noticeable on preformatted blocks where the extra line spacing is visible. By default, Python 3 has universal newlines mode enabled, which makes outputting files with various line endings simpler. However, AsciiDoc is already handling this internally, so we ended up with extra lines being inserted. In the actual output file, every line on Windows ended with "/r/r/n". This was not a problem on systems that used UNIX line endings. Solve this by disabling universal newlines when outputting the file.
-rwxr-xr-xasciidoc.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/asciidoc.py b/asciidoc.py
index 14641e9..bcb4179 100755
--- a/asciidoc.py
+++ b/asciidoc.py
@@ -4594,7 +4594,7 @@ class Writer:
if fname == '<stdout>':
self.f = sys.stdout
else:
- self.f = open(fname, 'w+', encoding='utf-8')
+ self.f = open(fname, 'w+', encoding='utf-8', newline="")
message.verbose('writing: ' + writer.fname, False)
if bom:
self.f.write(bom)