Commit af33d43f authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

fix xqDoc style

parent 7ac172a0
......@@ -24,10 +24,10 @@ declare variable $index:dataPath := "/db/sade-projects/textgrid/data/xml/data";
(:~
: resolves and lists all references on a given page based on their index data
:
: @param $uri A valid TextGrid Base-URI without prefix
: @param $surface – a string to match a tei:surface/@n in the document
: @param $uri A valid TextGrid Base-URI without prefix
: @param $surface A string to match a tei:surface/@n in the document
: (use “-” as delimiter)
: @return a list with all entries
: @return xhtml list with all entries
: @see http://localhost:8080/exist/restxq/fontane/index/16b00/62v
: @see https://fontane-nb.dariah.eu/api/index/16b00/62v
: :)
......@@ -38,7 +38,9 @@ declare
%test:name("entities per page")
%test:args("16b00", "2v") (: return empty sequence on interleaf :)
%test:arg("uri", "16b00")
%test:arg("surface", "2v")
(: return empty sequence on interleaf :)
%test:assertEmpty
%test:args("", "") (: return custom error INDEX-API1 :)
......@@ -201,6 +203,9 @@ declare
%rest:GET
%rest:path("/api/index/entity/{$id}")
%output:method("html")
%test:arg("id", "Storm")
%test:assertTrue
function index:rendered-entity($id as xs:string)
as item()* {
let $node := collection($index:dataPath)/id($id)
......@@ -227,7 +232,11 @@ as item()* {
};
(:~ Provides a simple API for searching the index entries. Used for autocompletion.
: Usually the query should be a simple string. No wildcards, nothing special. :)
: Usually the query should be a simple string. No wildcards, nothing special,
: always case-insensitive.
: @param $query A string to search all index entries (names, label, etc.)
: @return $index A list of indices to query, defaults to all, oneOf: listEvent,listOrg,listPerson,listPlace,list-works,list-fontane,list-periodicals.
:)
declare
%rest:GET
%rest:path("/api/index/search/{$query}")
......@@ -235,7 +244,7 @@ declare
%output:method("json")
%test:name("simple search")
%test:args("Dom Karlos")
%test:arg("query", "Dom Karlos")
%test:assertXPath("array:size($result) = 2")
function index:search($query as xs:string, $index)
......
......@@ -59,7 +59,7 @@ return
(:~
: the list type an entity is listed in.
: This is used when preparing the html resource name.
: @param $entity – on of tei:item, tei:place, tei:person, tei:gersonGrp,
: @param $entity On of tei:item, tei:place, tei:person, tei:gersonGrp,
: tei:event or tei:org
: @return on of listEvent, listOrg, listPlace, listPerson, list-works,
: list-Fontane, list-periodicals
......@@ -182,8 +182,8 @@ return
(:~
: helper function to get the tgmd:title by URI
: @param $uri the textgrid-URI without prefix
: TODO: may this function should be placed in a generic module
: @param $uri The textgrid-URI without prefix
: @TODO may this function should be placed in a generic module
: :)
declare function ixp:resolve-name($uri as xs:string)
as xs:string {
......@@ -196,8 +196,8 @@ as xs:string {
(:~
: tests for a given ID to appear in all @xml:id in a given node
: @param $id the id to search for
: @param $node the document or xml fragment
: @param $id The id to search for
: @param $node The document or xml fragment
: :)
declare function ixp:check-active($id as xs:string, $node as element(*)+)
as xs:boolean {
......@@ -206,7 +206,7 @@ as xs:boolean {
(:~
: checks if a target entity is in the current node set
: @param $node – any node set
: @param $node Any node set
: :)
declare function ixp:check-entity($node as node()+)
as xs:string? {
......@@ -217,7 +217,7 @@ as xs:string? {
(:~
: creates a generic xhtml:class attribute mandatory for every entry
: @param $id ID to check for
: @param $id ID to check for
: :)
declare function ixp:entry-class($id as attribute(xml:id))
as attribute(class)? {
......@@ -229,7 +229,7 @@ as attribute(class)? {
(:~
: creates a list for label or name
: @param $variant – a tei element containing any secondary label or name variant
: @param $variant A tei element containing any secondary label or name variant
:)
declare function ixp:variant($variant as element()*)
as element(xhtml:li)? {
......@@ -249,8 +249,8 @@ if(not(exists($variant))) then () else
(:~
: transforms tei:idno to xhtml:li
: @param $idnos – tei element (idno and label) with reference to authority file
: TODO: declare element(tei:idno), currently wrong encoding with tei:label
: @param $idnos TEI element (idno and label) with reference to authority file
: @TODO Declare element(tei:idno), currently wrong encoding with tei:label
: :)
declare function ixp:idno($idnos as element()*)
as element(xhtml:li)* {
......@@ -615,7 +615,7 @@ element xhtml:li {
(:~
: prepares a link to the current entry
: @param $id – the xml:id of the currently processed element
: @param $id The xml:id of the currently processed element
:)
declare function ixp:entry-link($id as attribute(xml:id))
as element(xhtml:span) {
......@@ -632,7 +632,7 @@ as element(xhtml:span) {
(:~
: creates a xhtml list item containing serialized code.
: @param $node – a single element
: @param $node A single element
: :)
declare function ixp:li-code($node as element(*))
as element(xhtml:li) {
......@@ -653,7 +653,7 @@ element xhtml:li {
(:~
: generic function for entries with tei:note/tei:ptr.
: @return link to the corresponding index entry
: @return Link to the corresponding index entry
: :)
declare function ixp:pointer($entry as element())
as element(xhtml:li) {
......@@ -725,7 +725,7 @@ httpclient:get(xs:anyURI($url || "/about/rdf"), false(), ())//rdf:RDF
(:~
: parser for listEvents/event entities
: @param $eventDoc – the tei:listEvent containing all entries
: @param $eventDoc The tei:listEvent containing all entries
: :)
declare function ixp:events($eventDoc as element(tei:listEvent))
as element(xhtml:div) {
......@@ -769,7 +769,7 @@ else
(:~
: parser for listEvents/event entities
: @param $eventDoc – the tei:listEvent containing all entries
: @param $eventDoc The tei:listEvent containing all entries
: :)
declare function ixp:events($eventDoc as element(tei:listEvent), $filter as xs:string+)
as element(xhtml:div) {
......
......@@ -108,8 +108,8 @@ return
(:~
: Recursive transformation of the index document, if a specific item is requested.
: @param $nodes – node to be parsed
: @param $id – a single id prepared with generate-id()
: @param $nodes Node to be parsed
: @param $id A single id prepared with generate-id()
: :)
declare function local:transform-entity($nodes as node()+, $id as xs:string)
as node()* {
......@@ -172,8 +172,8 @@ declare function ixv:tabs($nodes as node(), $model as map(*), $index as xs:strin
(:~
: Recursive transformation of a given node from the template to a
: represent a list of tabs with current index view marked `active`.
: @param $nodes – nodes to transform
: @param $index – the index that should be marked `active`
: @param $nodes Nodes to transform
: @param $index The index that should be marked `active`
: :)
declare
%test:name("mark active tab")
......
xquery version "3.1";
(:~
: Provides a REST-API to get table of contents
: Provides a REST-API for miscellaneous purposes.
:
: @author Mathias Göbel
: @version 0.1
......@@ -21,7 +21,7 @@ import module namespace rest="http://exquery.org/ns/restxq";
declare variable $misc:dataPath := "/db/sade-projects/textgrid/data/xml/data/";
declare variable $misc:xhtmlPath := "/db/sade-projects/textgrid/data/xml/xhtml/";
(:~ get a list of published notebooks :)
(:~ Prepares a list of published notebooks :)
declare
%rest:GET
%rest:path("/api/app/published")
......@@ -73,7 +73,7 @@ return
map{ "notebooks": $result})
};
(:~ get a list of pages contained by a single notebooks :)
(:~ Prepares a list of pages in a single notebooks :)
declare
%rest:GET
%rest:path("/api/app/listpages/{$uri}")
......@@ -81,7 +81,8 @@ declare
%output:method("json")
%test:name("list pages per notebook notebooks")
%test:arg("uri", "16b00")
%test:assertTrue
function misc:listpages($uri as xs:string)
{
let $toc := ($misc:xhtmlPath || $uri || "/toc.xml") => doc()
......@@ -114,6 +115,9 @@ declare
%output:method("json")
%test:name("get transcription")
%test:arg("uri", "16b00")
%test:arg("surface", "1r")
%test:assertTrue
function misc:listpages($uri as xs:string, $surface as xs:string)
{
......@@ -152,11 +156,19 @@ function misc:version(){
)
};
(:~
: JSON serialization of a TEI file
: @param $uri A valid TextGrid URI (without prefix) of an item available in the database
: @return
:)
declare
%rest:GET
%rest:path("/api/data/json/{$uri}")
%rest:produces("application/json")
%output:method("json")
%test:arg("uri", "16b00")
%test:assertTrue
function misc:json($uri as xs:string){
(<rest:response>
<http:response status="200">
......
......@@ -51,7 +51,7 @@ as xs:string? {
(:~
: Translates tei:surface/@n to German
: @param $n – a valid @tei:n value
: @param $n A valid @tei:n value
: @return the German version, e.g. outer_front_cover translates to "vordere Einbanddecke außen"
: :)
declare function f-misc:n-translate($n as xs:string)
......
......@@ -24,15 +24,19 @@ import module namespace fontaneTransfo="http://fontane-nb.dariah.eu/Transfo" at
: retreives parameters via REST and returns the corresponding
: image. Resolution is always 1000px in height.
:
: @param $uri A valid TextGrid Base-URI without prefix
: @param $xmlid Any xml:id used inside the document specified by $uri
: @param $format – the return format (IIIF: http://iiif.io/api/image/2.0/#format)
: @param $uri A valid TextGrid Base-URI without prefix
: @param $xmlid Any xml:id used inside the document specified by $uri
: @param $format The return format (IIIF: http://iiif.io/api/image/2.0/#format)
: @return response object with the binary data
: :)
declare
%rest:GET
%rest:path("/api/tble/{$uri}-{$xmlid}.{$format}")
%output:method("binary")
%test:arg("uri", "16b00")
%test:arg("xmlid", "a1")
%test:arg("format", "jpg")
function tbleapi:stream-image($uri as xs:string, $xmlid as xs:string, $format as xs:string)
{
let $url := tbleapi:get-url($uri, $xmlid, $format)
......@@ -54,9 +58,9 @@ return
(:~
: retreives the URL to a clipping generated with Text-Image-Link-Editor
:
: @param $uri A valid TextGrid Base-URI without prefix
: @param $xmlid Any xml:id used inside the document specified by $uri
: @param $format – the return format (IIIF: http://iiif.io/api/image/2.0/#format)
: @param $uri A valid TextGrid Base-URI without prefix
: @param $xmlid Any xml:id used inside the document specified by $uri
: @param $format The return format (IIIF: http://iiif.io/api/image/2.0/#format)
: @return the URL to the image as xs:string
:)
declare function tbleapi:get-url($uri as xs:string, $xmlid as xs:string, $format as xs:string)
......
......@@ -26,6 +26,7 @@ declare
%output:method("html")
%test:name("entities per page")
%test:arg("uri", "16b00")
function toc:table-of-contents($uri as xs:string)
{
......
......@@ -78,8 +78,8 @@ declare function transfo:magic($nodes as node()*) {
(:~
: Main function in this module, called in recursion. Used with a tei:TEI node to create a complete
: transformation of a document.
: @param $node – usually a tei:TEI
: @param $inital – the inital tei:surface is wrapped in a specific xhtml:div
: @param $node A tei:TEI
: @param $inital The inital tei:surface is wrapped in a specific xhtml:div
: @return is specific to $nodes, so nothing declared
:)
declare function transfo:magic($nodes as node()*, $inital as xs:string?) {
......@@ -581,7 +581,7 @@ declare function transfo:seg($node as element(tei:seg)) {
(:~ returns a sequence of class names according to the given styles
: not only for tei:seg, but also for tei:zone
: @param $node – a single element with @style
: @param $node A single element with tei:style attribute
: or @rend or to calculate line-height.
:)
declare function transfo:segStyle($node) {
......@@ -1927,7 +1927,7 @@ if(($node/@function = ("deletion", "connect", "transposition")) and $node/parent
(:~
: Provides information if there is no contemporary writing on a surface.
: It excludes all hands we find at tei:handNotes
: @param $surface – a single tei:surface
: @param $surface A single tei:surface
: @return a boolean true if surface is vakat, else false
:)
declare function transfo:vakat($surface as element(tei:surface)) as xs:boolean {
......@@ -2455,7 +2455,7 @@ as xs:string {
: returns the current script value based on preceding tei:handShift and/or
: ancestor::*[]@xml:lang]
:
: @param $n – a text() node in a context
: @param $n A text() node in a context
: @return script type (a combination of Latn/Latf and standard/angular/clean/hasty)
:)
declare function transfo:script($text as text())
......
......@@ -20,9 +20,9 @@ declare namespace xhtml="http://www.w3.org/1999/xhtml";
(:~
: returns the transformed wiki-text without a superior element (e.g. <div class="dokuwiki"/>)
: @param $id – a pagename in the wikispace according to config.xml
: @param $node – the current node form the html-template with context
: @param $model – the current execution model
: @param $id A pagename in the wikispace according to config.xml
: @param $node The current node form the html-template with context
: @param $model The current execution model
:)
declare function wiki:include($node as node(), $model as map(*), $id as xs:string)
as node()* {
......@@ -31,9 +31,9 @@ as node()* {
(:~
: returns the transformed wiki-text
: @param $id – a pagename in the wikispace according to config.xml
: @param $node – the current node form the html-template with context
: @param $model – the current execution model
: @param $id A pagename in the wikispace according to config.xml
: @param $node The current node form the html-template with context
: @param $model The current execution model
:)
declare function wiki:dokuwiki($node as node(), $model as map(*), $id as xs:string)
as node()* {
......@@ -82,7 +82,7 @@ return
(:~
: Gets the currently stored revision number in the database for a given id
: @param $id – a pagename in the wikispace according to config.xml
: @param $id A pagename in the wikispace according to config.xml
: @return the revision number stored in the database
:)
declare function wiki:revision-local($id as xs:string)
......@@ -105,8 +105,8 @@ return
(:~
: Gets the last revision number from the wikis feed and removes an old version
: in the database. TODO: move remove operation somewhere else
: @param $id – the name of page in the wiki space
: @param $lastRevinDb – revision number of the currently stored resource
: @param $id The name of page in the wiki space
: @param $lastRevinDb Revision number of the currently stored resource
: @return the last revsion number from the remote wiki
:)
declare function wiki:revision-remote($id as xs:string)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment