OpenMS / pyopenms-docs

pyOpenMS readthedocs documentation, additional utilities, addons, scripts, and examples.
https://pyopenms.readthedocs.io
Other
42 stars 50 forks source link

Convert References to html Links for ipynb #399

Closed matteopilz closed 1 year ago

matteopilz commented 1 year ago

We still need to differentiate between pyopenms & pyopenms.plotting. E.g. :py:func:~.plot_spectrum in fragment spectrum generation belongs to plotting, but there is no indication to that (Except for checking if it contains "plot").

jpfeuffer commented 1 year ago

Nice. If possible I would probably go via the classes of the Code object though:

[[ident, classes, keyvals], code] = value
        if "py:class" in classes or "py:meth" in classes:

Regarding methods/classes from submodules, I guess you have to use the full path in RST to be able to distinguish them. Or you link to search results for this function on ReadTheDocs (instead of a direct link).

matteopilz commented 1 year ago

The references in the rst still work with pyopenms.plotting.plot_spectrum, but testing for the classes is not working. Do you have an idea, how to see how the classes are stored?

jpfeuffer commented 1 year ago

Have you tried some print statements? I also am not sure what pandoc actually stores while parsing.

matteopilz commented 1 year ago

It seems, that all attributes except code are empty. Maybe we can use a regex?

jpfeuffer commented 1 year ago

Hmm.. I can't check right now but did you check that "Code" is the correct name of those classes? From what I saw in: https://github.com/jgm/pandoc/issues/3407 and the related commit: https://github.com/jgm/pandoc/commit/d1444b4ecdd7bc2f3b6180ceb2635d51382c4ab8 it feels like roles are parsed as "Span" with class attributes "role" and the name of the role (here "py:class" I think).

jpfeuffer commented 1 year ago

Could be a Code nested in a Span, where the Span has the actual classes attached.

matteopilz commented 1 year ago

I have tried to ask for key == 'Span', but it didn't work.

jpfeuffer commented 1 year ago

Ok! I guess that is good enough for now then. Thanks.

matteopilz commented 1 year ago

It's probably best to remove or redirect the glossary references as well. image

jpfeuffer commented 1 year ago

True. Do you think it makes sense in the same filter? Could be Code sections as well.

matteopilz commented 1 year ago

I don't think its Code. I'm going to make a new filter and will merge this PR.