sourcing/sourcing/templates/view.html

55 lines
1.6 KiB
HTML

{% set title = doc.title() %}
{% include "head.html" %}
<style>
div#text { font-family: Courier; }
</style>
<div class="row">
<div class="col-xs-12">
<h1>{{ title }}
{% if doc.user == current_user %}
<a href="{{ doc.edit_url }}" class="btn btn-default">edit</a>
{% endif %}
{% if doc.type == 'xanadoc' %}
<a href="{{ doc.url }}" class="btn btn-default">fulfil</a>
{% endif %}
</h1>
<p><a href="{{ url_for('.home') }}">back to index</a></p>
<div class="well" id="text">
{% if span_start and span_length %}
{%- for start, line in add_highlight(doc.text, span_start, span_length) if line -%}
<p data-start="{{ start }}">
{% for i in line %}
{%- if i.highlight -%}
<span class="highlight">{{- i.highlight -}}</span>
{%- else -%}
{{- i.text -}}
{%- endif -%}
{% endfor %}
</p>
{%- endfor -%}
{% else %}
{%- for start, line in iter_lines(doc.text) if line -%}
<p data-start="{{ start }}">{{ line }}</p>
{%- endfor -%}
{% endif %}
</div>
{% if doc.type == 'sourcedoc' and not (span_start and span_length) %}
<a href="#" id="show-span-selector" class="btn btn-default">show span selector</a>
<p id="span-selector" class="hidden">span: <span id="span"></span></p>
{% endif %}
</div>
</div>
{% set scripts %}
<script>
var doc_url = '{{ doc.external_url }}';
</script>
<script src="{{ url_for('static', filename='js/sourcedoc.js') }}"></script>
{% endset %}
{% include "foot.html" %}