-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bdceec
commit a5bfd2e
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
目标: | ||
- 生成语法正确的 HTML 源码文件 | ||
- 包含相应自动测试代码 | ||
- 可限定范围, 否则网页中包含所有支持的类型的界面元素 | ||
- 段落文本内容参考<狗屁不通>, 带结构的界面元素使用内置的中文内容 | ||
- 暂时不包含任何元素特性(attribute) | ||
- 如需要标识符, 尽量使用中文(包括元素 id 等等) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Python 3.7.3下测试通过 | ||
# 参考: https://stackoverflow.com/a/48817000/1536803 | ||
import sys | ||
from xml.etree import ElementTree as 结构 | ||
|
||
根 = 结构.Element('html') | ||
body = 结构.Element('body') | ||
根.append(body) | ||
div = 结构.Element('div') | ||
body.append(div) | ||
span = 结构.Element('span') | ||
div.append(span) | ||
span.text = "待文本生成" | ||
|
||
结构.ElementTree(根).write('测1.html', encoding='unicode', method='html') |