Discussion:
about section syntax : let me advocate an idea borrowed from TBS
kapouer
2010-01-16 12:51:41 UTC
Permalink
Hi,
i've been using TBS for years and because the lack of design
philosophy
(it grows hair, as you say), i'm willing to switch to something well
thought like
JSON Template.
The only thing i would miss from TBS is the way it defines sections :
http://tinybutstrong.com/manual.php#html_block_section
which is very neat : no need for begin/end section tags (while still
allowing them) and if properly
generalized can be easily extensible and applied to any cases (e.g.
other than html).

So you may ask : which problem this solution address ?
The short answer : to keep the unmerged template wysiwyg, allowing
designer and programmer to work together.

The long one : take two guys : one web designer, one web programmer,
with mutually exclusive abilities
- the designer first ouputs some html, css without any code.
- the programmer sets up model, controller, and converts the work of
the designer to a template which can be merged.

The problem is, with most template syntaxes, the resulting template,
when viewed in a browser, displays a lot of junk;
the layout is difficult to change for the designer (since he does not
know anything about template syntax, and works only on html+css).
I experienced working like this and it's very effective.

I will try to implement this soon. Ideas are welcome !
Andy Chu
2010-01-17 08:55:21 UTC
Permalink
Post by kapouer
Hi,
i've been using TBS for years and because the lack of design
philosophy
(it grows hair, as you say), i'm willing to switch to something well
thought like
JSON Template.
http://tinybutstrong.com/manual.php#html_block_section
which is very neat : no need for begin/end section tags (while still
allowing them) and if properly
generalized can be easily extensible and applied to any cases (e.g.
other than html).
I think the goal of having the template be viewable in the browser is
a good one. Depending on how your write your templates and choose the
metacharacters in JSON Template, I think they should be pretty
readable already.

I can't really tell from the page what it's getting at or how it would
fit into JSON Template. Can you give a concrete example of what the
template would look like and how it behaves?

thanks,
Andy
Jérémy Lal
2010-01-18 15:39:54 UTC
Permalink
Post by Andy Chu
Post by kapouer
Hi,
i've been using TBS for years and because the lack of design
philosophy
(it grows hair, as you say), i'm willing to switch to something well
thought like
JSON Template.
http://tinybutstrong.com/manual.php#html_block_section
which is very neat : no need for begin/end section tags (while still
allowing them) and if properly
generalized can be easily extensible and applied to any cases (e.g.
other than html).
I think the goal of having the template be viewable in the browser is
a good one. Depending on how your write your templates and choose the
metacharacters in JSON Template, I think they should be pretty
readable already.
I can't really tell from the page what it's getting at or how it would
fit into JSON Template. Can you give a concrete example of what the
template would look like and how it behaves?
thanks,
Andy
Sure, here is a dumb attempt using the example given at
http://json-template.googlecode.com/svn/trunk/doc/Introducing-JSON-Template.html

Instead of :

{.section songs}
<h2>Songs in '{playlist-name}'</h2>
<table width="100%">
{.repeated section @}
<tr>
<td><a href="{url-base|htmltag}{url|htmltag}">Play</a>
<td><i>{title}</i></td>
<td>{artist}</td>
</tr>
{.end}
</table>
{.or}
<p><em>(No page content matches)</em></p>
{.end}


one would write :

<h2>Songs in '{playlist-name}'</h2>
<table width="100%">
<tr>
<td><a href="{url-base|htmltag}{songs.url|htmltag}">Play</a>
<td><i>{songs.title}</i></td>
<td>{songs.artist,section:h2+(table),repeat:tr}</td>
</tr>
</table>
<p><em>(No page content matches){songs,section:p,nodata}</em></p>


A few comments about this :
- i've puts "songs." before the songs entries, because this way i think
it's more obvious to tell what data comes from which object. It is only
clearer to read, i don't suggest it should be done that way !
- the "section" identifier is set once for each section, and can be put
in any of the songs.artist, songs.url, songs.title. It's up to the template
designer to decide where it's more convenient.
- the syntax for defining the section bounds is taken direclty from TBS,
however i think it should be generalized to non-html cases (for that matter TBS
extended its syntax and now it's ugly). section:xxx should instead call a plugin
with parameters, so that it's really easy to extend the way sections bounds are
defined.
In this example : h2+(table) means : take the section that is <h2>...</h2> + the
enclosing table.
section and repeat syntax is the same. It's a short way to define the enclosing bounds
fo the section. I repeat : it should be generalized and not taken as it is.

What do you think about this ? (be gentle with me:)

Regards,
Jérémy.
Andy Chu
2010-01-22 02:53:17 UTC
Permalink
Post by Jérémy Lal
Post by Andy Chu
Post by kapouer
Hi,
i've been using TBS for years and because the lack of design
philosophy
(it grows hair, as you say), i'm willing to switch to something well
thought like
JSON Template.
http://tinybutstrong.com/manual.php#html_block_section
which is very neat : no need for begin/end section tags (while still
allowing them) and if properly
generalized can be easily extensible and applied to any cases (e.g.
other than html).
I think the goal of having the template be viewable in the browser is
a good one.  Depending on how your write your templates and choose the
metacharacters in JSON Template, I think they should be pretty
readable already.
I can't really tell from the page what it's getting at or how it would
fit into JSON Template.  Can you give a concrete example of what the
template would look like and how it behaves?
thanks,
Andy
Sure, here is a dumb attempt using the example given at
http://json-template.googlecode.com/svn/trunk/doc/Introducing-JSON-Template.html
{.section songs}
 <h2>Songs in '{playlist-name}'</h2>
 <table width="100%">
   <tr>
     <td><a href="{url-base|htmltag}{url|htmltag}">Play</a>
     <td><i>{title}</i></td>
     <td>{artist}</td>
   </tr>
 {.end}
 </table>
{.or}
 <p><em>(No page content matches)</em></p>
{.end}
 <h2>Songs in '{playlist-name}'</h2>
 <table width="100%">
   <tr>
     <td><a href="{url-base|htmltag}{songs.url|htmltag}">Play</a>
     <td><i>{songs.title}</i></td>
     <td>{songs.artist,section:h2+(table),repeat:tr}</td>
   </tr>
 </table>
 <p><em>(No page content matches){songs,section:p,nodata}</em></p>
OK I sort of see what this is doing, but it seems like a completely
different language to me. I think it's possibly beneficial in terms
of reading in a browser, but sacrifices a lot of other things for this
benefit.

And I don't want to have 2 different ways of doing the same thing,
which will be confusing.

So you're certainly welcome to use the code if you want but this is
too big a change to make part of the official language.

thanks,
Andy
--
You received this message because you are subscribed to the Google Groups "JSON Template" group.
To post to this group, send email to json-template-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to json-template+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/json-template?hl=en.
Loading...