More simple syntax?

4 views
Skip to first unread message

Luke Stanley

unread,
Aug 16, 2011, 4:30:54 PM8/16/11
to Nagare users
Have you thought about using more simple syntax?
Seeing unusual elements like "<<" in the examples is unappealing.
and may I suggest supporting HTML elements as functions already
directly imported to the namespace?

E.g: Div(A(P('click here'),href='static/link.htm'))
vs: html.Div(html.A(html.P('click here'),href='static/link.htm'))

and just use Class for class (uppercase first letters?)

Just some thoughts.

Best regards,

--Luke Stanley

apoirier

unread,
Aug 16, 2011, 7:10:10 PM8/16/11
to Nagare users
Hi Luke,

On Aug 16, 10:30 pm, Luke Stanley <luke.stan...@gmail.com> wrote:
> Have you thought about using more simple syntax?
> Seeing unusual elements like "<<" in the examples is unappealing.

Well, like in your example below, you can use "functional" html
generation `h.div(h.a(…))` if this syntax feels more natural to you.

> and may I suggest supporting HTML elements as functions already
> directly imported to the namespace?
>
> E.g: Div(A(P('click here'),href='static/link.htm'))
> vs: html.Div(html.A(html.P('click here'),href='static/link.htm'))

In order to find specific parts of Nagare (the sessions manager, the
callbacks manager …), the tag factories can't be simple global
function but must be methods of a renderer object. So they can't
directly be imported.

We usually shorten this syntax overhead by calling the renderer
parameter `h` instead of `html`.

> and just use Class for class (uppercase first letters?)

`class_` is a convention from the PEP8 standard:

"""
- single_trailing_underscore_: used by convention to avoid conflicts
with
Python keyword, e.g.

Tkinter.Toplevel(master, class_='ClassName')
"""

followed by several html generation modules. See for example Breve
(http://breve.twisty-industries.com/documentation)

> Just some thoughts.
>
> Best regards,
>
> --Luke Stanley

Best regards,
Alain
Reply all
Reply to author
Forward
0 new messages