TAG helper and unnamed argument

39 views
Skip to first unread message

Kirill Shatalaev

unread,
Aug 29, 2016, 3:44:59 PM8/29/16
to web...@googlegroups.com

So, how to do some like:

<time pubdate datetime="2009-10-09">1 day ago</time>


I tried:

TAG.time('1 day ago', _pubdate=True,
 _datetime
=str(datetime.year) + '-' + '%02d' % datetime.month + '-' + '%02d' % datetime.day)


And got:

<time datetime="2009-10-09" pubdate="pubdate">1 day ago</time>


Here I can read:
http://www.web2py.com/init/default/examples

"attributes without value like "READONLY" can be created with the argument "_readonly=ON"."

But not _pubdate=True, nor _pubdate=ON (wich is deprecated and just an alias for True according to chapter 5) does not work for me and generates pubdate="pubdate".





Niphlod

unread,
Aug 29, 2016, 5:37:53 PM8/29/16
to web...@googlegroups.com
ATM "False" or "None" don't have the corresponding attribute inserted. There's no way to generate an attribute without value.

BTW: that is definitely not a good example as it's not HTML5 valid syntax. A better one could have been 

<article itemscope itemtype="http://n.example.org/rfc4287">
   
<h1>hi</h1>
</article>


@mdipierro: any thoughts about this ? If I'm not mistaken, the offending line is from #L936 to #L947 ... maybe _pubdate=None should result in an empty attribute ?
BTW2: the referenced page with the new style is a pain to read.

Niphlod

unread,
Aug 29, 2016, 6:00:40 PM8/29/16
to web2py-users
whoops, forget what I said. Apparently any attribute without a specific value is syntactically equivalent to "".
So, @Kirill, there's no way but ending up with _pubdate='' will give you a syntactically equivalent markup.

Unless I'm reading w3c spec wrong, in that case feel free to correct me.

Dave S

unread,
Aug 29, 2016, 6:46:33 PM8/29/16
to web2py-users

Continuing the side-comment:

On Monday, August 29, 2016 at 2:37:53 PM UTC-7, Niphlod wrote:

@mdipierro: [...]
BTW2: the referenced page with the new style is a pain to read

Scrolls very "slowly" for me ... mouse wheel or page down don't move very far at a time.  Some of the colors don't stand out well on black backgrounds
(teal, one of the reds, ...)

/dps
 

Anthony

unread,
Aug 29, 2016, 6:49:09 PM8/29/16
to web2py-users

Same here.

Kirill Shatalaev

unread,
Aug 30, 2016, 7:02:48 AM8/30/16
to web2py-users

So, @Kirill, there's no way but ending up with _pubdate='' will give you a syntactically equivalent markup.



Well, I see now. Sleazy, but correct. Thank you.

P.S. Not sure about others, but we russians have joke about man visiting doctor and "sleazy"...
Reply all
Reply to author
Forward
0 new messages