为什么我生成的 html 页面不通过 RobotFramework 上的 libdoc 显示多行文档?
Why does my generated html page not show multiple line documentation through libdoc on RobotFramework?
在 Robotframework 上使用 libdoc 时,我无法在生成的 html 页面中显示新行。
MyResource.resource
*** Settings ***
Documentation
... Testing for new lines
... Here is a second one
...
... And new paragraph\n
... New line in the new paragraph
*** Keywords ***
Test Case for checking documentation
[Documentation]
... First line which goes on and on for quite some time\n
... Second line cause the first was too long
...
... New Paragraph
... Another new line for the new paragraph
... | Test | Table |
... | Works | fine |
... V Look at that line V
... ---
... My list
... - item 1
... - item 2
No Operation
HTML输出:
HTML源代码
<script type="text/javascript">
libdoc = {"name": "MyResource", "doc": "<p>Testing for new lines Here is a second one</p>\n<p>And new paragraph New line in the new paragraph</p>", "version": "", "generated": "2021-11-24 11:10:06", "type": "RESOURCE", "scope": "GLOBAL", "docFormat": "HTML", "source": "MyResource.resource", "lineno": 1, "tags": [], "inits": [], "keywords": [{"name": "Test Case for checking documentation", "args": [], "doc": "<p>First line which goes on and on for quite some time Second line cause the first was too long</p>\n<p>New Paragraph Another new line for the new paragraph</p>\n<table border=\"1\">\n<tr>\n<td>Test</td>\n<td>Table</td>\n</tr>\n<tr>\n<td>Works</td>\n<td>fine</td>\n</tr>\n</table>\n<p>V Look at that line V</p>\n<hr>\n<p>My list</p>\n<ul>\n<li>item 1</li>\n<li>item 2</li>\n</ul>", "shortdoc": "First line which goes on and on for quite some time Second line cause the first was too long", "tags": [], "source": "MyResource.resource", "lineno": 10}], "dataTypes": {"enums": [], "typedDicts": []}}
</script>
我的执行线:
libdoc .\MyResource.resource MyResoure.html
运行 RobotFramework 版本 4.1.2
我试过以下方法:
- 将间距从 4 更改为 2 spaces
- 在行尾添加space
- 在行尾添加\n
- 从 CRLF 更改为 LF
我的预期输出
Testing for new lines
Here is a second one
看看你例子的开头,你产生了一个空行。这是你拥有的:
*** Settings ***
Documentation
... Testing for new lines
... Here is a second one
...
... And new paragraph\n
... New line in the new paragraph
这可能是您需要的:
*** Settings ***
Documentation
... Testing for new lines
...
... Here is a second one
...
...
... And new paragraph
...
... New line in the new paragraph
...
一行文档中嵌入的换行符对段落的呈现没有影响。以下是标题为 Documentation Formatting:
的用户指南部分的相关引述
As explained in the Paragraphs section below, the single newline in Second paragraph, this time\nwith multiple lines.
does not actually affect how that paragraph is rendered.
和:
All regular text in the formatted HTML documentation is represented as paragraphs. In practice, lines separated by a single newline will be combined in a paragraph regardless whether the newline is added manually or automatically.
支持换行的 bug report was submitted back in 2014, and was closed with a comment that the behavior won't be changed. A feature request 已于 2021 年底提交,但也被拒绝了。
不幸的是,早期版本的机器人框架中嵌入的换行符实际上导致了换行。
在 Robotframework 上使用 libdoc 时,我无法在生成的 html 页面中显示新行。
MyResource.resource
*** Settings ***
Documentation
... Testing for new lines
... Here is a second one
...
... And new paragraph\n
... New line in the new paragraph
*** Keywords ***
Test Case for checking documentation
[Documentation]
... First line which goes on and on for quite some time\n
... Second line cause the first was too long
...
... New Paragraph
... Another new line for the new paragraph
... | Test | Table |
... | Works | fine |
... V Look at that line V
... ---
... My list
... - item 1
... - item 2
No Operation
HTML输出:
HTML源代码
<script type="text/javascript">
libdoc = {"name": "MyResource", "doc": "<p>Testing for new lines Here is a second one</p>\n<p>And new paragraph New line in the new paragraph</p>", "version": "", "generated": "2021-11-24 11:10:06", "type": "RESOURCE", "scope": "GLOBAL", "docFormat": "HTML", "source": "MyResource.resource", "lineno": 1, "tags": [], "inits": [], "keywords": [{"name": "Test Case for checking documentation", "args": [], "doc": "<p>First line which goes on and on for quite some time Second line cause the first was too long</p>\n<p>New Paragraph Another new line for the new paragraph</p>\n<table border=\"1\">\n<tr>\n<td>Test</td>\n<td>Table</td>\n</tr>\n<tr>\n<td>Works</td>\n<td>fine</td>\n</tr>\n</table>\n<p>V Look at that line V</p>\n<hr>\n<p>My list</p>\n<ul>\n<li>item 1</li>\n<li>item 2</li>\n</ul>", "shortdoc": "First line which goes on and on for quite some time Second line cause the first was too long", "tags": [], "source": "MyResource.resource", "lineno": 10}], "dataTypes": {"enums": [], "typedDicts": []}}
</script>
我的执行线:
libdoc .\MyResource.resource MyResoure.html
运行 RobotFramework 版本 4.1.2
我试过以下方法:
- 将间距从 4 更改为 2 spaces
- 在行尾添加space
- 在行尾添加\n
- 从 CRLF 更改为 LF
我的预期输出
Testing for new lines
Here is a second one
看看你例子的开头,你产生了一个空行。这是你拥有的:
*** Settings ***
Documentation
... Testing for new lines
... Here is a second one
...
... And new paragraph\n
... New line in the new paragraph
这可能是您需要的:
*** Settings ***
Documentation
... Testing for new lines
...
... Here is a second one
...
...
... And new paragraph
...
... New line in the new paragraph
...
一行文档中嵌入的换行符对段落的呈现没有影响。以下是标题为 Documentation Formatting:
的用户指南部分的相关引述As explained in the Paragraphs section below, the single newline in
Second paragraph, this time\nwith multiple lines.
does not actually affect how that paragraph is rendered.
和:
All regular text in the formatted HTML documentation is represented as paragraphs. In practice, lines separated by a single newline will be combined in a paragraph regardless whether the newline is added manually or automatically.
支持换行的 bug report was submitted back in 2014, and was closed with a comment that the behavior won't be changed. A feature request 已于 2021 年底提交,但也被拒绝了。
不幸的是,早期版本的机器人框架中嵌入的换行符实际上导致了换行。