From: Eric Hodel Date: 2002-12-28T16:22:34+09:00 Subject: Another take on RDoc's templates --TybLhxa8M7aNoW+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Dave Thomas (dave@pragprog.com) wrote: > On Fri, 2002-12-27 at 19:52, Wai-Sun Chia wrote: >=20 > > > The templating code is based on the one in RDoc. In this particular > > > application, I use the same templating code to do web pages, XML, > > > e-mail, and LaTeX. > > >=20 > > > I could post it separately somewhere if folks want. > >=20 > > YES! Please. >=20 > OK - unsupported and all the usual caveats... >=20 > http://prdownloads.sourceforge.net/rdoc/Template.rb?download I was looking around for a decent template system, and RDoc's fit the bill for me, almost. I had some perfectly good objects lying around with perfectly good methods on them, and didn't want to go through the extra (tedious) step of converting them all to Hash/Array combinations, so I did this to (a prior version of) RDoc's template system: http://segment7.net/ruby-code/template/template.rb (more/better description there) and tests: http://segment7.net/ruby-code/template/TC_template.rb NOTES: My version is faster, mainly because I don't use an Array to build=20 up a temporary object, but you can't write onto anything but a string. I haven't bothered to attempt to fix this yet (it hasn't been a problem for me). My version has slightly different syntax for iteration (FOREACH/ENDEACH), due to the addition of WITH/ENDWITH. --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --TybLhxa8M7aNoW+V Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iD8DBQE+DVE4MypVHHlsnwQRAoMsAJ0SP8aOKNoYahfAqDPfp1Ef6gEkwgCg6Hx6 80ctHKAUSUyEjar/EFshuNk= =iFBp -----END PGP SIGNATURE----- --TybLhxa8M7aNoW+V--