我有一个 python 文件,其中填充了h1
和img
和之类的函数,strong
用于样式文本。这些函数中的每一个定义如下:
def _wrapTag(tag, text, **attributes):
out = _createTag(tag, **attributes)
out += text
out += "</" + tag + ">"
return out
def _createTag(tag, **attributes):
out = "<" + tag
if attributes:
for attr, value in attributes:
out += " " + attr + "=\"" + value + "\""
out += ">"
return out
def h2(text, **attributes):
return _wrapTag("h2", text, **attributes)
在理想的世界中,要div
使用 class创建一个,但modal
我会调用它是一个受限制的关键字。有没有办法绕过这个而不添加特殊情况?div(content, class="modal")
class
_createTag