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 converting docs to HTML with XML outputs #3301
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.
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.
No dependencies between options.
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!
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.
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.
changed the title [-]Libdoc: Embed HTML docstring into XML output format[/-][+]Libdoc: Support converting docs to HTML with XML outputs[/+]on Sep 10, 2019
Activity
Snooz82 commentedon Sep 9, 2019
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.xmlan 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.
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!
pekkaklarck commentedon Sep 10, 2019
I agree this would be a useful feature making it easier for external tools processing Libdoc's XML specs to handle them correctly.
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.
Separate option like
--xmldocformatwould be more explicit and still feels a bit better for me. I understand that reusing the existing--formatoption 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--formatand separate--xmldocformatcan be added later if someone feels it better.The proposed value
HTMLINXMLlooks pretty strange to me, though, even when written likeHTMLinXML. We've often used:as a separate with values in cases like this (e.g.--loglevel INFO:DEBUG) and perhaps we could useXML:HTMLin this case as well. It would also allow extending the usage later to something likeXML:TXTif needed.[-]Libdoc: Embed HTML docstring into XML output format[/-][+]Libdoc: Support converting docs to HTML with XML outputs[/+]Libdoc: Support converting docs to HTML with XML outputs
Libdoc: Small cleanup to XML:HTML code and tests.
Libdoc: Enhanced docs for XML:HTML feature.
pekkaklarck commentedon Oct 9, 2019
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.
Libdoc: Fine tune XML:HTML docs in help text #3301
pekkaklarck commentedon Oct 10, 2019
We considered this issue done. Docs may be still enhanced a bit in the future.