4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

PyH源码解析(2)

生成Tag对象的属性

用户代码如下所示:

>>> a=div(a1='a1')
>>> print(a)
<div a1="a1">
</div>

在内部实现上,Tag对象的属性存放在一个字典中,字典的名字是attr,原来的名字是attributes,我觉得太长了,修改了一下。核心函数如下:

#把字典变成字符串,形如:' a="a" b="b"'
#需要注意的是class需要换成cl
renderAttr(self)->str
2 upvotes $0.00

Replies (0)

Conversation

No replies yet

Replies will appear here as people join the conversation.

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: