Re: [htmltmpl] Stripping blank lines caused by TMPL tags
Brought to you by:
samtregar
From: Clifton R. <cli...@ti...> - 2005-09-27 20:05:31
|
On Tue, Sep 27, 2005 at 03:23:14PM -0400, David Steinbrunner wrote: > Hello, > > I would first like to say I'm a long time user, first time poster... > > I have always used HTML::Template to generate web pages in the past but have > recently started work on a project that creates a config file and I decided > to use HTML::Template to help separated the hard coded config info from my > code. This has worked out great in all but one regard. > > All the non TMPL_VAR tags end up leaving blank lines behind because I leave > them on their own lines for the sake of being able to read the tmpl file > easily. This how ever makes it hard to read the generated config file > because of all the extra white space. I had similar problems when I was trying to use it to generate a text-only version of an email along with an HTML-version of the same email. > I have always felt this was an issue but did not care enough to post about > it because the results were "just" HTML source and the like. I can deal > with reading spaced out HTML source but this config is going to be read by > others that will need to be able to read and understand it quickly. This can also cause problems even in HTML, when (for example) there are conditional expressions with the result of the expression embedded in a variable value. As I recall there is a kludge where you can work around it with some very odd formatting of the original template - place the trailing newline *inside* the intermediate and end tags, e.g : "<TMPL_IF foo>bar< TMPL_ELSE>baz< /TMPL_IF >" results in "bar" or "baz" rather than having embedded newlines. ... > This gets me the results I was looking for but feel that it is very much a > kludge. Have I missed something in the docs like a param for the > constructor that automagicly does the same thing I have done minus me having > to do anything? Having seen the results of an HTML::Template minus the > blank lines makes me want to see such results all the time without modifying > my code and templates to do so. FWIW, I'm not very actively working with HTML::Template right now, but if I were I would definitely want to use such a feature. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect "My own personal theory is that this is the very dawn of the world. We're hardly more than an eyeblink away from the fall of Troy, and scarcely an interglaciation removed from the Altamira cave painters. We live in extremely interesting ancient times. I like this idea. It encourages us to be earnest and ingenious and brave, as befits ancestral peoples; but keeps us from deciding that because we don't know all the answers, they must be unknowable and thus unprofitable to pursue." -- Teresa Nielsen Hayden, 1995 |