Arethusa for Nemo Plugin¶
Arethusa for CapiTainS Nemo¶
This repository contains a plugin for embedding Arethusa in Flask Capitains Nemo. It was produced during the Perseids Tufts Hackathon in May 2016.
The version of the Arethusa code which is used here can be found at https://github.com/alpheios-project/arethusa/tree/nemo_arethusa_widget It is currently using commit 924f384.
Contributors¶
- Bridget Almas ( @balmas )
- Frederik Baumgardt ( @fbaumgardt )
- Thibault Clérice ( @ponteineptique )
- Elijah Cooke ( @elijahjcooke )
Index :
Arethusa for Nemo API¶
-
class
nemo_arethusa_plugin.
Arethusa
(queryinterface, *args, **kwargs)[source]¶ Arethusa plugin for Nemo
Note
This class inherits some routes from the base AnnotationsApiPlugin
Parameters: queryinterface (flask_nemo.query.proto.QueryPrototype) – QueryInterface to use to retrieve annotations
Variables: - interface – QueryInterface used to retrieve annotations
- HAS_AUGMENT_RENDER – (True) Adds a stack of render
The overall plugins contains three new routes (on top of AnnotationsAPIPlugin) :
/arethusa.deps.json
which feeds informations about Arethusa assets dependencies/arethusa-assets/<filename>
which is a self implemented assets route./arethusa.config.json
which is the config for the widget
It contains two new templates :
- a
arethusa::text.html
template which overrides the original when there is treebank available - a
arethusa::widget.tree.json
template which providees the configuration for the widget
It contains a render functions which will use the arethusa::text.html instead of main::text.html if there is a treebank found within the QueryInterface
-
Arethusa.
render
(**kwargs)[source]¶ Render function stack.
If the template called is the main::text.html, it checks annotations from its query interface and replace it by arethusa::text.html if there is a treebank annotation
Parameters: kwargs – Dictionary of named arguments Returns: Dictionary of named arguments
-
Arethusa.
r_arethusa_assets
(filename)[source]¶ Routes for assets
Parameters: filename – Filename in data/assets to retrievee Returns: Content of the file
Text Template and It’s Macro¶
The arethusa::text.html
contains few macro to ensure reusability of the concept by other resources :
tb_macro()¶
Contains the container for the Arethusa Widget
tabs(text, treebank)¶
Creates a Bootstrap tab interface where the first tab is the text, the second would be the treebank
Blocks and extensions¶
- The template extends main::container.html and feeds blocks additinalscript and article.
- It imports from
main::text.html
:show_passage
,header_passage
,default_footer
, andnav