2 Star 4 Fork 0

Albert钟/PyHtmlLib--面向对象编写html

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
HtmlExtention.py 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
Albert钟 提交于 2021-08-07 05:51 . update
from .Tool import *
class HtmlStyleSheet():
def __init__(self, content='', **args):
self.content = content
self.name = 'style'
self.args = args
self.setup()
def setup(self):
arg_span = dictToArgs(self.args)
self.code = f'<{self.name}{arg_span}>{self.content}\n</{self.name}>'
def render(self):
self.web_lines = loadWebLines()
head_line = getPos('/body')
self.web_lines.insert(head_line, self.code)
writeWebLines(self.web_lines)
def addBlock(self, for_, block):
self.block = '''%s{%s}\n'''%(for_, block)
self.content += self.block
self.setup()
class HtmlScript():
def __init__(self, content='', **args):
self.content = content
self.name = 'script'
self.args = args
self.setup()
def setup(self):
arg_span = dictToArgs(self.args)
self.code = f'<{self.name} {arg_span}>{self.content}\n</{self.name}>'
def render(self):
self.web_lines = loadWebLines()
head_line = getPos('/body')
self.web_lines.insert(head_line, self.code)
writeWebLines(self.web_lines)
class HtmlComment():
def __init__(self, content=''):
self.content = content
self.setup()
self.render()
def setup(self):
self.code = f'<!--{self.content}-->'
def render(self):
self.web_lines = loadWebLines()
head_line = getPos('/body')
self.web_lines.insert(head_line, self.code)
writeWebLines(self.web_lines)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/albert_zhong/htmllib.git
git@gitee.com:albert_zhong/htmllib.git
albert_zhong
htmllib
PyHtmlLib--面向对象编写html
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385