-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! fix(jira2markdown): process windows line breaks as a Unix line…
… breaks
- Loading branch information
Showing
7 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from pyparsing import LineEnd, ParseException, ParseImplReturnType | ||
|
||
|
||
class UniversalLineEnd(LineEnd): | ||
def __init__(self): | ||
super().__init__() | ||
self.whiteChars.discard("\r\n") | ||
|
||
def parseImpl(self, instring, loc, do_actions=True) -> ParseImplReturnType: | ||
if loc < len(instring): | ||
if instring.startswith("\r\n", loc): | ||
return loc + 2, "\n" | ||
elif instring[loc] in ("\n", "\r"): | ||
return loc + 1, "\n" | ||
else: | ||
raise ParseException(instring, loc, self.errmsg, self) | ||
elif loc == len(instring): | ||
return loc + 1, [] | ||
else: | ||
raise ParseException(instring, loc, self.errmsg, self) |