pvdung / json-template

Automatically exported from code.google.com/p/json-template
0 stars 0 forks source link

Add whitespace options #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
- For compressing all whitespace
- For preserving indentation
- default: do nothing

Original issue reported on code.google.com by andyc...@gmail.com on 8 Mar 2009 at 5:24

GoogleCodeExporter commented 9 years ago
Proposed behavior:

whitespace-mode: any 

  The template author does not care, this is for backward compatibility with the
existing somewhat arbitrary behavior.  The existing tests may be relaxed to do
ignore_whitespace=True

whitespace-mode: strip

  remove whitespace around *directives* (for network efficiency, yes it matters)

whitespace-mode: preserve

  Do *exactly* what the template says.  (The current behavior is *almost exactly*)

whitespace-mode: smart-indent

  Well indented templates should produce well-indented outputs.  Useful for
generating both HTML/XML and source code.

Original comment by gtempacc...@yahoo.com on 10 Apr 2009 at 12:32

GoogleCodeExporter commented 9 years ago
The "smart indent" style was done for the Python version.  I have written some 
notes
on the Reference wiki page that makes it clear that it's optional.

For the JavaScript version, I want to keep the code size small, and this 
"smartness"
does add a bit of code size.  So we could leave it, or find a more compact way 
to
implement it -- maybe with a tokenizing regex that does something like (block
directive)|(substitution) to distinguish the 2 cases.

Original comment by gtempacc...@yahoo.com on 17 Apr 2009 at 6:32

GoogleCodeExporter commented 9 years ago

Original comment by gtempacc...@yahoo.com on 17 Apr 2009 at 3:54