Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions transcrypt/modules/org/transcrypt/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@ def visit_ClassDef (self, node):
if self.allowDocAttribs:
docString = ast.get_docstring (node)
if docString:
self.emit (' .__setdoc__ (\'{}\')', docString.replace ('\n', '\\n '))
self.emit (' .__setdoc__ (\'{}\')', docString.replace ('\n', '\\n ').replace('\'', '\\\''))

# Deal with data class var assigns, a flavor of special class var assigns
if isDataClass: # Constructor + params have to be generated, no real class vars, just syntactically
Expand Down Expand Up @@ -2747,7 +2747,7 @@ def pushPropertyAccessor(functionName):
if self.allowDocAttribs:
docString = ast.get_docstring (node)
if docString:
self.emit (' .__setdoc__ (\'{}\')', docString.replace ('\n', '\\n '))
self.emit (' .__setdoc__ (\'{}\')', docString.replace ('\n', '\\n ').replace('\'', '\\\''))


if decorate:
Expand Down Expand Up @@ -3102,7 +3102,7 @@ def visit_Module (self, node):

# Insert docstring at hoist location, further hoists are PRE(!)pended
if self.allowDocAttribs and docString:
self.emit ('export var __doc__ = \'{}\';\n', docString.replace ('\n', '\\n'))
self.emit ('export var __doc__ = \'{}\';\n', docString.replace ('\n', '\\n').replace ('\'', '\\\''))

'''
Make the globals () function work as well as possible in conjunction with JavaScript 6 modules rather than closures
Expand Down