Skip to content

Commit

Permalink
Remove line_sep option in favor of document line ending
Browse files Browse the repository at this point in the history
Inspired by #23
  • Loading branch information
fitnr committed May 27, 2017
1 parent 4c6b564 commit 66380a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
8 changes: 7 additions & 1 deletion DataConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
Freely adapted from Mr. Data Converter: http://shancarter.com/data_converter/
"""
LINEENDINGS = {
'Unix': '\n',
'Windows': '\r\n',
'CR': '\r',
'LF': '\n',
}

# Borrowed from Apply Syntax

Expand Down Expand Up @@ -278,7 +284,7 @@ def get_settings(self, kwargs):
settings['typed'] = kwargs['format'] not in self.untyped_formats

# New lines
settings['newline'] = user_settings.get('line_sep') or os.linesep
settings['newline'] = LINEENDINGS.get(self.view.line_endings(), os.linesep)

user_quoting = user_settings.get('quoting', 'QUOTE_MINIMAL')
settings['quoting'] = getattr(csv, user_quoting, csv.QUOTE_MINIMAL)
Expand Down
4 changes: 0 additions & 4 deletions DataConverter.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
// When false, DataConverter will assume there are no headers, and use default headers ([val1, val2, ...])
"headers": "sniff",

// Newline character for output. Set to either a character or null.
// When null, DataConverter uses the OS line separator, which is "\r" in Windows.
"line_sep": null,

// Define a dialect for the csv reader
// Check the python docs for a description of how to define a dialect
// https://docs.python.org/3.3/library/csv.html#dialects-and-formatting-parameters
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ Possible values: `"sniff"`, `true`, or `false`.
````
When true, the first row is always treated as the header row. When "sniff", DataConverter will sniff for headers (sniffing isn't perfect). When false, DataConverter will assume there are no headers, and use default headers (`[val1, val2, ...]`).

#### line_sep
Character or null
````
"line_sep": null
````
Newline character for output. Set to either a character or `null`. When `null`, DataConverter uses the OS line separator, which is `"\r"` in Windows.

#### dialects
Object
````
Expand Down

0 comments on commit 66380a9

Please sign in to comment.