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
```
A new entry at the bottom of the table of contents is generated that is linking
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
The filename is appended to the `repo_url` set in your `mkdocs.yml`, but can
be prefixed with a `path` to ensure correct path resolving:
Example:

View File

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

View File

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