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
						
					
					
				
			
		
		
	
	
							63 lines
						
					
					
						
							2.1 KiB
						
					
					
				| # --- SDE-COPYRIGHT-NOTE-BEGIN --- | |
| # This copyright note is auto-generated by ./scripts/Create-CopyPatch. | |
| # | |
| # Filename: package/.../lua-codegen/b6a6252bd878015bded6201a2d71fd6dbe3b4e20.patch | |
| # Copyright (C) 2011 The OpenSDE Project | |
| # | |
| # More information can be found in the files COPYING and README. | |
| # | |
| # This patch file is dual-licensed. It is available under the license the | |
| # patched project is licensed under, as long as it is an OpenSource license | |
| # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms | |
| # of the GNU General Public License as published by the Free Software | |
| # Foundation; either version 2 of the License, or (at your option) any later | |
| # version. | |
| # --- SDE-COPYRIGHT-NOTE-END --- | |
|  | |
| From b6a6252bd878015bded6201a2d71fd6dbe3b4e20 Mon Sep 17 00:00:00 2001 | |
| From: Francois Perrad <[email protected]> | |
| Date: Tue, 7 Jun 2011 16:32:58 +0200 | |
| Subject: [PATCH] fix interpolate : handles the last line of a template even if no newline | |
|  | |
| --- | |
|  CHANGES         |    4 ++++ | |
|  src/CodeGen.lua |    3 +-- | |
|  2 files changed, 5 insertions(+), 2 deletions(-) | |
|  | |
| diff --git a/CHANGES b/CHANGES | |
| index 86f9fce..1c8e747 100644 | |
| --- a/CHANGES | |
| +++ b/CHANGES | |
| @@ -1,5 +1,9 @@ | |
|  Revision history for lua-CodeGen | |
|   | |
| +0.2.2 | |
| +	- fix interpolate : handles the last line of a template even if no newline | |
| +		(reported by Alejandro Mery) | |
| + | |
|  0.2.1  Fri Nov 26 10:30:00 2010 | |
|  	- fix compatibility with Lua 5.2.0 alpha | |
|   | |
| diff --git a/src/CodeGen.lua b/src/CodeGen.lua | |
| index c78f4d9..18b25e9 100644 | |
| --- a/src/CodeGen.lua | |
| +++ b/src/CodeGen.lua | |
| @@ -197,14 +197,13 @@ local function eval (self, name) | |
|   | |
|          if template:find "\n" then | |
|              local results = {} | |
| -            for line in template:gmatch "([^\n]*)\n" do | |
| +            for line in template:gmatch "([^\n]*)\n?" do | |
|                  local result = interpolate_line(line) | |
|                  if result == line or not result:match'^%s*$' then | |
|                      results[#results+1] = result | |
|                  end | |
|                  lineno = lineno + 1 | |
|              end | |
| -            results[#results+1] = '' | |
|              return tconcat(results, "\n") | |
|          else | |
|              return interpolate_line(template) | |
| --  | |
| 1.7.4.1 | |
| 
 | |
| 
 |