jquery-tmpl icon indicating copy to clipboard operation
jquery-tmpl copied to clipboard

Please don't remove newline characters and remove newline character after }}

Open manan6 opened this issue 14 years ago • 1 comments

Although newline character is ignored in html, i want use jquery-templ to convert a text file. The newline character is important in the conversion result. And the newline after }} generate alot of blank lines in the result.

I improved it by modify fregment of function buildTmplFn() from


.replace( /(['])/g, "$1" ) .replace( /[\r\t\n]/g, " " ) .replace( /[\t]/g, " " ) .replace( /${([^}])}/g, "{{= $1}}" ) .replace( /{{(/?)(\w+|.)(?:(((?:[^}]|}(?!}))?)?))?(?:\s+(.?)?)?((((?:[^}]|}(?!}))?)))?\s*}}/g, function( all, slash, type, fnargs, target, parens, args ) { ...... }) +


to


.replace( /(['])/g, "$1" ) //.replace( /[\r\t\n]/g, " " ) .replace( /[\t]/g, " " ) .replace( /${([^}])}/g, "{{= $1}}" ) .replace( /{{(/?)(\w+|.)(?:(((?:[^}]|}(?!}))?)?))?(?:\s+(.?)?)?((((?:[^}]|}(?!}))?)))?\s_}}\s_/g, function( all, slash, type, fnargs, target, parens, args ) { ...... }).replace( /\r/g, "\r" ) .replace( /\n/g, "\n" ) +


Just suggestion because i used it in abnormal condication.

manan6 avatar Aug 25 '11 06:08 manan6

Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.

rdworth avatar Oct 08 '11 06:10 rdworth