[fpc-pascal] The best approaching for templating

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Wed Nov 9 23:37:05 CET 2011


I once wrote a very nice template system for Powutils.

Dont remember how it was called.

I can search the svn for you if you want.

2011/11/9 tcoq <tcoq at free.fr>:
> Dear Luciano.
> I would suggest using the StringReplace function (Sysutiles) in combination with a TStringList.
> Easy to do and quite powerful.
> You can also use a second string list to store the values and patterns to replace, using the Names and Values properties, so that you can do multiple successive replacements in your templates.
> The SaveToFile and LoadFromFile will give you easy storage of your templates.
> I tend to use patterns like [Name] or (First_Name] that are not confused with the html.
> Best regards,
> Thierry
>
> ----- Mail Original -----
> De: "luciano de souza" <luchyanus at gmail.com>
> À: fpc-pascal at lists.freepascal.org
> Envoyé: Lundi 7 Novembre 2011 14h37:46 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
> Objet: [fpc-pascal] The best approaching for templating
>
> Hello listers,
>
> I would like to create some templates. Suppose the following example:
>
> <html>
> <head>
> <title>%s</title>
> </head>
> <body>
> %s <p>
> %s <p>
> %s <p>
> </body>
> </html>
>
> I can certainly use format to link %s to the respective variables.
> However, if the number of %s is big, probabily, the reading would be
> less clearer.
>
> But, suppose I have $title in stead of %s and $p1 in stead of %s. In
> Lua, I have a module called Cosmo taht perform it.
>
> my question is: is there something similar in Pascal?
>
> Luciano
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list