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
libdoc: Support for documentation in HTML, plain text, and reStructuredText formats #489
Originally submitted to Google Code by Thomas.J... on 26 Feb 2010
Hi,
libdoc.py should filter any <pre>-Tags in JavaDoc documentation of keyword
libraries written in Java.
Background for this is that there must be a certain formatting for
libdoc.py to get for example nice looking tables. But this formatting is
easily destroyed by Eclipse's code-formatting, which is used quite often.
The <pre>-Tags can be used to tell Eclipse to ignore certain parts of the
Javadoc for formatting.
There are other ways telling Eclipse not to format Javadoc, but this is
not very safe, especially when new members join working on a project.
Maybe a "quick & dirty" solution could be to at least ignore any lines
containing
Would it actually be better to make it possible to use HTML formatting in the
documentation? That could be useful in in other situations too. We could make it
possible to somehow specify the doc format (I have few ideas) and could support also
other formats like reStructuredText.
If you want to experiment with HTML in keyword docs, you can apply the following
patch to libdoc.py. Notice that with this patch all docs are expected to be HTML.
Index: libdoc.py
===================================================================
--- libdoc.py (<a href="https://code.google.com/p/robotframework/source/detail?r=2566">revision 2566</a>)
+++ libdoc.py (working copy)
@⁠@⁠ -135,6 +135,7 @⁠@⁠
def __getattr__(self, name):
if name == 'htmldoc':
+ return self.doc
return self._get_htmldoc(self.doc)
if name == 'htmlshortdoc':
return utils.html_attr_escape(self.shortdoc)
Thomas, any comments for making it possible to use HTML in the documentation?
Just removing some tags feels a bit arbitrary in libdoc.py itself. It might be a
better idea to do that as a separate step before running libdoc.py. Something this
ought to be enough: sed -i 's|</*pre>||g'
Originally submitted to Google Code by Thomas.J... on 15 Mar 2010
I think supporting HTML would be very good and of course even better than just
"removing" specific Tags. Removing those manually before running libdoc is on the
other hand not very convenient and I doubt I would do that ;-).
I agree that support for HTML format would be nice and updated the summary
accordingly. If it's enough to support either the current syntax or HTML, and it's
adequate to specify the format from the command line, implementing this is pretty
easy. Adding support for somehow specifying the documentation format per keyword
would be somewhat harder.
I didn't mean you should manually remove those tags. Instead, you could have a script
to generate the documentation that would, as the first step, remove tags e.g. using
the sed command.
Issue 1221 basically requested support for creating documentation in plain text format. I think that's a valid request and implementing it at the same time as implementing support for HTML shouldn't be hard. We probably should also consider supporting reStructeredText because it is so widely used format in Python projects.
Nowadays when libdoc is bundled with the core framework and its code is in pretty good shape, implementing all this shouldn't be too complicated. We could even see could it be done in possible 2.7.5 release or latest in 2.8.
Now it is possible to define doc format in libraries themselves using
ROBOT_LIBRARY_DOC_FORMAT attribute similarly as e.g. ROBOT_LIBRARY_VERSION.
Libdoc doesn't yet use this attribute, though, but supporting it is up next.
Now format specified in test libs themselves using ROBOT_LIBRARY_DOC_FORMAT is
used by libdoc. Format specified with --DocFormat option overrides that,
though.
Handling invalid format from R_L_D_F still missing.
Activity
spooning commentedon Jun 29, 2014
Would it actually be better to make it possible to use HTML formatting in the
documentation? That could be useful in in other situations too. We could make it
possible to somehow specify the doc format (I have few ideas) and could support also
other formats like reStructuredText.
If you want to experiment with HTML in keyword docs, you can apply the following
patch to libdoc.py. Notice that with this patch all docs are expected to be HTML.
spooning commentedon Jun 29, 2014
Thomas, any comments for making it possible to use HTML in the documentation?
Just removing some tags feels a bit arbitrary in libdoc.py itself. It might be a
better idea to do that as a separate step before running libdoc.py. Something this
ought to be enough: sed -i 's|</*pre>||g'
spooning commentedon Jun 29, 2014
I think supporting HTML would be very good and of course even better than just
"removing" specific Tags. Removing those manually before running libdoc is on the
other hand not very convenient and I doubt I would do that ;-).
spooning commentedon Jun 29, 2014
I agree that support for HTML format would be nice and updated the summary
accordingly. If it's enough to support either the current syntax or HTML, and it's
adequate to specify the format from the command line, implementing this is pretty
easy. Adding support for somehow specifying the documentation format per keyword
would be somewhat harder.
I didn't mean you should manually remove those tags. Instead, you could have a script
to generate the documentation that would, as the first step, remove tags e.g. using
the sed command.
spooning commentedon Jun 29, 2014
Issue 1221 has been merged into this issue.
spooning commentedon Jun 29, 2014
Issue 1221 basically requested support for creating documentation in plain text format. I think that's a valid request and implementing it at the same time as implementing support for HTML shouldn't be hard. We probably should also consider supporting reStructeredText because it is so widely used format in Python projects.
Nowadays when libdoc is bundled with the core framework and its code is in pretty good shape, implementing all this shouldn't be too complicated. We could even see could it be done in possible 2.7.5 release or latest in 2.8.
spooning commentedon Jun 29, 2014
This issue was updated by revision 82cf631e12ac.
Now it is possible to give documentation format from the CLI using --docformat
option. Supported formats are ROBOT (default), TEXT and HTML.
Plenty of stuff still to do:
spooning commentedon Jun 29, 2014
This issue was updated by revision 4a68b835297c.
Now previously used doc format is read from specs.
spooning commentedon Jun 29, 2014
This issue was updated by revision f0be49698621.
Added support for reStructuredText. Can be enabled with
--DocFormat reST.spooning commentedon Jun 29, 2014
This issue was updated by revision 5257e2711ae0.
Now it is possible to define doc format in libraries themselves using
ROBOT_LIBRARY_DOC_FORMAT attribute similarly as e.g. ROBOT_LIBRARY_VERSION.
Libdoc doesn't yet use this attribute, though, but supporting it is up next.
spooning commentedon Jun 29, 2014
This issue was updated by revision 9378aaed9378.
Now format specified in test libs themselves using ROBOT_LIBRARY_DOC_FORMAT is
used by libdoc. Format specified with --DocFormat option overrides that,
though.
Handling invalid format from R_L_D_F still missing.
spooning commentedon Jun 29, 2014
This issue was updated by revision 9ae40a25dc73.
Now invalid doc format defined in test library cause a clear error.
spooning commentedon Jun 29, 2014
This issue was updated by revision 9e2440ed7125.
Updated --help.
spooning commentedon Jun 29, 2014
This issue was updated by revision f825f0c10fbf.
Documented using ROBOT_LIBRARY_DOC_FORMAT in source code. Documenting
alternative formats in general is still missing.
spooning commentedon Jun 29, 2014
This issue was updated by revision 0f9e20e4a62d.
Now using different doc formats with libdoc is documented. And this issue
done.
Feedback about the feature and its documentation would be appreciated.
spooning commentedon Jun 29, 2014
In case someone is actually interested to look at the documentation, here's a direct link to the generated version:
http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html#documentation-syntax