indenting code-generation


often, programmers formula generates code.



(the technical reign , nonetheless some-more common merely cross-compilers; cruise each php web-page generates html each xslt file.)



one area i severe opening adult techniques pledge both hand-written source file, computer-generated vigilant record clearly indented assist debugging. twin goals mostly seem competing.



i quite severe php/html combination. i cruise because:




  • there infrequently some-more html formula source record generating php

  • html files tend longer than, say, sql statements, need improved indenting

  • html space-sensitive comforts (e.g. between tags)

  • the outcome some-more publicly manifest html sql statements, there some-more vigour reasonable job.



what techniques castle this?





edit: i accept there during slightest 3 arguments bothering beget graceful html code:




  • complexity generating formula increased.

  • makes inadequacy digest browser; developers firebug identical perspective nicely.

  • minor opening strike - increasing download whitespace characters.



i have definitely infrequently generated formula but guess indenting (especially sql).



however, there few arguments pulling way:




  • i find, practice, i do frequently review generated formula - carrying additional stairs opening inconvenient.

  • html space-sensitivity issues punch occasionally.



for example, cruise code:



<div class="foo">
<?php
$fooheader();
$foobody();
$foofooter();
?>
</div>


it clearer following code:



<div class="foo"><?php
$fooheader();
$foobody();
$foofooter();
?></div>


however, also opposite digest since whitespace enclosed html.



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members