Loading ...
Sorry, an error occurred while loading the content.

[Cheetahtemplate-discuss] [PATCH 2/2] only split multiline strings in output code at repr generated breaks

Expand Messages
  • Doug Knight
    ... cheetah/Compiler.py | 4 ++-- cheetah/Parser.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cheetah/Compiler.py
    Message 1 of 1 , Dec 14, 2009
    • 0 Attachment
      ---
      cheetah/Compiler.py | 4 ++--
      cheetah/Parser.py | 2 +-
      2 files changed, 3 insertions(+), 3 deletions(-)

      diff --git a/cheetah/Compiler.py b/cheetah/Compiler.py
      index 248ba1f..a9a8570 100644
      --- a/cheetah/Compiler.py
      +++ b/cheetah/Compiler.py
      @@ -438,13 +438,13 @@ class MethodCompiler(GenUtils):
      if not strConst:
      return
      else:
      - reprstr = repr(strConst).replace('\\012','\n')
      + reprstr = repr(strConst)
      i = 0
      out = []
      if reprstr.startswith('u'):
      i = 1
      out = ['u']
      - body = escapedNewlineRE.sub('\n', reprstr[i+1:-1])
      + body = escapedNewlineRE.sub('\\1\n', reprstr[i+1:-1])

      if reprstr[i]=="'":
      out.append("'''")
      diff --git a/cheetah/Parser.py b/cheetah/Parser.py
      index bb70d06..2fdeae5 100644
      --- a/cheetah/Parser.py
      +++ b/cheetah/Parser.py
      @@ -153,7 +153,7 @@ unicodeDirectiveRE = re.compile(
      encodingDirectiveRE = re.compile(
      r'(?:^|\r\n|\r|\n)\s*#\s{0,5}encoding[:\s]*([-\w.]*)\s*(?:\r\n|\r|\n)', re.MULTILINE)

      -escapedNewlineRE = re.compile(r'(?<!\\)\\n')
      +escapedNewlineRE = re.compile(r'(?<!\\)((\\\\)*)\\(n|012)')

      directiveNamesAndParsers = {
      # importing and inheritance
      --
      1.6.5.2


      ------------------------------------------------------------------------------
      Return on Information:
      Google Enterprise Search pays you back
      Get the facts.
      http://p.sf.net/sfu/google-dev2dev
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    Your message has been successfully submitted and would be delivered to recipients shortly.