Added compatibility for mkdocs 0.17

This commit is contained in:
squidfunk 2017-10-22 21:22:25 +02:00 committed by Martin Donath
parent badeb7e86f
commit 4060ad09d9
6 changed files with 13 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -164,7 +164,7 @@
{% endblock %}
</div>
{% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-268d62d82d.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-946997f430.js"></script>
{% set languages = lang.t("search.languages").split(",") %}
{% if languages | length and languages[0] != "" %}
{% set path = base_url + "/assets/javascripts/lunr" %}
@ -181,7 +181,7 @@
<script src="{{ path }}/lunr.multi.js"></script>
{% endif %}
{% endif %}
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
<script>app.initialize({version:"{{ mkdocs_version }}",url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% endfor %}

View File

@ -18,6 +18,6 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
mkdocs==0.16.3
mkdocs>=0.16
Pygments>=2.2
pymdown-extensions>=3.4

View File

@ -225,7 +225,9 @@ function initialize(config) { // eslint-disable-line func-style
new Material.Event.Listener("[data-md-component=query]", [
"focus", "keyup", "change"
], new Material.Search.Result("[data-md-component=result]", () => {
return fetch(`${config.url.base}/mkdocs/search_index.json`, {
return fetch(`${config.url.base}/${
config.version < "0.17" ? "mkdocs" : "search"
}/search_index.json`, {
credentials: "same-origin"
}).then(response => response.json())
.then(data => {

View File

@ -320,7 +320,12 @@
<!-- Initialize application -->
<script>
app.initialize({ url: { base: "{{ base_url }}" } });
app.initialize({
version: "{{ mkdocs_version }}",
url: {
base: "{{ base_url }}"
}
});
</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>