Fixed the exporter to use CRLF as newline character
authorHarishankar <v.harishankar@gmail.com>
Sun, 5 Dec 2010 14:12:08 +0000 (19:42 +0530)
committerHarishankar <v.harishankar@gmail.com>
Sun, 5 Dec 2010 14:12:08 +0000 (19:42 +0530)
Fixed the exporter to use CRLF instead of the unix linefeed in
the AcrossLite(tm) export format

crosswordpuzzle.py

index 012450f..694a766 100644 (file)
@@ -80,17 +80,17 @@ class CrosswordPuzzle:
                        raise FrozenGridException
 
                across_data = []
-               across_data.append ("<ACROSS PUZZLE>\n")
-               across_data.append ("<TITLE>\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