Skip to content

Se agrega redirección al codigo en ./overrides #1108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .overrides/tools/templates/customsourcelink.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ <h3>{{ _('This Page') }}</h3>
<ul class="this-page-menu">
<li><a href="{{ pathto('bugs') }}">{% trans %}Report a Bug{% endtrans %}</a></li>
<li>
{{sourcename}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to show the source name here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@humitos Si, esto es que estuve probando, a ver que me venía.

{% if sourcename.endswith('.rst') %}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este if debería comprobar si contiene overrides en vez, ya que todos los sourcename terminan en .txt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es que en sourcename no llega nada más que el nombre del archivo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El problema es que, como comenta eamanu sourcename, no parece ser de ayuda alguna, es simplemente la ruta de la forma "library/sys.rst.txt", "CONTRIBUTING.rst.txt", etc. Para los que están en .overrides parece que da la ruta una vez copiados recursivamente por lo que .overrides no aparece por ningún lado... Un poco a la desesperada, probé con page_source_suffix, incluso con pathto, pero igual. La idea de usar la característica de que todos son huérfanos, como comentaba aroquega arriba, creo que tiene el problema de que hay algunos que no están en .overrides (como glossary).

Como comentaba arriba, al final la única solución que encontré fue la misma que plantea @aroquega en la PR #1111, la siempre efectiva fuerza bruta, aunque no pierdo la esperanza de que exista una opción más "elegante" :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sí, a menos que @eamanu encuentre una variable o filtro que te lleve al archivo fuente y no a lo compilado.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si, me parece que soluciona el problema, así que cerraría este PR a favor de #1111, no encuentro una variable que me de un path completo. @aroquega @fjsevilla-dev @humitos

Gracias!

<a href="https://github.com/python/python-docs-es/blob/{{ version }}/.overrides/{{ sourcename|replace('.rst.txt', '.rst') }}"
rel="nofollow">{{ _('Show Source') }}
</a>
{% else %}
<a href="https://github.com/python/python-docs-es/blob/{{ version }}/{{ sourcename|replace('.rst.txt', '.po') }}"
rel="nofollow">{{ _('Show Source') }}
</a>
{% endif %}
</li>
</ul>
</div>
Expand Down