{% extends "base.html" %} {% from "icons.html" import icon, sep, ref, file_icon %} {% set folder_limit = 1000 %} {% set tab = 'wiki' %} {% set home = page_url('') %} {% set current_folder = path if view in ('folder', 'new') else (crumbs[:-1]|map(attribute=1)|list|last if crumbs|length > 1 else '') %} {% block title %}{{ crumbs[-1][0] if crumbs else space.name }} · Synaptane{% endblock %} {% block crumbs %}{{ sep() }}{{ org.name }}{{ sep() }}{{ space.name }}{% for name, p in crumbs %}{{ sep() }}{% if loop.last %}{{ name }}{% else %}{{ name }}{% endif %}{% endfor %}{% endblock %} {% block head %}{% endblock %} {% from "ui.html" import csrf_field, when, secret_confirm, file_input with context %} {# Page verification: discreet badge in the bar, detail in the ⋮ menu. #} {% macro verify_title(state, owner_name, modified) -%} {%- if state.stale %}{{ _("To review since {date}", date=state.due.isoformat()) }} · {{ _("verified on {date}", date=state.verified.isoformat()) }} {%- else %}{{ _("Verified on {date}", date=state.verified.isoformat()) }}{% if state.due %} · {{ _("review on {date}", date=state.due.isoformat()) }}{% endif %}{% endif %} {%- if owner_name %} · {{ _("owner: {name}", name=owner_name) }}{% endif %} {%- if modified %} · {{ _("modified since") }}{% endif %} {%- endmacro %} {% macro day(value) -%}{%- endmacro %} {% macro doc_menu() -%} {%- endmacro %} {# Put a version back (contributor): a new commit, the replaced text stays in the history. #} {% macro restore_form(sha) -%}
{{ csrf_field() }} {% if restoring == sha %}{{ secret_confirm(error) }}{% endif %}
{%- endmacro %} {% block topbar_end %} {% if view == 'file' %}
{% set v = verification %} {% if v and v.state.verified %} {{ icon('clock' if v.state.stale else 'verified', 14) }} {{ verify_title(v.state, v.owner_name, v.modified) }} {% endif %} {{ file.size|filesize }}{% if last_change %} · {{ _("modified on") }} {{ _("by") }} {{ last_change.author.name }}{% endif %} {{ _("History") }} {% if contribute and file.text is not none %}{{ _("Edit") }}{% endif %} {% call doc_menu() %} {% if v %}

{{ icon('clock' if v.state.stale else 'verified' if v.state.verified else 'circle', 15) }}{% if v.state.stale %}{{ _("To review since") }} {{ day(v.state.due) }}{% elif v.state.verified %}{{ _("Verified on") }} {{ day(v.state.verified) }}{% else %}{{ _("Never verified") }}{% endif %}

{%- if v.owner_name %}{{ _("Owner: {name}", name=v.owner_name) }}{% else %}{{ _("No owner") }}{% endif %} {%- if v.state.stale %} · {{ _("verified on") }} {{ day(v.state.verified) }}{% elif v.state.due %} · {{ _("review on") }} {{ day(v.state.due) }}{% endif %} {%- if v.state.period %} · {{ period_label(v.state.period) }}{% if v.state.reconfirmed %} ({{ _(pl(v.state.reconfirmed, "lengthened: verified again {n} time with no change", "lengthened: verified again {n} times with no change"), n=v.state.reconfirmed) }}){% elif v.state.inherited %} ({{ _("space setting") }}){% endif %}{% endif %} {%- if v.modified %} · {{ _("modified since it was verified") }}{% endif %}

{% if contribute %}
{{ csrf_field() }}
{% for name in v.people %}

{{ _("Content correct and up to date? The date goes into the page's front matter, in a commit under your name; with no owner yet, it becomes you.") }} {{ _("Verified again with no change since, it waits twice as long before its next review, up to two years.") }}

{% endif %}

{% endif %} {% if file.kind == 'markdown' %}
{{ csrf_field() }}

{% endif %} {{ icon('refresh', 14) }}{{ _("History") }} {{ icon('download', 14) }}{{ _("Download") }} {% if file.name.lower().endswith(('.html', '.htm')) %}{{ icon('file', 14) }}{{ _("View source") if html_page else _("View rendered page") }}{% endif %} {{ file.path }} {{ _("Fingerprint") }} {{ file.sha[:10] }} {% if contribute %}
{{ csrf_field() }}
{% for folder_path in all_folders %}

{{ _("Links to this page, and its own links, are updated at the same time.") }}


{{ csrf_field() }}
{% endif %} {% endcall %}
{% elif view == 'folder' %}
{{ _("{folders}, {files}", folders=_(pl(folder.folders|length, "{n} folder", "{n} folders"), n=folder.folders|length), files=_(pl(folder.files|length, "{n} file", "{n} files"), n=folder.files|length)) }} {% if contribute %}{{ icon('plus') }}{{ _("New page") }}{% endif %} {% call doc_menu() %} {% if contribute %}
{{ csrf_field() }} {{ file_input("upload", "upload", required=true) }}
{% endif %} {% if index and contribute %}{{ _("Edit the folder home page") }}{% endif %} {% if not path %}{{ icon('gear', 14) }}{{ _("Space settings") }}{% endif %} {% endcall %}
{% endif %} {% endblock %} {% block content %} {% include "space-header.html" %}
{% if view == 'unsynced' %}
{{ icon('folder', 18) }}

{{ space.name }}

{% if space.description %}

{{ space.description }}

{% endif %}
{% if not space.repo_url %}

{{ _("No Git repository linked") }}

{{ _("The wiki shows the content/ folder of a Git repository: one must be linked first.") }} {{ _("Link a Git repository") if can(actor.access, Action.MANAGE_ORG, org_id=space.org_id) else _("See the repository status") }}

{% elif space.sync_status == 'error' %}

{{ _("Synchronization failed") }}

{{ _("The repository could not be fetched.") }} {{ _("See the error") }}

{% else %}

{{ _("First synchronization in progress") }}

{{ _("The repository content is on its way: reload the page in a moment.") }} {{ _("See the repository status") }}

{% endif %}
{% elif view == 'missing' %} {% set wanted = path.rsplit('/', 1) %} {% set gone, moved = removed or (none, '') %}
{{ icon('file', 18) }}

{{ _("This page was moved") if moved else _("This page was deleted") if gone else _("This page does not exist yet") }}

{{ path }}{% if gone %} · {{ gone.author.name }} · {% endif %}

{% if moved %}{{ icon('file') }}{{ _("Open it at its new address") }} {% elif gone %}{{ icon('refresh') }}{{ _("See its history to restore it") if contribute else _("See its history") }} {% elif contribute %}{{ icon('plus') }}{{ _("Create this page") }}{% endif %} {{ icon('search') }}{{ _("Search for “{name}”", name=wanted[-1].rsplit('.', 1)[0]) }}
{% elif view == 'folder' %} {% if not intro_title %}

{{ crumbs[-1][0] if path else space.name }}

{% endif %} {% if not path %} {% endif %} {% if intro %}
{{ intro }}
{% endif %} {% if folder.folders or folder.files %}
{% else %}

{{ _("This folder is empty.") }}

{% endif %} {% elif view == 'file' %} {% if not has_title %}

{{ title }}

{% endif %} {% if reports %}

{{ _(pl(reports|length, "Reported as outdated", "Reported as outdated by {n} people"), n=reports|length) }}{% if contribute %} · {{ _("Reread it, then “Mark as verified” (⋮ menu) closes the reports.") }}{% endif %}

{% if contribute %}
{{ csrf_field() }}
{% endif %}
{% endif %}
{% if file.kind == 'markdown' and rendered is not none %}
{{ rendered }}
{% elif html_page %} {% elif file.kind == 'text' and rendered is not none %}
{{ rendered }}
{% elif file.kind == 'image' %}
{{ file.name }}
{% elif file.kind == 'pdf' %} {# Phones show an empty frame (or only the first page): a link to the browser's reader. #}

{{ icon('file', 15) }}{{ _("Open the PDF") }}

{% else %}

{{ _("No preview for this file type.") }} {{ _("Download") }} ({{ file.size|filesize }})

{% endif %} {% if extracted %}
{{ _("Extracted text (used by search)") }}
{{ extracted }}
{% endif %} {% if backlinks %} {% endif %} {% if related_url %}{% endif %}
{% if toc %}
{{ _("Contents") }}
{% endif %}
{% elif view == 'history' %}
{{ icon('refresh', 18) }}

{{ _("History") }} · {{ crumbs[-1][0] }}

{% if current_sha %}{{ _("Back to the document") }}{% else %}{{ _("This file was deleted: restore one of its versions to bring it back.") }}{% endif %}

{% if error %}{% endif %} {% elif view == 'diff' %}
{{ icon('refresh', 18) }}

{% if current %}{{ _("Restoring version {sha}", sha=sha[:8]) }}{% else %}{{ _("Change", context="noun") }} {{ sha[:8] }}{% endif %}

{{ _("Back to history") }} · {% if current %}{{ _("See the change made by this version") }}{% else %}{{ _("Compare with the current version") }}{% endif %}

{% if contribute %}
{{ restore_form(sha) }}
{% endif %}
{% if current %}

{{ _("Removed lines: the current version; added lines: this version, as restoring would put it back.") }}

{% endif %}
{% for kind, line in diff_lines %}{{ line }}{% endfor %}
{% elif view == 'edit' %}
{{ icon('file', 18) }}

{{ _("Edit") }} · {{ file.name }}

{{ file.path }}

{% if error %}{% endif %} {% if conflict %}

{{ _("What changed since you opened the page") }}

{{ _("Removed lines: your version; added lines: the saved version. Copy what must be kept into your text, then choose.") }}

{% for kind, line in conflict.diff %}{{ line }}{% endfor %}
{% endif %}
{{ secret_confirm(error) }}
{% if conflict %} {{ _("Discard my version") }} {% else %} {{ _("Cancel") }} {% endif %}
{% elif view == 'new' %}
{{ icon('plus', 18) }}

{{ _("New page") }}

{% if folder %}

{{ folder }}/

{% endif %}
{% if error %}{% endif %}
{{ secret_confirm(error) }}
{% endif %}
{% endblock %}