一种简单的XML和HTML标记包装方法。
tag_wrap的Python项目详细描述
标签包装
一个简单的标记和属性生成工具。
目的
旨在简化HTML和XML内容的生成。
用法
语法:wrap(tag_name, optional_attribute1="here",optional_attributeN="here, content_to_be_wrapped)
您可以指定任意数量的属性和任意数量的要包装的项 作为嵌套标记本身。
示例
import tag_wrap
HTML段落
tag_wrap.wrap('p', "This is a paragraph.")
产生:
<p>This is a paragraph.</p>
具有属性和嵌套正文的嵌套HTML
tag_wrap.wrap('html',lang="en-US",wrap('body', 'Body content here'))
产生:
<html lang="en-US"><body>Body content here</body></html>