Skip to content

libdoc: Support for documentation in HTML, plain text, and reStructuredText formats #489

Closed

Description

@spooning

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

  • <pre>
  • </pre>

with any combination of additional whitespaces.

Thanks & Cheers

  • Thomas

Activity

  1. added this to the 2.7.5 milestone on Jun 29, 2014
  2. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 27 Feb 2010

    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)
    @&#8288;@&#8288; -135,6 +135,7 @&#8288;@&#8288;
    
         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)
    
  3. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 14 Mar 2010

    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'

  4. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    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 ;-).

  5. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 15 Mar 2010

    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.

  6. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 11 Sep 2012

    Issue 1221 has been merged into this issue.

  7. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 11 Sep 2012

    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.

  8. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 9 Oct 2012

    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:

    • Support for reST.
    • Documentation in --help.
    • Documentation in User Guide.
    • Read format from XML spec.
    • Possibly support for specifying doc format alraedy in library source.
  9. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 9 Oct 2012

    This issue was updated by revision 4a68b835297c.

    Now previously used doc format is read from specs.

  10. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 9 Oct 2012

    This issue was updated by revision f0be49698621.

    Added support for reStructuredText. Can be enabled with --DocFormat reST.

  11. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 11 Oct 2012

    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.

  12. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 11 Oct 2012

    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.

  13. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 11 Oct 2012

    This issue was updated by revision 9ae40a25dc73.

    Now invalid doc format defined in test library cause a clear error.

  14. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 15 Oct 2012

    This issue was updated by revision 9e2440ed7125.

    Updated --help.

  15. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 15 Oct 2012

    This issue was updated by revision f825f0c10fbf.

    Documented using ROBOT_LIBRARY_DOC_FORMAT in source code. Documenting
    alternative formats in general is still missing.

  16. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 15 Oct 2012

    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.

  17. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions