Rename XanaDoc to XanaPage.
This commit is contained in:
parent
28a85e8cd5
commit
d7f51b0982
|
@ -60,19 +60,19 @@ def populate_references():
|
||||||
database.session.add(ref)
|
database.session.add(ref)
|
||||||
seen.add(as_tuple)
|
seen.add(as_tuple)
|
||||||
|
|
||||||
for xanadoc in model.XanaDoc.query:
|
for xanapage in model.XanaPage.query:
|
||||||
doc_edl = edl.parse_edl(xanadoc.text)
|
doc_edl = edl.parse_edl(xanapage.text)
|
||||||
if 'spans' not in doc_edl or not doc_edl['spans']:
|
if 'spans' not in doc_edl or not doc_edl['spans']:
|
||||||
continue
|
continue
|
||||||
for url, start, length in doc_edl['spans']:
|
for url, start, length in doc_edl['spans']:
|
||||||
src_doc = model.Item.from_external(url, home=home)
|
src_doc = model.Item.from_external(url, home=home)
|
||||||
if not src_doc.id:
|
if not src_doc.id:
|
||||||
continue
|
continue
|
||||||
print(xanadoc.id, '->', src_doc.id)
|
print(xanapage.id, '->', src_doc.id)
|
||||||
as_tuple = (xanadoc.id, src_doc.id)
|
as_tuple = (xanapage.id, src_doc.id)
|
||||||
if as_tuple in seen:
|
if as_tuple in seen:
|
||||||
continue
|
continue
|
||||||
ref = model.Reference(subject_id=xanadoc.id, object_id=src_doc.id)
|
ref = model.Reference(subject_id=xanapage.id, object_id=src_doc.id)
|
||||||
database.session.add(ref)
|
database.session.add(ref)
|
||||||
seen.add(as_tuple)
|
seen.add(as_tuple)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from .url import get_url, get_text
|
from .url import get_url, get_text
|
||||||
from .parse import get_span, parse_span, parse_link, parse_sourcedoc_facet, xanadoc_span_html, span_html, get_urls
|
from .parse import get_span, parse_span, parse_link, parse_sourcedoc_facet, xanapage_span_html, span_html, get_urls
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from html import escape
|
from html import escape
|
||||||
from .utils import protect_start_spaces
|
from .utils import protect_start_spaces
|
||||||
|
@ -100,14 +100,14 @@ def fulfil_edl_with_links(edl, doc_num='', links=None, hide_all_transclusions=Fa
|
||||||
break
|
break
|
||||||
if link_end < start:
|
if link_end < start:
|
||||||
continue
|
continue
|
||||||
cls = 'xanadoclink link'
|
cls = 'xanapagelink link'
|
||||||
link_span = (f'<span class="{cls}" id="link{facet_num}_{link_num}">' +
|
link_span = (f'<span class="{cls}" id="link{facet_num}_{link_num}">' +
|
||||||
escape(span_text[link_start:link_end]) +
|
escape(span_text[link_start:link_end]) +
|
||||||
'</span>')
|
'</span>')
|
||||||
new_text += escape(span_text[pos:link_start]) + link_span
|
new_text += escape(span_text[pos:link_start]) + link_span
|
||||||
pos = link_end
|
pos = link_end
|
||||||
new_text += escape(span_text[pos:start + length])
|
new_text += escape(span_text[pos:start + length])
|
||||||
cur = xanadoc_span_html(num, new_text, url, start, length, highlight=highlight)
|
cur = xanapage_span_html(num, new_text, url, start, length, highlight=highlight)
|
||||||
doc_spans.append(cur)
|
doc_spans.append(cur)
|
||||||
|
|
||||||
doc = ''.join(doc_spans)
|
doc = ''.join(doc_spans)
|
||||||
|
|
|
@ -141,7 +141,7 @@ class Item(TimeStampedModel):
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
user_id = Column(Integer, ForeignKey('user.id'))
|
user_id = Column(Integer, ForeignKey('user.id'))
|
||||||
published = Column(DateTime)
|
published = Column(DateTime)
|
||||||
type = Column(Enum('sourcedoc', 'xanadoc', 'xanalink', name='item_type'),
|
type = Column(Enum('sourcedoc', 'xanapage', 'xanalink', name='item_type'),
|
||||||
nullable=False)
|
nullable=False)
|
||||||
filename = Column(Unicode)
|
filename = Column(Unicode)
|
||||||
text = Column(UnicodeText)
|
text = Column(UnicodeText)
|
||||||
|
@ -262,9 +262,9 @@ span: {},start=0,length={}'''.format(self.external_url, title_source_doc.externa
|
||||||
q = cls.query.filter(User.username == username, cls.id == item_id)
|
q = cls.query.filter(User.username == username, cls.id == item_id)
|
||||||
return q.one_or_none()
|
return q.one_or_none()
|
||||||
|
|
||||||
class XanaDoc(Item):
|
class XanaPage(Item):
|
||||||
__tablename__ = 'xanadoc'
|
__tablename__ = 'xanapage'
|
||||||
__mapper_args__ = {'polymorphic_identity': 'xanadoc'}
|
__mapper_args__ = {'polymorphic_identity': 'xanapage'}
|
||||||
|
|
||||||
id = Column(Integer, ForeignKey(Item.id), primary_key=True)
|
id = Column(Integer, ForeignKey(Item.id), primary_key=True)
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,10 @@ def find_min_max(spans, source):
|
||||||
def span_html(span_type, num):
|
def span_html(span_type, num):
|
||||||
return '<span class="{span_type} sourcedoc{span_type}" id="{span_type}{num}">'.format(num=num, span_type=span_type)
|
return '<span class="{span_type} sourcedoc{span_type}" id="{span_type}{num}">'.format(num=num, span_type=span_type)
|
||||||
|
|
||||||
def xanadoc_span_html(num, text, url, start, length, highlight=True, censor=False):
|
def xanapage_span_html(num, text, url, start, length, highlight=True, censor=False):
|
||||||
cls = []
|
cls = []
|
||||||
if highlight:
|
if highlight:
|
||||||
cls = ['xanadoctransclusion', 'transclusion']
|
cls = ['xanapagetransclusion', 'transclusion']
|
||||||
html_class = ' class="{}"'.format(' '.join(cls)) if cls else ''
|
html_class = ' class="{}"'.format(' '.join(cls)) if cls else ''
|
||||||
|
|
||||||
html = '<span id="span{}"{} data-url="{}" data-start="{}" data-length="{}">{}</span>'.format(num, html_class, escape(url), start, length, text)
|
html = '<span id="span{}"{} data-url="{}" data-start="{}" data-length="{}">{}</span>'.format(num, html_class, escape(url), start, length, text)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
background-color: #ffe;
|
background-color: #ffe;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xanadoc {
|
.xanapage {
|
||||||
background-color: #eef;
|
background-color: #eef;
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ function new_document(doc) {
|
||||||
var w = document.documentElement.clientWidth;
|
var w = document.documentElement.clientWidth;
|
||||||
var h = document.documentElement.clientHeight;
|
var h = document.documentElement.clientHeight;
|
||||||
|
|
||||||
if (doc.doctype == 'xanadoc') {
|
if (doc.doctype == 'xanapage') {
|
||||||
var x = (w / 2) - 400;
|
var x = (w / 2) - 400;
|
||||||
var y = (h / 2) - 400;
|
var y = (h / 2) - 400;
|
||||||
} else {
|
} else {
|
||||||
|
@ -316,9 +316,9 @@ function fulfil() {
|
||||||
new_document(doc);
|
new_document(doc);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
new_document({'heading': 'xanadoc',
|
new_document({'heading': 'xanapage',
|
||||||
'text': doc.doc,
|
'text': doc.doc,
|
||||||
'doctype': 'xanadoc'});
|
'doctype': 'xanapage'});
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ function fulfil() {
|
||||||
hover_link_bridge(this, false);
|
hover_link_bridge(this, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.xanadoclink').click(function(e) {
|
$('.xanapagelink').click(function(e) {
|
||||||
var num = get_end_number(this.id);
|
var num = get_end_number(this.id);
|
||||||
var source = $('#link' + num).closest( ".sourcedoc" );
|
var source = $('#link' + num).closest( ".sourcedoc" );
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ function fulfil() {
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.xanadoctransclusion').click(function(e) {
|
$('.xanapagetransclusion').click(function(e) {
|
||||||
var num = get_end_number(this.id);
|
var num = get_end_number(this.id);
|
||||||
var source = $('#transclusion' + num).closest( ".sourcedoc" );
|
var source = $('#transclusion' + num).closest( ".sourcedoc" );
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ function new_document(doc) {
|
||||||
var w = document.documentElement.clientWidth;
|
var w = document.documentElement.clientWidth;
|
||||||
var h = document.documentElement.clientHeight;
|
var h = document.documentElement.clientHeight;
|
||||||
|
|
||||||
if (doc.doctype == 'xanadoc') {
|
if (doc.doctype == 'xanapage') {
|
||||||
element.css('height', (h - 100) + 'px');
|
element.css('height', (h - 100) + 'px');
|
||||||
|
|
||||||
var ratio = (doc.index + 1) / (doc.doc_count + 1)
|
var ratio = (doc.index + 1) / (doc.doc_count + 1)
|
||||||
|
@ -285,7 +285,7 @@ function fulfil(doc, index, doc_count, heading) {
|
||||||
|
|
||||||
new_document({'heading': heading,
|
new_document({'heading': heading,
|
||||||
'text': doc.doc,
|
'text': doc.doc,
|
||||||
'doctype': 'xanadoc',
|
'doctype': 'xanapage',
|
||||||
'index': index,
|
'index': index,
|
||||||
'doc_count': doc_count});
|
'doc_count': doc_count});
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ function size_svg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_handlers() {
|
function add_handlers() {
|
||||||
$('.xanadoclink').click(function(e) {
|
$('.xanapagelink').click(function(e) {
|
||||||
var num = get_end_number(this.id);
|
var num = get_end_number(this.id);
|
||||||
|
|
||||||
var bridge = document.getElementById('linkbridge' + num);
|
var bridge = document.getElementById('linkbridge' + num);
|
||||||
|
@ -311,11 +311,11 @@ function add_handlers() {
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.xanadoclink').bind('mouseover', function(e) {
|
$('.xanapagelink').bind('mouseover', function(e) {
|
||||||
hover_link_bridge(this, true);
|
hover_link_bridge(this, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.xanadoclink').bind('mouseout', function(e) {
|
$('.xanapagelink').bind('mouseout', function(e) {
|
||||||
hover_link_bridge(this, false);
|
hover_link_bridge(this, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ doc.url }}">View</a>
|
<a class="nav-link" href="{{ doc.url }}">View</a>
|
||||||
</li>
|
</li>
|
||||||
{% if doc.type == 'xanadoc' %}
|
{% if doc.type == 'xanapage' %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ doc.url }}/fulfil">Fulfil</a>
|
<a class="nav-link" href="{{ doc.url }}/fulfil">Fulfil</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ doc.url }}">View</a>
|
<a class="nav-link" href="{{ doc.url }}">View</a>
|
||||||
</li>
|
</li>
|
||||||
{% if doc.type == 'xanadoc' %}
|
{% if doc.type == 'xanapage' %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ doc.url }}/fulfil">Fulfil</a>
|
<a class="nav-link" href="{{ doc.url }}/fulfil">Fulfil</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ url_for('.new_sourcedoc') }}" class="btn btn-primary">new source document</a>
|
<a href="{{ url_for('.new_sourcedoc') }}" class="btn btn-primary">new source document</a>
|
||||||
<a href="{{ url_for('.new_xanalink') }}" class="btn btn-primary">new xanalink</a>
|
<a href="{{ url_for('.new_xanalink') }}" class="btn btn-primary">new xanalink</a>
|
||||||
<a href="{{ url_for('.new_xanadoc') }}" class="btn btn-primary">new xanadoc</a>
|
<a href="{{ url_for('.new_xanapage') }}" class="btn btn-primary">new xanapage</a>
|
||||||
</p>
|
</p>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<form>
|
<form>
|
||||||
<h5>item type</h5>
|
<h5>item type</h5>
|
||||||
{% for item_type in 'xanadoc', 'xanalink', 'sourcedoc' %}
|
{% for item_type in 'xanapage', 'xanalink', 'sourcedoc' %}
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input facet_type" type="checkbox" checked="checked" id="type_{{ item_type }}">
|
<input class="form-check-input facet_type" type="checkbox" checked="checked" id="type_{{ item_type }}">
|
||||||
<label class="form-check-label" for="type_{{ item_type }}"> {{ item_type }}</label>
|
<label class="form-check-label" for="type_{{ item_type }}"> {{ item_type }}</label>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ doc.url }}">View</a>
|
<a class="nav-link" href="{{ doc.url }}">View</a>
|
||||||
</li>
|
</li>
|
||||||
{% if doc.type == 'xanadoc' %}
|
{% if doc.type == 'xanapage' %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ doc.url }}/fulfil">In view</a>
|
<a class="nav-link" href="{{ doc.url }}/fulfil">In view</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" href="{{ doc.url }}">View</a>
|
<a class="nav-link active" href="{{ doc.url }}">View</a>
|
||||||
</li>
|
</li>
|
||||||
{% if doc.type == 'xanadoc' %}
|
{% if doc.type == 'xanapage' %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ doc.url }}/fulfil">In view</a>
|
<a class="nav-link" href="{{ doc.url }}/fulfil">In view</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8" id="main">
|
<div class="col-md-8" id="main">
|
||||||
|
|
||||||
{% if doc.type == 'xanadoc' %}
|
{% if doc.type == 'xanapage' %}
|
||||||
<h4>Edit Decision List (EDL)</h4>
|
<h4>Edit Decision List (EDL)</h4>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="card" id="text">
|
<div class="card" id="text">
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
{%- for start, line in iter_lines(text) if line != '\r\n' -%}
|
{%- for start, line in iter_lines(text) if line != '\r\n' -%}
|
||||||
{# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %} {% endif
|
{# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %} {% endif
|
||||||
%}</p>#}
|
%}</p>#}
|
||||||
<p class="card-text{% if doc.type != 'xanadoc' or line.startswith('-') %} margin-bottom-zero{% endif %}" data-start="{{ start }}">{{ nbsp_at_start(line) }}</p>
|
<p class="card-text{% if doc.type != 'xanapage' or line.startswith('-') %} margin-bottom-zero{% endif %}" data-start="{{ start }}">{{ nbsp_at_start(line) }}</p>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
<p id="span-selector" class="d-none">span: <span id="span"></span></p>
|
<p id="span-selector" class="d-none">span: <span id="span"></span></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if doc.type == 'xanadoc' %}
|
{% if doc.type == 'xanapage' %}
|
||||||
|
|
||||||
<p class="my-3">
|
<p class="my-3">
|
||||||
<a class="btn btn-primary" href="{{ doc.edit_url }}" role="button">Edit EDL</a>
|
<a class="btn btn-primary" href="{{ doc.edit_url }}" role="button">Edit EDL</a>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<title>{{ title | default("Xanadu") }}</title>
|
<title>{{ title | default("Xanadu") }}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap4/css/bootstrap.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap4/css/bootstrap.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/xanadoc.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/xanapage.css') }}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<title>{{ title | default("Xanadu") }}</title>
|
<title>{{ title | default("Xanadu") }}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap4/css/bootstrap.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap4/css/bootstrap.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/xanadoc.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/xanapage.css') }}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<h1 class="mt-3">{{ doc.title() }}</h1>
|
<h1 class="mt-3">{{ doc.title() }}</h1>
|
||||||
|
|
||||||
<p><a href="{{ doc.url }}">view xanadoc (cancel edit)</a></p>
|
<p><a href="{{ doc.url }}">view xanapage (cancel edit)</a></p>
|
||||||
|
|
||||||
<form method="POST" action="{{ doc.view_url('finish_xanaedit') }}">
|
<form method="POST" action="{{ doc.view_url('finish_xanaedit') }}">
|
||||||
<input type="hidden" name="edits" id="edits" value=""/>
|
<input type="hidden" name="edits" id="edits" value=""/>
|
||||||
|
|
|
@ -5,7 +5,7 @@ from flask_login import (login_user, current_user, logout_user,
|
||||||
from .forms import (LoginForm, SignupForm, AccountSettingsForm,
|
from .forms import (LoginForm, SignupForm, AccountSettingsForm,
|
||||||
UploadSourceDocForm, SourceDocForm, ItemForm,
|
UploadSourceDocForm, SourceDocForm, ItemForm,
|
||||||
ForgotPasswordForm, PasswordForm)
|
ForgotPasswordForm, PasswordForm)
|
||||||
from .model import User, SourceDoc, Item, XanaDoc, XanaLink, Reference
|
from .model import User, SourceDoc, Item, XanaPage, XanaLink, Reference
|
||||||
from .parse import parse_xanapage_facet, parse_link
|
from .parse import parse_xanapage_facet, parse_link
|
||||||
from .url import get_url
|
from .url import get_url
|
||||||
from .mail import send_mail
|
from .mail import send_mail
|
||||||
|
@ -199,11 +199,11 @@ def get_source_doc(username, hashid):
|
||||||
doc = None
|
doc = None
|
||||||
return doc if doc else abort(404)
|
return doc if doc else abort(404)
|
||||||
|
|
||||||
def get_xanadoc(username, hashid):
|
def get_xanapage(username, hashid):
|
||||||
doc = Item.get_by_hashid(hashid)
|
doc = Item.get_by_hashid(hashid)
|
||||||
if doc and doc.user.username != username:
|
if doc and doc.user.username != username:
|
||||||
doc = None
|
doc = None
|
||||||
return doc if doc and doc.type == 'xanadoc' else abort(404)
|
return doc if doc and doc.type == 'xanapage' else abort(404)
|
||||||
|
|
||||||
def get_item(username, hashid):
|
def get_item(username, hashid):
|
||||||
doc = Item.get_by_hashid(hashid)
|
doc = Item.get_by_hashid(hashid)
|
||||||
|
@ -213,7 +213,7 @@ def get_item(username, hashid):
|
||||||
|
|
||||||
@bp.route('/<username>/<hashid>/edl')
|
@bp.route('/<username>/<hashid>/edl')
|
||||||
def view_edl(username, hashid):
|
def view_edl(username, hashid):
|
||||||
item = get_xanadoc(username, hashid)
|
item = get_xanapage(username, hashid)
|
||||||
|
|
||||||
return render_template('view.html',
|
return render_template('view.html',
|
||||||
doc=item,
|
doc=item,
|
||||||
|
@ -222,7 +222,7 @@ def view_edl(username, hashid):
|
||||||
|
|
||||||
@bp.route('/<username>/<hashid>/realize')
|
@bp.route('/<username>/<hashid>/realize')
|
||||||
def realize_edl(username, hashid):
|
def realize_edl(username, hashid):
|
||||||
item = get_xanadoc(username, hashid)
|
item = get_xanapage(username, hashid)
|
||||||
|
|
||||||
spans = list(fulfil_edl(item.text))
|
spans = list(fulfil_edl(item.text))
|
||||||
doc_text = ''.join(span['text'] for span in spans)
|
doc_text = ''.join(span['text'] for span in spans)
|
||||||
|
@ -246,7 +246,7 @@ def fulfil_xanaflight(item):
|
||||||
all_links = []
|
all_links = []
|
||||||
for facet in facets:
|
for facet in facets:
|
||||||
xanapage = Item.from_external(parse_xanapage_facet(facet))
|
xanapage = Item.from_external(parse_xanapage_facet(facet))
|
||||||
assert xanapage.type == 'xanadoc'
|
assert xanapage.type == 'xanapage'
|
||||||
edl = parse_edl(xanapage.text)
|
edl = parse_edl(xanapage.text)
|
||||||
edl_list.append((xanapage, edl))
|
edl_list.append((xanapage, edl))
|
||||||
all_links += [parse_link(link['text']) for link in edl['links']]
|
all_links += [parse_link(link['text']) for link in edl['links']]
|
||||||
|
@ -268,8 +268,8 @@ def fulfil_xanaflight(item):
|
||||||
def fulfil(username, hashid):
|
def fulfil(username, hashid):
|
||||||
item = get_item(username, hashid)
|
item = get_item(username, hashid)
|
||||||
|
|
||||||
if item.type == 'xanadoc':
|
if item.type == 'xanapage':
|
||||||
return render_template('view/xanadoc.html',
|
return render_template('view/xanapage.html',
|
||||||
item=item,
|
item=item,
|
||||||
doc=fulfil_edl_with_sources(item.text))
|
doc=fulfil_edl_with_sources(item.text))
|
||||||
if item.type == 'xanalink' and item.text.startswith('type=flight'):
|
if item.type == 'xanalink' and item.text.startswith('type=flight'):
|
||||||
|
@ -379,7 +379,7 @@ def view_item(username, hashid, raw=False):
|
||||||
version = None
|
version = None
|
||||||
text = item.text
|
text = item.text
|
||||||
|
|
||||||
if item.type == 'xanadoc':
|
if item.type == 'xanapage':
|
||||||
spans = list(fulfil_edl(item.text))
|
spans = list(fulfil_edl(item.text))
|
||||||
doc_text = ''.join(span['text'] for span in spans)
|
doc_text = ''.join(span['text'] for span in spans)
|
||||||
else:
|
else:
|
||||||
|
@ -403,7 +403,7 @@ def history(username, hashid):
|
||||||
|
|
||||||
@bp.route('/<username>/<hashid>/xanaedit')
|
@bp.route('/<username>/<hashid>/xanaedit')
|
||||||
def xanaedit_item(username, hashid):
|
def xanaedit_item(username, hashid):
|
||||||
doc = get_xanadoc(username, hashid)
|
doc = get_xanapage(username, hashid)
|
||||||
|
|
||||||
spans = list(fulfil_edl(doc.text))
|
spans = list(fulfil_edl(doc.text))
|
||||||
doc_text = ''.join(span['text'] for span in spans)
|
doc_text = ''.join(span['text'] for span in spans)
|
||||||
|
@ -412,13 +412,13 @@ def xanaedit_item(username, hashid):
|
||||||
|
|
||||||
@bp.route('/<username>/<hashid>/xanaedit', methods=['POST'])
|
@bp.route('/<username>/<hashid>/xanaedit', methods=['POST'])
|
||||||
def save_xanaedit(username, hashid):
|
def save_xanaedit(username, hashid):
|
||||||
# doc = get_xanadoc(username, hashid)
|
# doc = get_xanapage(username, hashid)
|
||||||
edits = json.loads(request.form['edits'])
|
edits = json.loads(request.form['edits'])
|
||||||
return jsonify(edits=edits)
|
return jsonify(edits=edits)
|
||||||
|
|
||||||
@bp.route('/<username>/<hashid>/finish', methods=['POST'])
|
@bp.route('/<username>/<hashid>/finish', methods=['POST'])
|
||||||
def finish_xanaedit(username, hashid):
|
def finish_xanaedit(username, hashid):
|
||||||
doc = get_xanadoc(username, hashid)
|
doc = get_xanapage(username, hashid)
|
||||||
current_edl = parse_edl(doc.text)
|
current_edl = parse_edl(doc.text)
|
||||||
|
|
||||||
spans = [Span(*span) for span in current_edl['spans']]
|
spans = [Span(*span) for span in current_edl['spans']]
|
||||||
|
@ -505,18 +505,18 @@ def new_xanalink():
|
||||||
flash('New xanalink saved.')
|
flash('New xanalink saved.')
|
||||||
return jsonify(url=obj.url)
|
return jsonify(url=obj.url)
|
||||||
|
|
||||||
@bp.route('/new/xanadoc', methods=['GET', 'POST'])
|
@bp.route('/new/xanapage', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def new_xanadoc():
|
def new_xanapage():
|
||||||
form = ItemForm()
|
form = ItemForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
obj = XanaDoc(user=current_user)
|
obj = XanaPage(user=current_user)
|
||||||
form.populate_obj(obj)
|
form.populate_obj(obj)
|
||||||
session.add(obj)
|
session.add(obj)
|
||||||
session.commit()
|
session.commit()
|
||||||
flash('New xanadoc saved.')
|
flash('New xanapage saved.')
|
||||||
return redirect(obj.url)
|
return redirect(obj.url)
|
||||||
return render_template('new.html', form=form, item_type='xanadoc')
|
return render_template('new.html', form=form, item_type='xanapage')
|
||||||
|
|
||||||
@bp.route('/edit/<filename>', methods=['GET', 'POST'])
|
@bp.route('/edit/<filename>', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue