pdoc icon indicating copy to clipboard operation
pdoc copied to clipboard

Programmatic way of showing module list

Open stevegore opened this issue 6 years ago • 1 comments

Expected Behavior

As per #91. It's not immediately obvious how one could generate a list of modules programmatically.

It looks like your mako template changes format based on context:

<%
    module_list = 'modules' in context.keys()  # Whether we're showing module list in server mode
%>

But I'm looking for a convenient way of getting the module list to appear. Does such a method exist?

Actual Behavior

Some documentation or exposed method would be great.

stevegore avatar Aug 19 '19 01:08 stevegore

I assume you'd like to add a list of all documented modules into the sidebar or some such. This is not actually a bad idea (:+1:), but it's not made convenient by the current implementation.

Programatically, I guess you could override the template (html.mako) and then call pdoc.Module.html() with an extra parameter that your updated template uses:

pdoc.Module('my_module').html(extra_modules=[module2, module3])

Let me know if that (doesn't) works for you. Or if you have any suggestions, welcome.

kernc avatar Aug 20 '19 10:08 kernc