Srophé Application : Documentation
Record View
Displaying your TEI records as HTML
Changing the HTML output is as simple as editing the existing XSLT stylesheets and CSS. Default stylesheets can be found in resources/xslt/tei2html.xslt
. Record views can use the default XSLT, XQuery or custom XSLT. Change the setting in the repo-config.xml if you would like to use something other then resources/xslt/tei2html.xslt
.
The HTML page
record.html is where your TEI data will be rendered.
You can display the full TEI:
<div data-template="app:display-nodes" data-template-paths="descendant::tei:TEI"/>
Or you can choose to 'chunk' your data, giving you the ability to move data around on the page.
<div data-template="app:display-nodes" data-template-paths="descendant::tei:placeName"/>
<div data-template="app:display-nodes" data-template-paths="descendant::tei:location"/>
Or you can customize your own display functions in app.xql
Sample custom function:
declare function app:h1($node as node(), $model as map(*)){
let $title := tei2html:tei2html($model("hits")/descendant::tei:titleStmt/tei:title[1])
let $author := tei2html:tei2html($model("hits")/descendant::tei:titleStmt/tei:author[not(@role='anonymous')])
return
<div class="title">
<h1>{$title}</h1>
</div>
};
Additional Options for Record HTML pages
Relationships
Internal Relationships are defined in the tei:relation
element of the current TEI record.
To add to HTML page as a sentence:
<div data-template="app:internal-relationships" data-template-display="sentence"/>
Sentence display will attempt to translate the relation element into an English sentence. Example:
<relation ref="syriaca:hasLiteraryConnectionToPlace" active="http://syriaca.org/person/13" passive="http://syriaca.org/place/502 http://syriaca.org/place/216 http://syriaca.org/place/1450 http://syriaca.org/place/1451" source="#bib13-2">
<desc xml:lang="en">This author has a literary connection to places.</desc>
</relation>
becomes:
Ephrem has literary connection to place Izmīd, Ḥarran, Kalkh, Hanzīṭ.
or using 'list-description' which lists each related record separately
<div data-template="app:internal-relationships" data-template-display="list-description"/>
becomes:
Ephrem
( Qadishe: A Guide to the Syriac Saints A Guide to Syriac Authors )
"Deacon, poet, and theologian."
URI: http://syriaca.org/person/13
Izmīd —
Ancient Nicomedia, a city in northwestern Anatolia .
URI: http://syriaca.org/place/502
Ḥarran —
"Syr./Hebrew Ḥārān; Latin Carrhae; Arabic Ḥarran. Ancient city in Mesopotamia, approximately 45 km south-southeast of Edessa."
URI: http://syriaca.org/place/216
External Relationships - Find any relationships mentioning current URI
Add to HTML page:
<div data-template="app:external-relationships"/>
To change or update functions you will need to edit:
module/lib/get-related.xqm
D3js visualizations - plug relationships into the d3js visualizations module
Add to HTML page: Forth coming
Maps - for the current record
Add to HTML page:
<div data-template="app:display-map"/>
Serialization options
Output options can be specified in the HTML page using the app:other-data-formats() function.
Example:
<div data-template="app:other-data-formats" data-template-formats="print,tei,rdf,text"/>
Options will be displayed in order listed in the above function. Currently available formats:
- print - sends page to printer, uses print.css for styles.
- tei - Print TEI to screen
- rdf - RDF XML
- ttl - Turtle triples
- text - Plain text of record
- json - JSON-LD for record
- geojson - geoJSON data if there is location information in record
- kml - KML for data if there is location information in record
See Content Negotiation Module for more information on formats and for help adding additional formats.
Contact forms
You can add a popup contact form to your record page (or any other page). Add to HTML page:
<button class="btn btn-default" data-toggle="modal" data-target="#feedback">Corrections/Additions?</button>
<div data-template="app:contact-form" data-template-collection="places"/>
Configurable options
Configurable options for the email module should be stored in /access-config.xml
This file should not be stored in GitHub, save it on your computer and upload it to eXist-db after deploying the application.
Example email configuration:
<config>
<email>
<smtp>SMTP server</smtp>
<contact listID="places">
<to>email@org.org</to>
<cc>email@org.org</cc>
</contact>
<contact listID="sbd">
<to>email1@org.org</to>
<to>email2@org.org</to>
<cc>email3@org.org</cc>
</contact>
<!--Default contact -->
<contact>
<to>email@org.org</to>
</contact>
</email>
<!-- Configuration for recaptcha options -->
<recaptcha>
<!-- recpatcha secret key can be stored here or as a environment variable. (prefered) -->
<recaptcha-site-key></recaptcha-site-key>
<recaptcha-secret-key></recaptcha-secret-key>
<recaptcha-secret-key-variable></recaptcha-secret-key-variable>
</recaptcha>
</config>
- email SMTP server: Set SMTP server, if left blank eXist-db will use localhost.
- email groups: You can set groups by collection id, the listID must match a collection id in your repo-config.xml file.
- reCaptcha
- Set your recaptcha-secret-key in the file or as a environment variable.
- Include recaptcha-site-key