You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ease creating multiline documentation or metadata values. #1009
Creating multiline documentation is currently somewhat annoying as you need to include \n in the test data yourself:
*** Settings ***
Documentation First line.\n
... Second line.\n
... Third line.
We can ease this by combining documentation specified in multiple cells using a newline character instead of space. If that is done, then the above can be written like this:
*** Settings ***
Documentation First line.
... Second line.
... Third line.
Unfortunately this change is backwards incompatible in two ways:
If a cell has a newline at the end (like in the first example above) there are going to be two newlines after we add one ourselves. This changes the layout of the documentation and can break tables in the documentation pretty badly.
A simple fix for this problems is to ignore possible newline at the end of the cell. This is slightly annoying because you then cannot easily add empty rows, but that's a smaller problem than adding extra empty lines.
Extra newlines are added also if the documentation is split into multiple cells because it doesn't fit into a single cell nicely. This is probably more common in HTML but can also happen in plain text:
*** Settings ***
Documentation This is pretty long documentation that doesn't fit nicely
... into one row so it is split into several rows but it should
... actually be only one row in report and log.
One way to overcome this problem is allowing an extra character at the end of the line that prevents adding the newline. A suitable escape character for this backslash that is used also elsewhere for similar purposes:
*** Settings ***
Documentation This is pretty long documentation that doesn't fit nicely \
... into one row so it is split into several rows but it should \
... actually be only one row in report and log.
Basically all this means that instead of specifying a newline with \n you now need to specify not to use newline with \. Our educated guess is that newlines are needed more often so after this change the common case is easier.
Originally submitted to Google Code by bryan.oakley on 2 Dec 2011
I still like my idea of a new syntax for documentation that has no backwards compatible issues, and arguably makes documentation even easier:
*** Test case ***
My test case
// documentation line 1
// documentation line 2
Why do I say it's easier? Because I don't have to use the [Documentation] word and I don't have to move my comments to a new cell one more column to the right. I see that as a usability improvement.
Plus, with the new syntax it's easier for editors to highlight the documentation differently than other types of markup. By piggybacking off of "..." there's no way to know if a line is documentation without backtracking up the code to find the beginning of the logical row. With "//", it's always part of the documentation and thus can quickly be colorized to something different.
I don't like adding new syntax to the framework in general unless there are really big needs. All new syntax makes the framework mode complex to use and maintain.
Adding new syntax is also a pretty big task requiring changes to the parsing logic, RIDE, other tools, documentation, etc. The core team cannot implement such large changes unless they are directly requested by our sponsor. If you really want to get some new syntax into the framework, you thus need to be prepared to implement it yourself or sponsor the development.
In this particular case I wouldn't like the // syntax too much either, though. For me lines like this look like comments and not documentation. There's already # for writing comments and for documentation it is, in my opinion, better to use explicit setting names.
Originally submitted to Google Code by bryan.oakley on 3 Feb 2012
I'm going to go on record as being opposed to this change. It seems to me this is simply switching one set of problems for another, at the expense of introducing backwards incompatibility.
I see no inherent advantage to either method -- I'm fine with joining with newlines or with spaces, but what I don't like is that you're changing the parsing rules after we've already written thousands of lines of documentation.
In other words, I think the backwards incompatibility that would be introduced far outweighs any benefit. Save the backwards incompatibilities for 3.0.
We noticed that paragraphs were handled inconsistently in logs/reports and library documentation ( issue 1135 ). That problem is going to be fixed in 2.7.2 by always combining lines together into paragraphs unless they are part of a table or some other special block. After that change not adding newlines between documentation/metadata lines if they end with \ or \n didn't make much sense, and that is going to be dropped too.
Originally submitted to Google Code by bryan.oakley on 30 May 2012
I don't understand. What is a "table or some other special block"?
Are you saying you're reverting the backwards-incompatibility from the previous version, and now you will not be adding automatic newlines to every line? If so, that's good news! But I'm confused because 1135 seems to imply newlines will be added even if there's an explicit \n, but comment 13 here implies that lines will be joined together in paragraphs (which to me means no newlines will be added).
Can you clear this up, perhaps with a simple example? Given the following, what is going to happen? How many newlines will end up in the final string?
| | [Documentation] | this is one physical line
| | ... | this is another, with an explicit newline\n
| | ... | this is a third
My hope is that there's exactly one, the one I added. My fear is, I'm now going to get four -- three automatic plus the one explicit.
In the end we decided to keep special handling of \n and \ at the end of documentation lines. Newlines will still be added after other lines automatically.
In practice adding those newlines after normal text lines has no effect, though, because after issue 1135 such lines will create a single paragraph in generated HTML documentation. For example, Bryan's example in the above comment would create this HTML code:
<p>
this is one physical line
this is another, with an explicit newline
this is a third
</p>
Automatically added newlines help creating tables, lists, and other special blocks. For example, after issue 1136 this documentation:
[Documentation] Hello, world!
... - list item
... - another list item
In my opinion the multiline documentation feature still does not work in the keyword section.
This code:
*** Keywords ***
Sign Out
[Documentation] Loggt den Benutzer aus. Dieses Keyword schlägt fehl wenn vor dem Ausloggen
... das Logout-Formular nicht vorhanden ist oder nach dem Logout das Login-Formular nicht
... vorhanden ist.
Click Element ${form_link_locator}
Sleep 2
results in only the first row being displayed (see attachment).
This affects RF 3.0 (we use it via PyPot / Python 2.7.11 on darwin and Python 2.7.9 on Linux).
Only the first row of the doc is shown in the report. This is on purpose to avoid increasing log file size to include long docs there. I guess we could consider changing the logic so that everything in the first paragraph is included. That would require a new issue and could safely be done only in a major release, though.
Thanks for the quick reply! I wonder where (at all) the multiline documentation of keywords is supposed to show up if not in the log. Opposed to keywords, the test case documentation is displayed in full length.
Activity
spooning commentedon Jun 29, 2014
Unfortunately this change is backwards incompatible in two ways:
If a cell has a newline at the end (like in the first example above) there are going to be two newlines after we add one ourselves. This changes the layout of the documentation and can break tables in the documentation pretty badly.
A simple fix for this problems is to ignore possible newline at the end of the cell. This is slightly annoying because you then cannot easily add empty rows, but that's a smaller problem than adding extra empty lines.
Extra newlines are added also if the documentation is split into multiple cells because it doesn't fit into a single cell nicely. This is probably more common in HTML but can also happen in plain text:
One way to overcome this problem is allowing an extra character at the end of the line that prevents adding the newline. A suitable escape character for this backslash that is used also elsewhere for similar purposes:
Basically all this means that instead of specifying a newline with
\nyou now need to specify not to use newline with\. Our educated guess is that newlines are needed more often so after this change the common case is easier.spooning commentedon Jun 29, 2014
Issue 866 has been merged into this issue.
spooning commentedon Jun 29, 2014
I still like my idea of a new syntax for documentation that has no backwards compatible issues, and arguably makes documentation even easier:
*** Test case ***
My test case
// documentation line 1
// documentation line 2
Why do I say it's easier? Because I don't have to use the [Documentation] word and I don't have to move my comments to a new cell one more column to the right. I see that as a usability improvement.
Plus, with the new syntax it's easier for editors to highlight the documentation differently than other types of markup. By piggybacking off of "..." there's no way to know if a line is documentation without backtracking up the code to find the beginning of the logical row. With "//", it's always part of the documentation and thus can quickly be colorized to something different.
spooning commentedon Jun 29, 2014
I don't like adding new syntax to the framework in general unless there are really big needs. All new syntax makes the framework mode complex to use and maintain.
Adding new syntax is also a pretty big task requiring changes to the parsing logic, RIDE, other tools, documentation, etc. The core team cannot implement such large changes unless they are directly requested by our sponsor. If you really want to get some new syntax into the framework, you thus need to be prepared to implement it yourself or sponsor the development.
In this particular case I wouldn't like the
//syntax too much either, though. For me lines like this look like comments and not documentation. There's already#for writing comments and for documentation it is, in my opinion, better to use explicit setting names.spooning commentedon Jun 29, 2014
I'm going to go on record as being opposed to this change. It seems to me this is simply switching one set of problems for another, at the expense of introducing backwards incompatibility.
I see no inherent advantage to either method -- I'm fine with joining with newlines or with spaces, but what I don't like is that you're changing the parsing rules after we've already written thousands of lines of documentation.
In other words, I think the backwards incompatibility that would be introduced far outweighs any benefit. Save the backwards incompatibilities for 3.0.
spooning commentedon Jun 29, 2014
We decided to implement this so that continued lines in documentation are combined with newlines, unless the lines themselves already end with '\n'.
Thus
and
Will yield exactly the same result, "My Doc\nSome more"
A single backslash at the end of line can be used to turn off this functionality, so that
Will yield "My doc Some more"
spooning commentedon Jun 29, 2014
This is now implemented and tested. I also modified libdoc to support this kind of formatting.
In addition, we decided to implement same rules for metadata values,
UserGuide still needs some love.
spooning commentedon Jun 29, 2014
Great! I'll take a look at the User Guide tomorrow. Apparently the current changes were done in revision 6af31450ebce.
spooning commentedon Jun 29, 2014
Included into RF 2.7 beta 2.
spooning commentedon Jun 29, 2014
This issue was updated by revision e35c4cf75919.
I enhanced the previously create documentation a little and documented this in several other places dealing with same and related functionality.
Janne, could you take a look at the changes? I briefly reviewed also the code changes so otherwise I'd call this issue done.
spooning commentedon Jun 29, 2014
Documentation changes seem fine.
spooning commentedon Jun 29, 2014
We noticed that paragraphs were handled inconsistently in logs/reports and library documentation ( issue 1135 ). That problem is going to be fixed in 2.7.2 by always combining lines together into paragraphs unless they are part of a table or some other special block. After that change not adding newlines between documentation/metadata lines if they end with \ or \n didn't make much sense, and that is going to be dropped too.
spooning commentedon Jun 29, 2014
I don't understand. What is a "table or some other special block"?
Are you saying you're reverting the backwards-incompatibility from the previous version, and now you will not be adding automatic newlines to every line? If so, that's good news! But I'm confused because 1135 seems to imply newlines will be added even if there's an explicit \n, but comment 13 here implies that lines will be joined together in paragraphs (which to me means no newlines will be added).
Can you clear this up, perhaps with a simple example? Given the following, what is going to happen? How many newlines will end up in the final string?
My hope is that there's exactly one, the one I added. My fear is, I'm now going to get four -- three automatic plus the one explicit.
spooning commentedon Jun 29, 2014
In the end we decided to keep special handling of
\nand\at the end of documentation lines. Newlines will still be added after other lines automatically.In practice adding those newlines after normal text lines has no effect, though, because after issue 1135 such lines will create a single paragraph in generated HTML documentation. For example, Bryan's example in the above comment would create this HTML code:
Automatically added newlines help creating tables, lists, and other special blocks. For example, after issue 1136 this documentation:
creates this HTML:
If newlines were not added automatically, above example would have requires adding \n after list items.
spooning commentedon Jun 29, 2014
For more information about adding newlines and creating paragraphs see the updated documentation in the User Guide:
http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html#documentation-formatting
Please also add possible comments about the updated docs to issue 1135 .
xanadiu commentedon Dec 9, 2016
In my opinion the multiline documentation feature still does not work in the keyword section.
This code:
*** Keywords *** Sign Out [Documentation] Loggt den Benutzer aus. Dieses Keyword schlägt fehl wenn vor dem Ausloggen ... das Logout-Formular nicht vorhanden ist oder nach dem Logout das Login-Formular nicht ... vorhanden ist. Click Element ${form_link_locator} Sleep 2results in only the first row being displayed (see attachment).
This affects RF 3.0 (we use it via PyPot / Python 2.7.11 on darwin and Python 2.7.9 on Linux).
pekkaklarck commentedon Dec 9, 2016
Only the first row of the doc is shown in the report. This is on purpose to avoid increasing log file size to include long docs there. I guess we could consider changing the logic so that everything in the first paragraph is included. That would require a new issue and could safely be done only in a major release, though.
xanadiu commentedon Dec 9, 2016
Thanks for the quick reply! I wonder where (at all) the multiline documentation of keywords is supposed to show up if not in the log. Opposed to keywords, the test case documentation is displayed in full length.
I created a new issue (#2491).
pekkaklarck commentedon Dec 9, 2016
Full keyword docs are shown in outputs produced by Libdoc.