|
@@ -91,17 +91,31 @@ class Preprocessor {
|
|
}
|
|
}
|
|
|
|
|
|
static function trimExtraSpaces( str:String ) : String {
|
|
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(4));
|
|
|
|
|
|
+ var reg = null;
|
|
|
|
|
|
- reg = ~/(<\/mt>)(\s+)(<\/mt>)/g;
|
|
|
|
- while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1)+reg.matched(3));
|
|
|
|
|
|
+ reg = ~/^\s+(<mt mt:[a-z]+="[^"]+"\/?>)\s*?\n/gm;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1));
|
|
|
|
|
|
- reg = ~/(\<mt .*?("|"\/)\>)(\s+)(\<)/g;
|
|
|
|
- while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1)+reg.matched(4));
|
|
|
|
|
|
+ reg = ~/^\s+(<\/?mt>)\s*?\n/gm;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1));
|
|
|
|
|
|
- reg = ~/(<\/mt>)(\s+)(<\/mt>)/g;
|
|
|
|
- while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1)+reg.matched(3));
|
|
|
|
|
|
+ reg = ~/^\s+(<mt mt:[a-z]+="[^"]+"\/?>)\s*?\n/gm;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1));
|
|
|
|
+
|
|
|
|
+ reg = ~/^\s+(<\/?mt>)\s*?\n/gm;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1));
|
|
|
|
+
|
|
|
|
+ reg = ~/\s+((<|<)mt mt:(set)="[^"]+"\/?(>|>))\s+/g;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1));
|
|
|
|
+
|
|
|
|
+ reg = ~/(<mt mt:[^=]+="[^"]+"\/?>)\s+(<\/?mt)/g;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1)+reg.matched(2));
|
|
|
|
+
|
|
|
|
+ reg = ~/(<mt mt:[^=]+="[^"]+"\/?>)\s+(<\/?mt)/g;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1)+reg.matched(2));
|
|
|
|
+
|
|
|
|
+ reg = ~/(<\/mt>)\s+(<\/?mt)/g;
|
|
|
|
+ while (reg.match(str)) str = StringTools.replace(str, reg.matched(0), reg.matched(1)+reg.matched(2));
|
|
|
|
|
|
return str;
|
|
return str;
|
|
}
|
|
}
|