Fixed meta source only rendering first character

This commit is contained in:
squidfunk 2017-11-01 15:22:14 +01:00 committed by Martin Donath
parent e8200730b3
commit a0308b0dce
3 changed files with 12 additions and 23 deletions

View File

@ -73,16 +73,7 @@ is defined inside the project's `mkdocs.yml`, the files can be linked using the
source: file.js source: file.js
``` ```
A new entry at the bottom of the table of contents is generated that is linking The filename is appended to the `repo_url` set in your `mkdocs.yml`, but can
to the section listing the linked source files. Multiple files can be linked by
adding filenames on separate lines:
``` markdown
source: file.js
file.css
```
The filenames are appended to the `repo_url` set in your `mkdocs.yml`, but can
be prefixed with a `path` to ensure correct path resolving: be prefixed with a `path` to ensure correct path resolving:
Example: Example:

View File

@ -139,12 +139,11 @@
{% block source %} {% block source %}
{% if page.meta.source %} {% if page.meta.source %}
<h2 id="__source">{{ lang.t("meta.source") }}</h2> <h2 id="__source">{{ lang.t("meta.source") }}</h2>
{% set path = (page.meta.path | default([""]) | first) %} {% set path = (page.meta.path | default([""])) %}
{% for file in page.meta.source %} {% set file = page.meta.source %}
<a href="{{ [config.repo_url, path, file] | join('/') }}" title="{{ file }}" class="md-source-file"> <a href="{{ [config.repo_url, path, file] | join('/') }}" title="{{ file }}" class="md-source-file">
{{ file }} {{ file }}
</a> </a>
{% endfor %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}

View File

@ -264,13 +264,12 @@
{% block source %} {% block source %}
{% if page.meta.source %} {% if page.meta.source %}
<h2 id="__source">{{ lang.t("meta.source") }}</h2> <h2 id="__source">{{ lang.t("meta.source") }}</h2>
{% set path = (page.meta.path | default([""]) | first) %} {% set path = (page.meta.path | default([""])) %}
{% for file in page.meta.source %} {% set file = page.meta.source %}
<a href="{{ [config.repo_url, path, file] | join('/') }}" <a href="{{ [config.repo_url, path, file] | join('/') }}"
title="{{ file }}" class="md-source-file"> title="{{ file }}" class="md-source-file">
{{ file }} {{ file }}
</a> </a>
{% endfor %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}