Skip to content

Libdoc: Support converting docs to HTML with XML outputs #3301

Closed

Description

@Snooz82

Some tools uses the xml output from libdoc to import Keywords as teststeps into their repository.
Language Server implementation could also benefit from this feature.

It would be very helpful if there could be a way to get the "rendered" docstrings into the node in the xml.

Libdoc always puts the raw docformat into the xml.
If the input format from library is HTML Libdoc put HTML into xml.

The attribute format of the node keywordspec is set to HTML.

When now Libdoc would be able to set the output format to "rendered" HTML however the input format would be, it would be possible to import Keywords into other tools or show the docstrings in IDEs.

The HTML generation of libdoc based on the XML input file would still work, because HTML doc is a valid input now also.

kinde regards
René

Activity

  1. Snooz82 commented on Sep 9, 2019

    @Snooz82
    MemberAuthor

    Hi Pekka,

    i looked at the code and it would be easy if...

    remember the discussion how to call this kind of format?

    Option 1:
    python -m robot.libdoc --format XML --xmldocformat HTML SeleniumLIbrary SL.xml
    an extra option that only works if --format would be XML. (or extension...)
    This is not so easy in code and is harder to understand for users imho.

    Option 2:
    python -m robot.libdoc --format HTMLINXML SeleniumLIbrary SL.xml
    (we may call it different)
    Two advantages.

    1. No dependencies between options.
    2. supereasy to implement.

    code:
    def LibdocWriter(format=None): format = (format or 'HTML').upper() if format == 'HTML': return LibdocHtmlWriter() if format == 'XML': return LibdocXmlWriter() raise DataError("Format must be either 'HTML' or 'XML', got '%s'." % format)

    here we could add an Argument to LibdocXmlWriter() like LibdocXmlWriter(embed_html_doc=False) or we could implement a third Writer.
    i would prefer to add an argument to switch the output_doc_format because then we only need to add a ahnd full of line to the existing LibdocXmlWriter.

    Opinions?

    I made a pull request only to show where should be a change in code.
    No test not documentation etc yet!

  2. pekkaklarck commented on Sep 10, 2019

    @pekkaklarck
    Member
    1. I agree this would be a useful feature making it easier for external tools processing Libdoc's XML specs to handle them correctly.

    2. Implementation in PR Libdoc: Embedding HTMl doc into XML output format. #3301 #3302 looks good in high level. Some tests and docs would obviously be needed and the are some things to be enhanced in the code as well.

    3. Separate option like --xmldocformat would be more explicit and still feels a bit better for me. I understand that reusing the existing --format option makes implement a little easier, and it can be argued that using a single option is easier for users as well. I'm fine reusing --format and separate --xmldocformat can be added later if someone feels it better.

    4. The proposed value HTMLINXML looks pretty strange to me, though, even when written like HTMLinXML. We've often used : as a separate with values in cases like this (e.g. --loglevel INFO:DEBUG) and perhaps we could use XML:HTML in this case as well. It would also allow extending the usage later to something like XML:TXT if needed.

  3. changed the title [-]Libdoc: Embed HTML docstring into XML output format[/-] [+]Libdoc: Support converting docs to HTML with XML outputs[/+] on Sep 10, 2019
  4. added this to the v3.2 milestone on Sep 10, 2019
  5. added
    acknowledge
    on Oct 9, 2019
  6. pekkaklarck commented on Oct 9, 2019

    @pekkaklarck
    Member

    Thanks to PR #3302 by @Snooz82 this issue ought to be done. Leaving open to give @Snooz82 time to look at the docs that I updated.

  7. pekkaklarck commented on Oct 10, 2019

    @pekkaklarck
    Member

    We considered this issue done. Docs may be still enhanced a bit in the future.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgealpha 1priority: medium

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions