Explorar el Código

- template output slightly beautified

Laurent Bedubourg hace 19 años
padre
commit
df397b55fe
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. 9 1
      std/mtwin/templo/Preprocessor.hx

+ 9 - 1
std/mtwin/templo/Preprocessor.hx

@@ -87,7 +87,15 @@ class Preprocessor {
 		}
 		res = unescapeCdata1(res);
 		res = escapePrints(res);
-		return "<mt>" + res + "</mt>";
+		return trimExtraSpaces("<mt>" + res + "</mt>");
+	}
+
+	static function trimExtraSpaces( str:String ) : String {
+		var reg = ~/(\<mt [^>]+\>)(\s+)(\<)/g;
+		while (reg.match(str)){
+			str = StringTools.replace(str, reg.matched(0), reg.matched(1)+reg.matched(3));
+		}
+		return str;
 	}
 
 	public static function expandMacros( str:String ) : String {