OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.1 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../lua-codegen/b6a6252bd878015bded6201a2d71fd6dbe3b4e20.patch
  5. # Copyright (C) 2011 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From b6a6252bd878015bded6201a2d71fd6dbe3b4e20 Mon Sep 17 00:00:00 2001
  17. From: Francois Perrad <francois.perrad@gadz.org>
  18. Date: Tue, 7 Jun 2011 16:32:58 +0200
  19. Subject: [PATCH] fix interpolate : handles the last line of a template even if no newline
  20. ---
  21. CHANGES | 4 ++++
  22. src/CodeGen.lua | 3 +--
  23. 2 files changed, 5 insertions(+), 2 deletions(-)
  24. diff --git a/CHANGES b/CHANGES
  25. index 86f9fce..1c8e747 100644
  26. --- a/CHANGES
  27. +++ b/CHANGES
  28. @@ -1,5 +1,9 @@
  29. Revision history for lua-CodeGen
  30. +0.2.2
  31. + - fix interpolate : handles the last line of a template even if no newline
  32. + (reported by Alejandro Mery)
  33. +
  34. 0.2.1 Fri Nov 26 10:30:00 2010
  35. - fix compatibility with Lua 5.2.0 alpha
  36. diff --git a/src/CodeGen.lua b/src/CodeGen.lua
  37. index c78f4d9..18b25e9 100644
  38. --- a/src/CodeGen.lua
  39. +++ b/src/CodeGen.lua
  40. @@ -197,14 +197,13 @@ local function eval (self, name)
  41. if template:find "\n" then
  42. local results = {}
  43. - for line in template:gmatch "([^\n]*)\n" do
  44. + for line in template:gmatch "([^\n]*)\n?" do
  45. local result = interpolate_line(line)
  46. if result == line or not result:match'^%s*$' then
  47. results[#results+1] = result
  48. end
  49. lineno = lineno + 1
  50. end
  51. - results[#results+1] = ''
  52. return tconcat(results, "\n")
  53. else
  54. return interpolate_line(template)
  55. --
  56. 1.7.4.1