html-template-users Mailing List for HTML::Template (Page 22)
Brought to you by:
samtregar
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(42) |
Jul
(80) |
Aug
(77) |
Sep
(97) |
Oct
(65) |
Nov
(80) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(63) |
Feb
(47) |
Mar
(45) |
Apr
(63) |
May
(67) |
Jun
(51) |
Jul
(78) |
Aug
(37) |
Sep
(45) |
Oct
(59) |
Nov
(50) |
Dec
(70) |
2004 |
Jan
(23) |
Feb
(90) |
Mar
(37) |
Apr
(53) |
May
(111) |
Jun
(71) |
Jul
(35) |
Aug
(58) |
Sep
(35) |
Oct
(35) |
Nov
(35) |
Dec
(20) |
2005 |
Jan
(51) |
Feb
(19) |
Mar
(20) |
Apr
(8) |
May
(26) |
Jun
(14) |
Jul
(49) |
Aug
(24) |
Sep
(20) |
Oct
(49) |
Nov
(17) |
Dec
(53) |
2006 |
Jan
(12) |
Feb
(26) |
Mar
(45) |
Apr
(19) |
May
(19) |
Jun
(13) |
Jul
(11) |
Aug
(9) |
Sep
(10) |
Oct
(16) |
Nov
(17) |
Dec
(13) |
2007 |
Jan
(9) |
Feb
(12) |
Mar
(28) |
Apr
(33) |
May
(12) |
Jun
(12) |
Jul
(19) |
Aug
(4) |
Sep
(4) |
Oct
(5) |
Nov
(5) |
Dec
(13) |
2008 |
Jan
(6) |
Feb
(7) |
Mar
(14) |
Apr
(16) |
May
(3) |
Jun
(1) |
Jul
(12) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
2009 |
Jan
(9) |
Feb
|
Mar
(10) |
Apr
(1) |
May
|
Jun
(6) |
Jul
(5) |
Aug
(3) |
Sep
(7) |
Oct
(1) |
Nov
(15) |
Dec
(1) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(3) |
Mar
|
Apr
(28) |
May
|
Jun
|
Jul
(3) |
Aug
(4) |
Sep
(3) |
Oct
|
Nov
(8) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Sam T. <sa...@tr...> - 2006-02-27 19:29:29
|
On Sat, 25 Feb 2006, Brad Choate wrote: > Hi all-- brand new to the list, but I've been using HTML::Template for > some time. Just to quickly introduce myself... I work at Six Apart as > one of the engineers of Movable Type. MT uses HTML::Template for all > of its application UI. Hey Brad, good to meet you. I believe I owe my mention in the book "We Blog" to Six Apart. I'll let you decide if that's a good thing or not. > First, for filters: a filter should be able to determine what file is > currently being processed, if the contents of the template did come > from a file. I guess that makes sense. I'm curious though - what are you planning to do with this feature? > Second, for template vars that are coderefs. > > To me, these are a bit limited since the coderef has no way to > determine it's context. I'm envisioning a scenario like this: > > <TMPL_LOOP NAME=X> > <TMPL_VAR NAME=CODE_FOO> > </TMPL_LOOP> > > The coderef associated with 'code_foo' is called for each iteration of > the array in parameter 'x', but 'code_foo' has no way to access the > active row of data. This seems less obviously useful to me. If the data-structure for loop X is so complicated then why make it more complicated by using code-refs? Why not just bake it all into the structure you pass to param() in the first place? I should admit, I very rarely use code-ref params in my work. They seem to have a very limited utility. I used them to implement HTML::Template::Expr, but I wouldn't say I'm proud of that fact! -sam |
From: Sam T. <sa...@tr...> - 2006-02-27 19:22:52
|
I'm switching the HTML::Template CVS repository at SourceForge over to Subversion. You can find access information here: http://sourceforge.net/svn/?group_id=1075 Let me know if you have any problems. -sam |
From: Brad C. <bc...@gm...> - 2006-02-25 18:35:34
|
Hi all-- brand new to the list, but I've been using HTML::Template for some time. Just to quickly introduce myself... I work at Six Apart as one of the engineers of Movable Type. MT uses HTML::Template for all of its application UI. I'd like to request that HTML::Template provide more useful contextual information to any user-supplied coderefs through filters and template parameters that are coderefs. First, for filters: a filter should be able to determine what file is currently being processed, if the contents of the template did come from a file. I was able to find the HTML::Template package variable that has a filename ($HTML::Template::fname), but it's the filename of the parent of the template that is passed to the filter, not the filename of the template being processed by the filter. So, if I have foo.tmpl: <TMPL_INCLUDE NAME=3Dbar.tmpl> When I process foo.tmpl with a filter parameter, the filter is invoked once for foo.tmpl, then again for bar.tmpl. The $HTML::Template::fname set during the second call is for foo.tmpl.=20 And, it would be helpful if the reference to the template object was passed to the filter too. I don't see any way to currently get either of these things. I've attached a patch for version 2.8 that adds what I'm looking for; at the very least, it may help explain what I'm wanting. Second, for template vars that are coderefs. To me, these are a bit limited since the coderef has no way to determine it's context. I'm envisioning a scenario like this: <TMPL_LOOP NAME=3DX> <TMPL_VAR NAME=3DCODE_FOO> </TMPL_LOOP> The coderef associated with 'code_foo' is called for each iteration of the array in parameter 'x', but 'code_foo' has no way to access the active row of data. Futhermore, it doesn't even know what parameter name is being used to invoke it. If I were to assign the same coderef for 'CODE_FOO' and 'CODE_BAR', the routine could do different things based on the param name. Within a loop like this, it would be cool if it could access the loop contextual values like "__first__", etc. It would also be helpful to know if the coderef was being run from within a loop, and what the name of that loop is. If it were in a loop within a loop, within a loop, in file "x.tmpl", it should be able to determine all that. I realize this would require some significant changes; by the time the output method is run, the parameter names aren't available. Perhaps if a coderef var is found during the parse step, it could wrap it with a closure that supplies the context to the original coderef. -Brad |
From: Aaron D. <aa...@da...> - 2006-02-20 20:26:43
|
We're pleased to announce that Krang v2.003 is now available. This release is comprised of several bug fixes and some small but valuable enhancements. Of note are a more streamlined ssl configuration, and a popup template chooser. Notable changes in this release: * Fixed bug in sql/mypref.sql so that user’s can’t clobber each others preferences. * Added missing setting of template param ’parent_path’ to Krang::CGI::ElementEditor::find_story_link(). * Replaced template selector in ’New Template’ and ’Find Template’ (advanced search) with category_chooser style template_chooser. * Simplied use of --module option with bin/krang_build. * Added checkbox to groups manager to allow "admin_lists" to be set. * Fixed Kang::Navigation bug where Desks were not being displayed in proper order. * Fixed internal server error when attempting to publish templates and media/stories at the same time from the UI. * Fixed internal server error when viewing media files from the Scheduler user interface. For more information about Krang, visit the Krang website: http://krang.sourceforge.net/ There you can download Krang, view screenshots, read documentation, join our mailing-lists and access the CVS tree. Detailed change-log here: http://krang.sf.net/docs/changelog.html Krang is an Open Source web-publisher / content-management system designed for large-scale magazine-style websites. It is a 100% Perl application using Apache/mod_perl and MySQL, as well as numerous CPAN modules. Krang provides a powerful and easy to use story and media editing environment for magazine editors, as well as a complete template development environment for web designers. On the back-end, Perl programmers can customize Krang to control the data entered in the story editor and add code to drive the templates to build output. Krang can be enhanced with add-ons containing new skins and other new features. Krang easily handles large data sets and can manage multiple websites in a single installation. - the Krang team ---- Aaron Dancygier |
From: David M. <dmu...@sn...> - 2006-02-16 15:09:08
|
Off topic, but with the assumption that this list reaches many Web page designers... apparently Norton Internet Security's "Ad Blocking" indiscriminately filters out images with the following dimensions: {300, 250}, {250, 250}, {240, 400}, {336, 280}, {180, 150}, {468, 60}, {234, 60}, {88, 31}, {120, 90}, {120, 60}, {120, 240}, {125, 125}, {728, 90}, {160, 600}, {120, 600}, {300, 600} -----Original Message----- From: Jason Purdy [mailto:ja...@jo...] Sent: Thursday, February 16, 2006 9:50 AM To: David Murchie Cc: htm...@li... Subject: Re: [htmltmpl] Images with height/width of 90/120??? I'm not seeing it: > $ perl ./test.pl > Content-type: text/html > > <html> > <img src="/images/image.jpg" height=90 width=120> </html> My guess is that your browser is cleaning up after you? Try putting quote marks around the numbers. - Jason |
From: David M. <dmu...@sn...> - 2006-02-16 15:02:04
|
I never thought of trying it from the command line (duh!) but it does work!!! I'm now off to the Symantec web site to find out why Norton Internet Security would filter out all images with those dimension (probably because it is a common advertisement dimension???) Never mind... and thanks! -----Original Message----- From: Jason Purdy [mailto:ja...@jo...] Sent: Thursday, February 16, 2006 9:50 AM To: David Murchie Cc: htm...@li... Subject: Re: [htmltmpl] Images with height/width of 90/120??? I'm not seeing it: > $ perl ./test.pl > Content-type: text/html > > <html> > <img src="/images/image.jpg" height=90 width=120> </html> My guess is that your browser is cleaning up after you? Try putting quote marks around the numbers. - Jason |
From: Carl F. <fir...@gm...> - 2006-02-16 14:58:58
|
Have you tried running it from a command line, and checking the output like Gabriel suggested? What the browser shows you as source, may not be exactly what is sent. The pixels in the test template aren't even from TMPL_VAR tags, so they're not being changed by html-template at all. I tried running your test program with html-template 2.8 and had no problem= s. If you find it outputs correctly at the command line but not in the browser, then it's a browser problem. In future, when asking for help, it's helpful to give relevant details such as html-template version, browser type / version, code, etc. On 16/02/06, David Murchie <dmu...@sn...> wrote: > > ALL TEST CODE BELOW -- To see what I'm talking about, try it with an img > width of 120 and then with an img width of 121 -- the entire <img> gets > dropped from the output with 120 (view source in browser): > > test.pl > ------------------------------------------------------------ > #!/usr/bin/perl -w > > use HTML::Template; > use strict; > > my $test_tmpl =3D "/your_template_directory/test.tmpl"; > my $template =3D HTML::Template->new(filename =3D> $test_tmpl); > > print "Content-type: text/html\n\n"; > print $template->output; > > > test.tmpl > ------------------------------------------------------------ > > <html> > <img src=3D"/images/image.jpg" height=3D90 width=3D120> > </html> > > > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...] On Behalf Of Car= l > Franks > Sent: Thursday, February 16, 2006 9:18 AM > To: htm...@li... > Subject: Re: [htmltmpl] Images with height/width of 90/120??? > > It'd be more helpful if you could include the code + template that you us= ed. > > > On 16/02/06, David Murchie <dmu...@sn...> wrote: > > > > > > I can't believe this is really happening but it appears that any img > > embedded in my html template that has dimensions of 120w x 90h is > "dropped" > > from the template by HTML::Template -- view the source and image tag > > is not included in the html > > > > Change either dimension by a pixel (e.g. 121w/90h) and the image > > appears -- can anyone replicate this? > > > > TIA > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=103432&bid#0486&dat=121642 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmdlnk&kid=103432&bid#0486&dat=121642 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Jason P. <ja...@jo...> - 2006-02-16 14:50:23
|
I'm not seeing it: > $ perl ./test.pl > Content-type: text/html > > <html> > <img src="/images/image.jpg" height=90 width=120> > </html> My guess is that your browser is cleaning up after you? Try putting quote marks around the numbers. - Jason |
From: David M. <dmu...@sn...> - 2006-02-16 14:38:39
|
ALL TEST CODE BELOW -- To see what I'm talking about, try it with an img width of 120 and then with an img width of 121 -- the entire <img> gets dropped from the output with 120 (view source in browser): =20 test.pl ------------------------------------------------------------ #!/usr/bin/perl -w use HTML::Template; use strict; my $test_tmpl =3D "/your_template_directory/test.tmpl"; my $template =3D HTML::Template->new(filename =3D> $test_tmpl); print "Content-type: text/html\n\n"; print $template->output; test.tmpl ------------------------------------------------------------ <html> <img src=3D"/images/image.jpg" height=3D90 width=3D120> </html> -----Original Message----- From: htm...@li... [mailto:htm...@li...] On Behalf Of = Carl Franks Sent: Thursday, February 16, 2006 9:18 AM To: htm...@li... Subject: Re: [htmltmpl] Images with height/width of 90/120??? It'd be more helpful if you could include the code + template that you = used. On 16/02/06, David Murchie <dmu...@sn...> wrote: > > > I can't believe this is really happening but it appears that any img=20 > embedded in my html template that has dimensions of 120w x 90h is "dropped" > from the template by HTML::Template -- view the source and image tag=20 > is not included in the html > > Change either dimension by a pixel (e.g. 121w/90h) and the image=20 > appears -- can anyone replicate this? > > TIA ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log = files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=103432&bid#0486&dat=121642 _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Gabriel F. <Gab...@is...> - 2006-02-16 14:19:28
|
=09From: htm...@li... [mailto:htm...@li...] On Behalf Of David Murchie =09I can't believe this is really happening but it appears that any img embedded in my html template that has dimensions of 120w x 90h is "dropped" from the template by HTML::Template -- view the source and image tag is not included in the html =09=20 =09Change either dimension by a pixel (e.g. 121w/90h) and the image appears -- can anyone replicate this? =09=20 =09 Strange indeed. Can you verify that this happens a) in all browsers, and b) if you redirect your templates output to STDOUT, instead of accessing it via a browser? Please note: This email and its content are subject to the disclaimer as = displayed at the following link http://www.is.co.za/disc.asp. Should you = not have Web access, send a mail to dis...@is... and a copy will = be emailed to you. |
From: Carl F. <fir...@gm...> - 2006-02-16 14:18:09
|
It'd be more helpful if you could include the code + template that you used= . On 16/02/06, David Murchie <dmu...@sn...> wrote: > > > I can't believe this is really happening but it appears that any img > embedded in my html template that has dimensions of 120w x 90h is "droppe= d" > from the template by HTML::Template -- view the source and image tag is n= ot > included in the html > > Change either dimension by a pixel (e.g. 121w/90h) and the image appears = -- > can anyone replicate this? > > TIA |
From: David M. <dmu...@sn...> - 2006-02-16 14:14:17
|
I can't believe this is really happening but it appears that any img embedded in my html template that has dimensions of 120w x 90h is "dropped" from the template by HTML::Template -- view the source and image tag is not included in the html Change either dimension by a pixel (e.g. 121w/90h) and the image appears -- can anyone replicate this? TIA |
From: Mark A. F. <mar...@ea...> - 2006-02-09 01:00:13
|
From: Chris Beck <htm...@pa...> >and produces an easy to read and debug html page. I may not agree with this. If you're in the reading and debugging stage, don't use the filter option. If the whitespace (which you added to the template to make the template readable) interferes with your reading and debugging of the resulting HTML file, then use a modified filter that condences multiple line feeds to one. When it's running on the production server you can use a different filter (to strip all whitespace, including whitespace between HTML tags). I agree that it seems obvious that an H::T tag standing by itself should'nt leave a residual linefeed. But, the filter works fine. And, it will be applied just once (beneficial to caching). I'd rather have H::T let me choose to do this one-time processing however I wish rather than do it form me when it outputs the template (which is where I assume it would happen if we expected it to drop linefeeds for standalone tags?). I haven't found the filter option to be punitive. Mark |
From: Chris B. <htm...@pa...> - 2006-02-08 23:29:47
|
Rumour has it Mark A. Fuller, on or about 08.Feb.2006 17:46, whispered: > But, as someone said back then: white space in HTML is not "display". > Viewing HTML is not "presentation." I ended up agreeing with that. Ah, I am not so sure. It so happens that the HTML spec allows you to ignore whitespace in many places, but that is just HTML. And yeah, I know the product is HTML::Template not Text::Template. In MVC terms HTML::Template produces a view that is reinterpreted as a model by the browser. > Adding a filter option will be a lot easier than trying to get H:T > to remove linefeeds *that you inserted*. I'm not so sure of that. In my view and I believe Alex as well, the end goal of H:T is to have a framework that takes an easy to read and maintain template and produces an easy to read and debug html page. I personally try to avoid tmpl_if statements for exactly this issue, but there are other devs on our team who have no real choice. Look, I don't want to spam people here, but you will have a hard time persuading me that behaviour that seems intuitive is actually wrong. In the meantime, I will keep using H:T because, as the kids say these days, it teh r0xors. Or something like that. Cheers, Chris -- Chris Beck - http://pacanukeha.blogspot.com "I don't think anybody anticipated the breach of the levees." - President Bush, September 1, 2005 |
From: Mark A. F. <mar...@ea...> - 2006-02-08 23:24:29
|
From: Alex Teslik <al...@ac...> > I am dealing with the formatting of a lot of plain text in <pre> and <p> tags. You can write a regex to remove whitespace only following TMPL_* tags. It doesn't have to remove *just* linefeeds or remove all linefeeds in the file. > I think the additional whitespace is also unexpected behavior. ... Expected behavior is a matter of learning how the tool works. On the one hand I agree with you that it seems intuitive that a TMPL_* tag standing on its own shouldn't leave a residual linefeed. But, what if *I* want it to? Now the solution is to add an attribute to every TMPL_* tag indicating whether it should keep or delete a trailing linefeed? And, what if I prefer using spaces or tabs for readibility? Maybe I don't stack the tags on multiple lines, but use tabs or spaces to indent them? Why shouldn't H::T do the intuitive thing with those too? The bottom line is: 1) *You* added the whitespace. 2) The whitespace doesn't affect the resulting HTML or its rendering. 3) You work with the template, not the resulting HTML. The whitespace in the resulting HTML shouldn't affect anyone. 4) Viewing the resulting HTML is not "rendering." 5) If bandwidth is an issue, stripping *all* whitespace (for H::T tags and HTML tags) using the filter option is better than stripping just a few. That was what was argued to me a year or two ago. I ended up accepting it as the correct way to look at the issue. You can always wait for the Capital One guy (Sam) to come out and say "No." :) (In the US we have a commercial where Dana Carvey plays a credit card helddesk guy who's answer to everything is "No." Every time I see it I think of Sam.). Mark |
From: Alex T. <al...@ac...> - 2006-02-08 22:53:18
|
On Wed, 8 Feb 2006 14:30:16 -0700 (GMT-07:00), Mark A. Fuller wrote > I raised this issue a year or two ago and it wasn't well-received. Hi Mark, I completely agree that the filter option is an excellent feature, but I'm not certain it is the right feature to use for stripping linefeeds. I am dealing with the formatting of a lot of plain text in <pre> and <p> tags. In most cases, there are linefeeds inbetween those tags that I don't want to remove. While I *could* write code to handle that, that may not be the best approach... I havn't looked into the H:T code too much, but I would imagine its doing some sort of tokenizing of the template before switching out the TMPL tags. Why go through the trouble of re-tokenizing the data in a filter to isolate <p> and <pre> from getting stripped if its an option that could be more easily added to H:T? I think the additional whitespace is also unexpected behavior. If I write: <TMPL_IF QUANTITY> <TMPL_VAR AMOUNT> <TMPL_ELSE> None </TMPL_IF> the output I expect is: "None" not: " None " Be flexible in what you accept and rigid in what you produce. Alex |
From: Mark A. F. <mar...@ea...> - 2006-02-08 22:47:00
|
From: Chris Beck <htm...@pa...> >H:T, in my view, is most useful to separate display from code. Adding more >layers and wrappers of code to affect display is counter-productive. I fully understand your argument because *I* made it a year or two ago. I feel like I'm arguing against myself. :) But, as someone said back then: white space in HTML is not "display". Viewing HTML is not "presentation." I ended up agreeing with that. Adding a filter option will be a lot easier than trying to get H:T to remove linefeeds *that you inserted*. That was my conclusion after arguing the point a year or two ago. Hope that helps, Mark |
From: Paulsen, B. <BPa...@le...> - 2006-02-08 22:35:55
|
Wasn't there a push a while back to have a HTML::Template::Filter class that would have commonly used filters=3F =20 -----Original Message----- =46rom: htm...@li... [mailto:htm...@li...] On Behalf Of Mark A. Fuller Sent: Wednesday, February 08, 2006 4:30 PM To: Alex Teslik; htm...@li... Subject: Re: [htmltmpl] extra whitespace =46rom: Alex Teslik <al...@ac...> >Is there a switch (feature request=3F) that will tell HTMLTMPL to replace >a TMPL followed by [\n\r]+ with nothing - even better replace the whole >line if the only thing on the line is a TMPL tag=3F I raised this issue a year or two ago and it wasn't well-received. It seems like it's common for newcomers (as I was) to spot this and believe it's a shortcoming in H::T. Among experienced users, they believe it's easier and faster to use the "filter" option to strip *all* linefeeds if wasted bandwidth is your motivation to remove some. If the performance overhead of using the "filter" option is a concern, then preprocess your templates to load, filter and output them to another file which will be your template to be used at run-time.=20 I do this for other reasons, like if there is common processing to be applied to parts of the page once. For example: international language substitution of headings, labels, etc. I use tags prefixed as "PREPROC-" in my *master* template to differentiate things that need to be preprocessed versus the tags that are dynamically set at run time. I use a batch script to load the template and "filter" the TMPL- tags to "HOLD-" tags, change the "PREPROC-" tags to "TMPL-" tags. I don't strip the linefeeds in this filter. I do my preprocessing to set TMPL-VARS and LOOPS as necessary for one-time initialization of the page (for example, language substitution). I output the H::T object to a variable and perform a regex on the variable to change all the "HOLD-" tags to "TMPL-" tags. This is where I strip the linefeeds. Then print this variable to a file which will be the template used at runtime. So, I have a master template (with includes, etc.) and a run-time template that needs no run-time processing except the actual variables that can change at run time (messages, dynamically generated lists, etc.). That's probably a much more complicated example than what you need just to strip linefeeds. The filter option will work for you. I just wanted to demonstrate that there's a lot of ways to solve a problem with H::T if you realize you're not stuck with just one preconceived way to use it. It took me awhile to get that through my head. In the end I agreed that it's superior to use features like I described above than to burden H::T with indicators about what is essentially formatting (retention or removal). Hope that helps. Mark ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log =66iles for problems=3F Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel=3Fcmd=3Dk&kid=103432&bid#0486&dat=121642 _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users ---------------------------------------------------------------------------= --- This message is intended only for the personal and confidential use of the = designated recipient(s) named above. If you are not the intended recipient= = of this message you are hereby notified that any review, dissemination, = distribution or copying of this message is strictly prohibited. This = communication is for information purposes only and should not be regarded a= s= an offer to sell or as a solicitation of an offer to buy any financial = product, an official confirmation of any transaction, or as an official = statement of Lehman Brothers. Email transmission cannot be guaranteed to b= e= secure or error-free. Therefore, we do not represent that this informatio= n= is complete or accurate and it should not be relied upon as such. All = information is subject to change without notice. ---------- IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within = this communication (including any attachments) is not intended or written t= o= be used and cannot be used for the purpose of (i) avoiding U.S. tax relate= d= penalties or (ii) promoting, marketing or recommending to another party an= y= transaction or matter addressed herein. |
From: Chris B. <htm...@pa...> - 2006-02-08 22:35:20
|
Rumour has it Mark A. Fuller, on or about 08.Feb.2006 16:30, whispered: > I raised this issue a year or two ago and it wasn't well-received. > It seems like it's common for newcomers (as I was) to spot this > and believe it's a shortcoming in H::T. Look, of course there are ways around it, with multiple levels of filtering, pre- and post- processing. This is Perl, after all, TIMTOWTDI. I do not argue that H:T should be the be-all and end-all of frameworks and that every single minor feature should be slopped in, but hat doesn't change the fact that if a _lot_ of people come across the same issue with a framework and there is a clear scenario that spans most people's use cases, then it makes sense to do it in H:T. H:T, in my view, is most useful to separate display from code. Adding more layers and wrappers of code to affect display is counter-productive. Cheers, Chris -- Chris Beck - http://pacanukeha.blogspot.com Clearly we living breathing citizens should have more rights than the legal artifices called corporate entities. Our social contract is more important to Democracy than their market place only model with its over reliance on the metrics of the 90 day number and the bottom line. -- Jock Gill |
From: Mark A. F. <mar...@ea...> - 2006-02-08 22:11:29
|
From: Alex Teslik <al...@ac...> >Is there a switch (feature request?) that will tell HTMLTMPL to replace a >TMPL followed by [\n\r]+ with nothing - even better replace the whole line= if >the only thing on the line is a TMPL tag?=20 I raised this issue a year or two ago and it wasn't well-received. It seems= like it's common for newcomers (as I was) to spot this and believe it's a = shortcoming in H::T. Among experienced users, they believe it's easier and = faster to use the "filter" option to strip *all* linefeeds if wasted bandwi= dth is your motivation to remove some. If the performance overhead of using= the "filter" option is a concern, then preprocess your templates to load, = filter and output them to another file which will be your template to be us= ed at run-time.=20 I do this for other reasons, like if there is common processing to be appli= ed to parts of the page once. For example: international language substitut= ion of headings, labels, etc. I use tags prefixed as "PREPROC-" in my *mast= er* template to differentiate things that need to be preprocessed versus th= e tags that are dynamically set at run time. I use a batch script to load t= he template and "filter" the TMPL- tags to "HOLD-" tags, change the "PREPRO= C-" tags to "TMPL-" tags. I don't strip the linefeeds in this filter. I do = my preprocessing to set TMPL-VARS and LOOPS as necessary for one-time initi= alization of the page (for example, language substitution). I output the H:= :T object to a variable and perform a regex on the variable to change all t= he "HOLD-" tags to "TMPL-" tags. This is where I strip the linefeeds. Then = print this variable to a file which will be the template used at runtime. S= o, I have a master template (with includes, etc.) and a run-time template t= hat needs no run-time processing except the actual variables that can chang= e at run time (messages, dynamically generated lists, etc.). That's probably a much more complicated example than what you need just to = strip linefeeds. The filter option will work for you. I just wanted to demo= nstrate that there's a lot of ways to solve a problem with H::T if you real= ize you're not stuck with just one preconceived way to use it. It took me a= while to get that through my head. In the end I agreed that it's superior t= o use features like I described above than to burden H::T with indicators a= bout what is essentially formatting (retention or removal). Hope that helps. Mark |
From: Paulsen, B. <BPa...@le...> - 2006-02-08 18:25:18
|
I think a filter function would do this for you easily. Something like this: my $filter =3D sub { my $text_ref =3D shift; $$text_ref =3D~ s/(<TMPL_[~>]>)[\r\n]+/$1/g; };=20 -----Original Message----- =46rom: htm...@li... [mailto:htm...@li...] On Behalf Of htm...@pa... Sent: Wednesday, February 08, 2006 1:19 PM To: htm...@li... Subject: Re: [htmltmpl] extra whitespace Rumour has it Alex Kapranoff, on or about 08.Feb.2006 12:57, whispered: > * Alex Teslik <al...@ac...> [February 08 2006, 20:43]: >> Is there a switch (feature request=3F) that will tell HTMLTMPL to=20 >> replace a TMPL followed by [\n\r]+ with nothing - even better replace >> the whole line if <snip> >> tag creates hard to read template files. In particular, this would be >> useful for the TMPL_LOOP and TMPL_IF/UNLESS constructs. >=20 > That would be very useful option indeed if done well and fast. > I'd use it everywhere. >=20 Oh yes indeedy. Me too. -- Chris Beck - http://pacanukeha.blogspot.com He needs a lang shanket spoon that sups kail wi' the de'il ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log =66iles for problems=3F Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel=3Fcmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users ---------------------------------------------------------------------------= --- This message is intended only for the personal and confidential use of the = designated recipient(s) named above. If you are not the intended recipient= = of this message you are hereby notified that any review, dissemination, = distribution or copying of this message is strictly prohibited. This = communication is for information purposes only and should not be regarded a= s= an offer to sell or as a solicitation of an offer to buy any financial = product, an official confirmation of any transaction, or as an official = statement of Lehman Brothers. Email transmission cannot be guaranteed to b= e= secure or error-free. Therefore, we do not represent that this informatio= n= is complete or accurate and it should not be relied upon as such. All = information is subject to change without notice. -------- IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within = this communication (including any attachments) is not intended or written t= o= be used and cannot be used for the purpose of (i) avoiding U.S. tax relate= d= penalties or (ii) promoting, marketing or recommending to another party an= y= transaction or matter addressed herein. |
From: <htm...@pa...> - 2006-02-08 18:19:07
|
Rumour has it Alex Kapranoff, on or about 08.Feb.2006 12:57, whispered: > * Alex Teslik <al...@ac...> [February 08 2006, 20:43]: >> Is there a switch (feature request?) that will tell HTMLTMPL to replace a >> TMPL followed by [\n\r]+ with nothing - even better replace the whole line if <snip> >> tag creates hard to read template files. In particular, this would be useful >> for the TMPL_LOOP and TMPL_IF/UNLESS constructs. > > That would be very useful option indeed if done well and fast. > I'd use it everywhere. > Oh yes indeedy. Me too. -- Chris Beck - http://pacanukeha.blogspot.com He needs a lang shanket spoon that sups kail wi' the de'il |
From: Alex K. <ka...@ra...> - 2006-02-08 17:56:26
|
* Alex Teslik <al...@ac...> [February 08 2006, 20:43]: > Is there a switch (feature request?) that will tell HTMLTMPL to replace a > TMPL followed by [\n\r]+ with nothing - even better replace the whole line if > the only thing on the line is a TMPL tag? Currently, the TMPL tags are > removed, but the \n or \r that trail them are not. The result is HTML with > large amounts of whitespace. The workaround of not putting a \n after a TMPL > tag creates hard to read template files. In particular, this would be useful > for the TMPL_LOOP and TMPL_IF/UNLESS constructs. That would be very useful option indeed if done well and fast. I'd use it everywhere. -- Alex Kapranoff, $n=["1another7Perl213Just3hacker49"=~/\d|\D*/g]; $$n[0]={grep/\d/,@$n};print"@$n{1..4}\n" |
From: Alex T. <al...@ac...> - 2006-02-08 17:43:24
|
Hello, Is there a switch (feature request?) that will tell HTMLTMPL to replace a TMPL followed by [\n\r]+ with nothing - even better replace the whole line if the only thing on the line is a TMPL tag? Currently, the TMPL tags are removed, but the \n or \r that trail them are not. The result is HTML with large amounts of whitespace. The workaround of not putting a \n after a TMPL tag creates hard to read template files. In particular, this would be useful for the TMPL_LOOP and TMPL_IF/UNLESS constructs. Alex |
From: Karen <kar...@gm...> - 2006-02-02 15:57:15
|
It would be really cool if there were something like this: http://search.cpan.org/~rubykat/HTML-LinkList-0.07/lib/HTML/LinkList.pm only that produced TMPL_LOOPish results instead of final HTML, so you could do funky things like: my $html_links =3D link_list(current_url=3D>$url, urls=3D>\@links_in_order, labels=3D>\%labels, descriptions=3D>\%desc); $template->param('navbar', $html_links); and let the template manage the style and separators and whatnot. I say this hoping someone else with more time than I have thinks it's cool too and will do it, because otherwise I will... eventually.=20 Someday. |