Repository navigation
Libdoc: Embedding HTMl doc into XML output format. #3301 - #3302
Conversation
update from original
|
Hi Pekka, I finished the implementation. Documentation is lean but should be enough. i would be happy if this could be reviewed quickly. ;-) kind regards |
|
In general looks very good. Quick comments:
|
pekkaklarck
left a comment
There was a problem hiding this comment.
Looks very good in general but see individual line notes for things that should/could be enhanced.
pekkaklarck
left a comment
There was a problem hiding this comment.
Looks good but I'd like code to be cleaned up a bit and docs to be enhanced. I also added few comments about tests, but they aren't that serious and I could fix them myself as well.
| documentation, it is possible to configure | ||
| this with ``XML:HTML``. This could be used if the XML | ||
| files are used to be imported into other systems | ||
| that require HTML text to present this to a human. |
There was a problem hiding this comment.
I don't think it's adequate to explain this kind of a feature only in the command line usage. Features should be documented so that the docs can be found easily.
The problem is that Libdoc documentation doesn't seem to have a good place to explain this. Probably the best place would be under the existing Generating documentation section, but that section should also be enhanced to explain HTML and XML formats a bit more thoroughly. I can do that if you want.
There should also be a note that this is a new feature in RF 3.2.
There was a problem hiding this comment.
I would really appreciate, if you could add this to Libdoc documentation.
I wanted to do this but as you mentioned i could not fit this into the existing structure.
I was hard for me to "restructure" your docs.
I would recomment only to add the "new in RF 3.2" comment only in the libdoc CLI doc.
I think it really overloads the manpage without adding value to the user who is already using 3.2 when he reads this information.
There was a problem hiding this comment.
added "XML:HTML is new in RF 3.2." into libdoc.rst
| documentation, it is possible to configure | ||
| this with 'XML:HTML'. This could be used if the XML | ||
| files are used to be imported into other systems | ||
| that require HTML text to present this to a human. |
There was a problem hiding this comment.
Same comments about docs I wrote related to the User Guide documentation apply also to this help text. The help text doesn't need to be as thorough as User Guide, though.
There was a problem hiding this comment.
I think it is not disturbing the user, when it is very briefly explained here.
often Manpages are too lean. Imho.
i would let it here because in the moment it has no negative effect.
There was a problem hiding this comment.
In my opinion it should be explicitly documented in the body of the help text. Usage should be short.
| [Arguments] ${expected} ${cli}= ${lib}=DocFormat.py | ||
| ${lib} = Join Path ${TESTDATADIR} ${lib} | ||
| Run Libdoc And Parse Output ${cli} ${lib} | ||
| Format should be ${expected} |
There was a problem hiding this comment.
Isn't this format always HTML? If yes, it should be hard coded here and the ${expected} argument removed.
There was a problem hiding this comment.
thats correct.
i added the ${expected} to the arguments to have a better self similarity.
That a person who tries to understand the test not always habe to look into Keyword definition.
If you insist, i can remove it.
There was a problem hiding this comment.
An argument that isn't really used feels, well, useless for me. It also gives an impression that XML:HMTL format would support some other doc formats than HTML. I'd prefer this to be changed but don't feel strongly. If you prefer this format, leave it like that.
|
|
||
| Compare HTML from XML:HTML | ||
| [Template] NONE | ||
| Run Libdoc -F ROBOT --format XML:HTML ${TESTDATADIR}/DocFormat.py ${OUTPREFIX}_xml_with_html.xml |
There was a problem hiding this comment.
I think you could use just ${OUTXML} instead of ${OUTPREFIX}_xml_with_html.xml here.
There was a problem hiding this comment.
choosen this name for better understandability.
Reader should understand that this OUTXML contains HTML as doc.
There was a problem hiding this comment.
For me a generic and pre-existing name would feel a bit better but I don't feel strongly about it. We can leave it like this as well.
pekkaklarck
left a comment
There was a problem hiding this comment.
Looks good to me. Small changes could still be done to code and tests (see separate comments), but they can also be left as-is (or I can take a look later). I can also update docs.
|
|
||
| Compare HTML from XML:HTML | ||
| [Template] NONE | ||
| Run Libdoc -F ROBOT --format XML:HTML ${TESTDATADIR}/DocFormat.py ${OUTPREFIX}_xml_with_html.xml |
There was a problem hiding this comment.
For me a generic and pre-existing name would feel a bit better but I don't feel strongly about it. We can leave it like this as well.
| [Arguments] ${expected} ${cli}= ${lib}=DocFormat.py | ||
| ${lib} = Join Path ${TESTDATADIR} ${lib} | ||
| Run Libdoc And Parse Output ${cli} ${lib} | ||
| Format should be ${expected} |
There was a problem hiding this comment.
An argument that isn't really used feels, well, useless for me. It also gives an impression that XML:HMTL format would support some other doc formats than HTML. I'd prefer this to be changed but don't feel strongly. If you prefer this format, leave it like that.
| documentation, it is possible to configure | ||
| this with 'XML:HTML'. This could be used if the XML | ||
| files are used to be imported into other systems | ||
| that require HTML text to present this to a human. |
There was a problem hiding this comment.
In my opinion it should be explicitly documented in the body of the help text. Usage should be short.
| writer.element('doc', formatter(libdoc.doc)) | ||
|
|
||
| def _write_keywords(self, type, keywords, writer): | ||
| def _write_keywords(self, writer, type, keywords, formatter): |
There was a problem hiding this comment.
Why was position of the writer argument changed? Especially having writer and formatter at the different ends of the signature feels a bit odd.
|
Thanks @Snooz82! I'll enhance docs separately. |
| writer.element('doc', formatter(libdoc.doc)) | ||
|
|
||
| def _write_keywords(self, type, keywords, writer): | ||
| def _write_keywords(self, writer, type, keywords, formatter): |
There was a problem hiding this comment.
why isn't writer an instance attribute?
There was a problem hiding this comment.
That's actually how @Snooz82 implemented it in the beginning. I asked him to change it because for me it would have felt a bit like misuse of the object state. It would have been fine if writer could be created in __init__, but in this case I prefer passing it as an argument similarly as formatter. Also, I prefer writer.start(...) over self._writer.start(...).
I guess this depends heavily on the personal coding style and preferences.
There was a problem hiding this comment.
When coding object oriented i like to use instance attributes over handing over and returning stuff. As Pekka said, its kind of a personal style.
Because in Python the self. decreases the readability i have no real preferences here.
No description provided.