-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnemo.py
54 lines (52 loc) · 2 KB
/
nemo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# We import Flask
from flask import Flask
# We import Nemo
from flask.ext.nemo import Nemo
# We create an application. You can simply use your own
app = Flask(
__name__
)
# We register a Nemo object with the minimal settings
nemo = Nemo(
# API URL is the URL of your endpoint.
api_url="http://services2.perseids.org/exist/restxq/cts",
# We set up the base url to be empty. If you want nemo to be on a
# subpath called "cts", you would have
# base_url="cts",
base_url="",
name="nemo",
# In our case, we have an inventory named "nemo"
inventory="nemo",
css=[
# USE Own CSS Files
"static/tei.pb.min.css",
"static/ciham.css"
],
js=[
# use own js file to load a script to go from normalized edition to diplomatic one.
"static/ciham.js"
],
transform={
"urn:cts:froLit:jns915.jns1856.ciham-fro1" : "static/ciham.xslt"
},
# We give thee ap object
#app=app
chunker={
# The default chunker takes care of book, poem, lines
# but it would be cool to have 30 lines group for Nemo
"urn:cts:latinLit:phi0959.phi005.perseus-lat2": lambda version, callback: Nemo.line_chunker(version, callback, lines=30),
"urn:cts:froLit:jns915.jns1856.ciham-fro1": lambda text, getLevel: [(reff.split(":")[-1], reff.split(":")[-1]) for reff in getLevel(1)],
"urn:cts:latinLit:phi0472.phi001.perseus-lat2": lambda text, getLevel: [(reff.split(":")[-1], reff.split(":")[-1]) for reff in getLevel(1)],
"urn:cts:latinLit:phi1212.phi002.perseus-lat1": lambda version, callback: Nemo.line_chunker(version, callback, lines=5), #Apuleius, Metamorphoses, 5 sections at a time
"default": Nemo.level_grouper # lambda text, cb: Nemo.line_grouper(text, cb, 50),
},
templates = {
"passage_footer": "templates/passage_footer.html"
}
)
nemo.init_app(app)
# We register its routes
nemo.register_routes()
# We register its filters
nemo.register_filters()
app.debug = True