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

Merge branch 'release/2.5.4'

parents 39aa78bd 07896de6
project.namespace=http://textgrid.de/ns/SADE
project.version=2.5.0
project.version=2.5.4
project.title=Scalable Architecture for Digital Editions
project.abbrev=SADE
......@@ -14,7 +14,7 @@ declare variable $f-misc:metadata-collection := collection("/db/sade-projects/t
declare
%test:arg("baseUri","textgrid:16b00") %test:assertEquals("Notizbuch C07")
%test:arg("baseUri","") %test:assertEquals("")
function f-misc:get-title-by-baseUri($baseUri as xs:string) as xs:string? {
function f-misc:get-title-by-baseUri($baseUri as xs:string) as xs:string? {
if($baseUri = "") then () else
$f-misc:metadata-collection//tgmd:object[tgmd:generic/tgmd:generated/tgmd:textgridUri[starts-with(., $baseUri)]]//tgmd:title/string()
};
......@@ -230,13 +230,13 @@ declare function f-misc:list($datadir, $param, $num as xs:integer) {
<li>Stellenkommentar</li>
<li>Register
<ul>
<li><a href="register.html?nb={$uri[last()]}&amp;r=253sx">Register der Personen und Werke</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;r=253t3">Register der Werke</a></li>
<li>Register der Werke Theodor Fontanes</li>
<li>Register der Periodika</li>
<li><a href="register.html?nb={$uri[last()]}&amp;r=253t2">Geographisches Register</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;r=253t0">Register der Ereignisse</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;r=253t1">Register der Institutionen und Körperschaften</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;i=pers">Register der Personen und Werke</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;i=work">Register der Werke</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;i=work-fontane">Register der Werke Theodor Fontanes</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;i=work-periodical">Register der Periodika</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;i=place">Geographisches Register</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;i=event">Register der Ereignisse</a></li>
<li><a href="register.html?nb={$uri[last()]}&amp;i=org">Register der Institutionen und Körperschaften</a></li>
</ul>
</li>
</ul>
......
This diff is collapsed.
xquery version "3.1";
(:~
: This module provides an API to retreive images based on a TextGrid URI and a
: corresponding xml:id used in compliance with the Text-Image-Link-Editor.
: It queries the database for the latest link based on the xml:id and returns
: the image.
:
: @author Mathias Göbel
: @version 1.0
: @since 2.5.1
: :)
module namespace tbleapi="https://fontane-nb.dariah.eu/tble";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace svg="http://www.w3.org/2000/svg";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace xlink="http://www.w3.org/1999/xlink";
import module namespace rest="http://exquery.org/ns/restxq";
import module namespace fontaneTransfo="http://fontane-nb.dariah.eu/Transfo" at "transform.xqm";
(:~
: 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)
: @return response object with the binary data
: :)
declare
%rest:GET
%rest:path("/tble/{$uri}-{$xmlid}.{$format}")
%output:method("binary")
function tbleapi:stream-image($uri as xs:string, $xmlid as xs:string, $format as xs:string)
{
let $url := tbleapi:get-url($uri, $xmlid, $format)
let $request := httpclient:get($url, false(), ())
let $data := $request/httpclient:body/text()
let $binary-data :=
try { $data => xs:base64Binary() }
catch * {
error(
QName("err", "load1"),
string-join(("&#10;Could not load data from TextGrid: ", $data, $err:code, $err:description), "&#10;"))
}
let $mime := string($request/httpclient:body/@mimetype)
return
$binary-data
};
(:~
: 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)
: @return the URL to the image as xs:string
:)
declate function tbleapi:get-url($uri as xs:string, $xmlid as xs:string, $format as xs:string)
as xs:string {
let $link := fontaneTransfo:newestTBLELink($uri, $xmlid) (: TODO: move this function here :)
let $shape := $link/@targets => substring-after('#') => substring-before(' ')
let $svgg := $link/root()//svg:g[@id = $link/parent::tei:linkGrp/substring-after(@facs, '#')]
let $image := substring-before($svgg//svg:image/@xlink:href, ".")
let $rect := $svgg//svg:rect[@id = $shape]
let $x := $rect/@x => substring-before('%')
let $y := $rect/@y => substring-before('%')
let $w := $rect/@width => substring-before('%')
let $h := $rect/@height => substring-before('%')
let $rotation := 0
let $url := "https://textgridlab.org/1.0/digilib/rest/IIIF/"
|| $image || '/pct:' || $x || ',' || $y || ',' || $w || ',' || $h
|| "/,1000/" || $rotation || "/default." || $format
return
$url
};
......@@ -263,7 +263,12 @@ typeswitch($node)
return
try {
element xhtml:div {
attribute class {'line', fontaneTransfo:segStyle($node), if($node/@type) then string($node/@type) else ()},
attribute class {
'line',
fontaneTransfo:segStyle($node),
if($node/@type) then string($node/@type) else (),
if($node/tei:seg[@type="col"][@n]) then "column" else ()
},
attribute style {
string-join((
($node/@style),
......@@ -584,7 +589,9 @@ declare function fontaneTransfo:surfaceDiv($node as node(), $inital as xs:string
if( config:get("sade.develop") = "true" )
then serialize($node)
else (serialize($node) => replace("<!--.*?-->", "") => replace("\n+", "&#10;")),
if($node/following-sibling::*[1]/local-name() = "note") then serialize($node/following-sibling::tei:note) else ()
for $n in $node/following-sibling::tei:note
where $n >> $node and $n << ($node/following-sibling::tei:surface)[1]
return serialize($n)
}
}
}
......
......@@ -15,7 +15,7 @@ import module namespace dsk-view="http://semtonotes.github.io/SemToNotes/dsk-vie
import module namespace fontaneTransfo="http://fontane-nb.dariah.eu/Transfo" at '../fontane/transform.xqm';
import module namespace fontaneSfEx="http://fontane-nb.dariah.eu/SfEx" at '../fontane/surfaceExtract.xqm';
import module namespace fontaneLitVZ="http://fontane-nb.dariah.eu/LitVZ" at "../fontane/literaturverzeichnis.xqm";
import module namespace fontaneregister="http://fontane-nb.dariah.eu/register" at "../fontane/register.xqm";
import module namespace f-register="http://fontane-nb.dariah.eu/register" at "../fontane/register.xqm";
import module namespace fontaneUeberblickskommentar="http://fontane-nb.dariah.eu/Ueberblickskommentar" at "../fontane/ueberblickskommentar.xqm";
import module namespace console="http://exist-db.org/xquery/console";
......@@ -73,7 +73,7 @@ declare function local:showAuth($node as node(), $model as map(*), $id as xs:str
case 'ueberblickskommentar' return
try {fontaneUeberblickskommentar:render($docpath)}
catch * { <error>Caught error {$err:code}: <br/> {$err:description}. <br/> Data: <br/> {$err:value} </error> }
case 'register' return fontaneregister:register($docpath)
case 'register' return f-register:register()
default return mviewer:renderFontane($node, $model, $docpath)
else
<div class="container FontaneAuth">
......@@ -427,5 +427,5 @@ declare function mviewer:registerT($node as node(), $model as map(*), $id as xs:
let $data-dir := config:get('data-dir')
let $docpath := $data-dir || '/' || $id
return
fontaneregister:register( $docpath )
f-register:register()
};
......@@ -6,6 +6,11 @@ import module namespace config="http://textgrid.de/ns/SADE/config" at "../config
declare namespace http="http://expath.org/ns/http-client";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare function wiki:include($node as node(), $model as map(*), $id as xs:string)
{
wiki:dokuwiki($node, $model, $id)/*
};
declare function wiki:dokuwiki($node as node(), $model as map(*), $id as xs:string) as node()* {
(: replace id not in whitelist :)
let $id:= if($id = doc('/db/sade-projects/textgrid/data/xml/data/2shfj.xml')//text()) then $id else 'gesamtdokumentation'
......@@ -130,7 +135,9 @@ for $node in $nodes return
else (),
local:dokuwikiparser($node/node(), $char)
)}
case element (table)
case element(br) return
<br/>
case element(table)
return
element xhtml:table {
attribute class {'table'},
......
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