Loading ...
Sorry, an error occurred while loading the content.

[Cheetahtemplate-discuss] indentation

Expand Messages
  • Dov Feldstern
    Hi! Say I have the following template: void foo(int a) { int i = 0; $do_something for (i = 0; i
    Message 1 of 1 , Aug 23, 2011

      Say I have the following template:

      void foo(int a)
      int i = 0;
      for (i = 0; i < 10; i++) {

      This works just fine if $do_something consists of a single line;
      however, if $do_something consists of multiple lines, then I have a
      problem with the indentation, depending on what exactly the
      placeholder itself looks like:

      1) if the placeholder does not include any indentation itself, then
      the first line is indented correctly (because the indentation appears
      outside of the placeholder), but the rest are not;
      2) so, I could have the placeholder already include the indentation,
      but this has two problems:
      (a) the placeholder would have to appear unindented in the template,
      which is not pretty; and
      (b) more importantly, the placeholder may appear in multiple places,
      each requiring different indentation.

      I'm aware of the "undocumented" #indent function (as documented in the
      TODO), and by playing around with it (using cheetah 2.4.4) I see that
      some of the options work, and am able to get the indentation correct.
      However, I'm a little wary of using undocumented features which may be
      in flux; and also, the resulting templates are much more verbose than
      I would like (too many #indent commands).

      Ideally --- what seems to me like the natural solution (without having
      considered use-cases that are different than mine, and without having
      looked at the implementation at all ;) ) --- I would like the
      indentation of a placeholder to be added to each line of the
      placeholder's contents. Is that possible / difficult to implement /
      inappropriate for other use-cases? Does anyone have any other
      suggestions for achieving what I want?


      Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
      user administration capabilities and model configuration. Take
      the hassle out of deploying and managing Subversion and the
      tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
      Cheetahtemplate-discuss mailing list
    Your message has been successfully submitted and would be delivered to recipients shortly.