<!--
  This file is part of Flask-Wiki
  Copyright (C) 2020 RERO

  Flask-Wiki is free software; you can redistribute it and/or modify
  it under the terms of the Revised BSD License; see LICENSE file for
  more details
-->

{% extends config.get('WIKI_BASE_TEMPLATE') %}
{% set active_page = "page" %}

{% block content %}
<div data-delay="1500" class="toast hide">
    <div class="toast-header text-primary font-weight-bold">
        Markdown
    </div>
    <div class="toast-body">
        {{ _('Copied to your clipboard') }}
    </div>
</div>
<main class="row mt-4 wiki-page">
    <div class="col-md-7 offset-md-2">
        <header class="d-flex flex-column justify-content-lg-between mb-4 pb-2 border-bottom">
            <header class="wiki-page-header d-flex flex-column flex-lg-row justify-content-lg-between mb-2 mb-lg-0">
            <h1 class="wiki-page-title mb-0">{{page.title}}</h1>
            {% if can_edit_wiki %}
            <div class="wiki-page-edition" role="group">
                <button data-name="{{ page.title }}"
                        data-link="{{ url_for('wiki.page', url=page.url) }}"
                        class="copy-file-code btn btn-sm btn-outline-primary">
                    <i class="fa fa-clipboard"></i> {{ _('Copy link') }}
                </button>
                <a type="button" class="btn btn-outline-primary btn-sm"
                   href="{{ url_for('wiki.edit', url=page.url) }}">
                   <i class="fa fa-pencil"></i> {{ _('Edit') }}
                </a>
            </div>
            {% endif %}
            </header>
            <footer class="wiki-page-info d-flex flex-column flex-lg-row justify-content-lg-between">
            {% if page.tags %}
            <ul class="wiki-page-tags m-0 p-0">
                {% for tag in page.tags.split(',') %}
                <li class="badge badge-primary">{{ tag }}</li>
                {% endfor %}
            </ul>
            {% endif %}
            <div class="text-muted small">
                <span>{{ _('Last updated:')}} {{ page.modification_datetime | date_format }}</span>
            </div>
            </footer>
        </header>
        <article class="content">
        {{ page }}
        </article>
    </div>
    <aside class="col-md-3">
        <div class="toc sticky-top pt-3">
            {% if page.toc %}
            <h5>{{ _('Table of contents') }}</h5>
            {{ page.toc }}
            {% endif %}
        </div>
    </aside>
</main>
{% endblock %}
