Hi all, I'm trying the Template Toolkit for the first time, so sorry for maybe silly question...
I've got this input (input.tt2) template file: ------------------- first = [% var1 %] second = [% var2 %] third = [% var3 %] fourth = [% var4 %] ------------------- Using command: "tpage --define var1=1st --define var3=3rd input.tt2" I get this output: ------------------ first = 1st second = third = 3rd fourth = ------------------ When some variable (in my case "var2") is not defined, an empty string is used. Q1) Is there any possibility to remove the _whole_ line when the variable is not defined? I would like to get this output: ------------------ first = 1st third = 3rd ------------------ If it is not doable using TT2, I'm thinking about using some default value for all not defined variables... Q2) Does it even exists? Some default value for undefined variables? smth. like "default=abcde". Then I could get the output: ------------------ first = 1st second = abcde third = 3rd fourth = abcde ------------------ and using another text processing tool remove all lines that contains this specific "abcde" string. Any help is appreciated! Thanks in advance, -Vlada B. _______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
