From 9b9dc0dba2f17bfd2c57c92dde29b5ca4d3d46c7 Mon Sep 17 00:00:00 2001 From: Christopher Kent Hoadley Date: Fri, 21 Aug 2020 22:58:35 -0500 Subject: 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. --- asciidoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 == '': 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) -- cgit v1.2.1