Since literal tabs look exactly like spaces, seems to me it's a bad idea to try to include them in a template. It's far to easy for another maintainer to accidentally remove it.
If it really is vital to use a tab instead of spaces, then ISTM that it is better to make it obvious. On Thu, 24 Jan 2019 at 14:58, Christopher Schultz <ch...@christopherschultz.net> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > All, > > I know this has been asked before but I've never really found a > satisfactory answer: what's the best way to put a literal tab into a > VTL template? > > I don't want to use: > > context.put("tab", "\t"); > > And then use $tab in my template, because I'd have to edit however > many pieces of code call templates in order to do that. > > I don't want to write a new "tool" and put it into the context because > that's stupid. > > I could modify the EscapeTool (which I already use for inconvenient > characters such as "hash", "backslash", "dollar", and "newline". > > But there does not seem to be a good way to get a literal tab into a > template, directly. I'm, of course, being sabotaged by my editor > (Eclipse) which will refuse to put a tab into a file even if I > generate a tab elsewhere and copy/paste into the template. That surely > has something to do with my own personal editor-preferences. But that > means that any other member of my team who edits the file might damage > it it I go ahead and edit the template with vi just to get it done. > > There doesn't appear to be any way to put odd literals of other types > into templates, either. Let's say I'm using vi and want to put > Japanese text into my template? Am I out of luck? Or is there some > undocumented "escaping" built-into Velocity that I can use to put a > literal 日本 into my template without being able to type it or > copy/paste it? > > Thanks, > - -chris > -----BEGIN PGP SIGNATURE----- > Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ > > iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxJ0q4ACgkQHPApP6U8 > pFgZ2g//UPgAs6FwXAHvaUINitIOiOi5vsW5EuxTCtQ6fPA0vCjb2/xpdbmyLltl > i4NQ7uzfPeX8uVsRuECtYKHWKZddxMlnyXIH2en/ZxP8nZZ0gpxs4m5FTjjDALOt > Oue3gbLsKRwNW8iwgmJEScAEH+Y3+t7WuFPW0hftauordPUyHqTMuFTZVLOsAAFW > KGiqTFdI1MZqTI8fU+Dk+s+/SbE2segr7ufBA6TQs4ufr3XY3ahG1TqJlVbZA8PY > OCmPOOEWcbgXC6s0sdiq9BWT7N1uayDSSZjasiIg012CDuhWz11813Id9FJnPftM > hGbb74AD5puyeSjnIsVMvzDI2ZFeXLH8/FBe4VCcGh6GfFmPNUU4R9g6Ti8Jsyih > llJSDS4jPkiQ5kla1qQQ/Ph/FvW1YS2+ra5356r0yRdiotQ2q3Q6aFAtNWdLIt8X > +f6nYO39NecuUbn9lyVvWA2JwEd0SlkE4KZno5HkOW4Bhr6sKAprc0mMg6qMkZcP > lYRQG4qnaLFY4F48xUJE1pjUGhLAiJPZbsgVik4r7yNnV4EiRejTCzn6rd83EEnW > wjm6p3IZ26yPByWr/I4nKHA22lvfZbiAF+5lp/rU0rh6MIf+uAXJjC72Rof9+mND > 9tvabrtf8kKV+A3elct3f7jrdHi/d5tMaIHJWtU+9z1aBmO8GnE= > =9Fe1 > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org