From f9926c428d81940df4d22a6caeffa9865057b12c Mon Sep 17 00:00:00 2001 From: Harishankar Date: Sun, 5 Dec 2010 19:42:08 +0530 Subject: [PATCH] Fixed the exporter to use CRLF as newline character Fixed the exporter to use CRLF instead of the unix linefeed in the AcrossLite(tm) export format --- crosswordpuzzle.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/crosswordpuzzle.py b/crosswordpuzzle.py index 012450f..694a766 100644 --- a/crosswordpuzzle.py +++ b/crosswordpuzzle.py @@ -80,17 +80,17 @@ class CrosswordPuzzle: raise FrozenGridException across_data = [] - across_data.append ("\n") - across_data.append ("\n") - across_data.append (title + "\n") - across_data.append ("<AUTHOR>\n") - across_data.append (author + "\n") - across_data.append ("<COPYRIGHT>\n") - across_data.append (copyright + "\n") - across_data.append ("<SIZE>\n") + across_data.append ("<ACROSS PUZZLE>\r\n") + across_data.append ("<TITLE>\r\n") + across_data.append (title + "\r\n") + across_data.append ("<AUTHOR>\r\n") + across_data.append (author + "\r\n") + across_data.append ("<COPYRIGHT>\r\n") + across_data.append (copyright + "\r\n") + across_data.append ("<SIZE>\r\n") str_size = str (self.cols) + "x" + str (self.rows) - across_data.append (str_size + "\n") - across_data.append ("<GRID>\n") + across_data.append (str_size + "\r\n") + across_data.append ("<GRID>\r\n") for row in range (self.rows): for col in range (self.cols): if (self.data[row][col].occupied_across is True or @@ -98,23 +98,23 @@ class CrosswordPuzzle: across_data.append (self.data[row][col].char) else: across_data.append (".") - across_data.append ("\n") + across_data.append ("\r\n") - across_data.append ("<ACROSS>\n") + across_data.append ("<ACROSS>\r\n") clues_across = self.get_clues_across () for word, clue in clues_across: if clue: - across_data.append (clue + "\n") + across_data.append (clue + "\r\n") else: - across_data.append ("(No clue yet)\n") + across_data.append ("(No clue yet)\r\n") - across_data.append ("<DOWN>\n") + across_data.append ("<DOWN>\r\n") clues_down = self.get_clues_down () for word, clue in clues_down: if clue: - across_data.append (clue + "\n") + across_data.append (clue + "\r\n") else: - across_data.append ("(No clue yet\n") + across_data.append ("(No clue yet\r\n") acrosslite_str = "".join (across_data) return acrosslite_str -- 2.20.1