1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2025-03-01 15:30:36 +01:00

Fixed duplicate slashes in source file URLs

This commit is contained in:
squidfunk 2018-02-11 19:55:36 +01:00 committed by Martin Donath
parent 7cf7ff98a2
commit b3e293ece9
2 changed files with 10 additions and 2 deletions

View File

@ -145,9 +145,13 @@
{% block source %} {% block source %}
{% if page and page.meta and page.meta.source %} {% if page and page.meta and page.meta.source %}
<h2 id="__source">{{ lang.t("meta.source") }}</h2> <h2 id="__source">{{ lang.t("meta.source") }}</h2>
{% set repo = config.repo_url %}
{% if repo | last == "/" %}
{% set repo = repo[:-1] %}
{% endif %}
{% set path = page.meta.path | default([""]) %} {% set path = page.meta.path | default([""]) %}
{% set file = page.meta.source %} {% set file = page.meta.source %}
<a href="{{ [config.repo_url, path, file] | join('/') }}" title="{{ file }}" class="md-source-file"> <a href="{{ [repo, path, file] | join('/') }}" title="{{ file }}" class="md-source-file">
{{ file }} {{ file }}
</a> </a>
{% endif %} {% endif %}

View File

@ -276,9 +276,13 @@
{% block source %} {% block source %}
{% if page and page.meta and page.meta.source %} {% if page and page.meta and page.meta.source %}
<h2 id="__source">{{ lang.t("meta.source") }}</h2> <h2 id="__source">{{ lang.t("meta.source") }}</h2>
{% set repo = config.repo_url %}
{% if repo | last == "/" %}
{% set repo = repo[:-1] %}
{% endif %}
{% set path = page.meta.path | default([""]) %} {% set path = page.meta.path | default([""]) %}
{% set file = page.meta.source %} {% set file = page.meta.source %}
<a href="{{ [config.repo_url, path, file] | join('/') }}" <a href="{{ [repo, path, file] | join('/') }}"
title="{{ file }}" class="md-source-file"> title="{{ file }}" class="md-source-file">
{{ file }} {{ file }}
</a> </a>