I am new to Template Toolkit so please excuse me if I am asking a rudimentary question but what about a PROMPT directive that when used with tpage or ttree would allow dynamic content to be queried from the user.
The use case I have is for that of generating LDIF files. Partial example: [% PROMPT suffix "Suffix" “dc=example,dc=com” %] [% PROMPT givenName "First name" %] [% PROMPT sn "Last name" %] [% PROMPT mail "Email address" %] [% SET cn = "$givenName $sn" [% SET dn = "cn=$cn,$suffix" %] dn: [% dn %] objectClass: inetOrgPerson cn: [% cn %] givenName: [% givenName %] sn: [% sn %] mail: [% mail %] I would consider implementing this myself as a plugin but I am having trouble figuring out where to begin. I know my way around perl but can't say I am much for writing language parsers and the like. Would there be another way to accomplish this? Perhaps just use PERL directive to call some function to add something to the stash? Seems a bit primitive but workable. Ideally PROMT would implement the following kinds of features. - allow specification of prompt text - specification of a separator character e.g. PROMPT "FOO" "default" ">>" gives: FOO [default]>> or PROMPT "BAR?" gives: BAR? (no extra separator value) - allow default values to be used with empty responses - selectively allow or disallow null values - looping or multi-line responses e.g. "Enter a list of e-mail addresses, enter '.' to end input" or similar - limits for looping (min 1, max 5 etc) - input validation e.g. string, integer, double, regex, list of acceptable values Regards, -Alan
_______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
