* Escapes content for use in a Python raw triple-quoted string (r"""). * Raw strings don't interpret escape sequences, so we can't use backslashes to escape. * When we encounter triple quotes, we break the raw string and concatenate with a regular string.
(str: string)
| 294 | * When we encounter triple quotes, we break the raw string and concatenate with a regular string. |
| 295 | */ |
| 296 | function escapeTripleQuote(str: string): string { |
| 297 | // Split the raw string at """ and concatenate with a regular string containing the quote |
| 298 | // r"""text""" becomes r"""text""" + '"' + r"""more""" |
| 299 | return str.replace(/"""/g, '"""+\'"\'+r"""') |
| 300 | } |
no outgoing calls
no test coverage detected