Skip to content

How to clean up the source code path when using gen_ref_pages.py? #622

Closed Answered by pawamoy
Andrew-S-Rosen asked this question in Q&A
Discussion options

You must be logged in to vote

You could try overriding templates to use relative_package_filepath instead of relative_filepath which depends on the current working directory.

For example in templates/python/material/function.html:

{% extends "_base/function.html" %}
{% block source scoped %}
  {% if config.show_source and function.source %}
    <details class="quote">
      <summary>{{ lang.t("Source code in") }} <code>{{ function.relative_package_filepath }}</code></summary>
      {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }}
    </details>
  {% endif %}
{% endblock source %}

I'm considering adding some logic to the templates to use the relative filepath if its not absol…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pawamoy
Comment options

@Andrew-S-Rosen
Comment options

Answer selected by Andrew-S-Rosen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #619 on October 01, 2023 09:40.