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

add thumbs

parent 75abafd9
project.name=http://textgrid.de/ns/SADE-fontane-develop
project.version=3.0.1
project.version=3.2.0
project.title=[Fontane] SADE
project.abbrev=SADE-fontane-develop
project.processorversion=4.3.1
......@@ -99,7 +99,7 @@ return
let $ref := substring-after($entity, ":")
let $index := (collection($index:dataPath)/id($ref))[1]
let $name := string($index/*[1])
let $list := local:get-list-by-id($ref)
let $list := index:get-list-by-id($ref)
let $href := "register-" || $list || ".html?e=" || $ref
order by $name
return
......@@ -153,7 +153,7 @@ declare
%test:args("Purschian") (: person :)
%test:assertEquals("listPerson")
function local:get-list-by-id($id as xs:string)
function index:get-list-by-id($id as xs:string)
as xs:string {
let $entity := collection($index:dataPath)/id($id)
let $test := if($entity[2]) then error(QName("FONTANE", "INDEX-API3"), "Entity »" || $id || "« has more then one occurence." ) else ()
......@@ -164,11 +164,11 @@ return
case "place" return "listPlace"
case "person" return
if($entity/ancestor::tei:item)
then local:get-list-by-id( ($entity/ancestor::tei:item)[last()]/string(@xml:id) )
then index:get-list-by-id( ($entity/ancestor::tei:item)[last()]/string(@xml:id) )
else "listPerson"
case "personGrp" return
if($entity/ancestor::tei:item)
then local:get-list-by-id( ($entity/ancestor::tei:item)[last()]/string(@xml:id) )
then index:get-list-by-id( ($entity/ancestor::tei:item)[last()]/string(@xml:id) )
else "listPerson"
default return
let $list := ($entity/ancestor::tei:list[@type])[last()]
......
......@@ -69,7 +69,7 @@ return
: @return on of listEvent, listOrg, listPlace, listPerson, list-works,
: list-Fontane, list-periodicals
:)
declare function local:get-list-by-entity($entity as node())
declare function local:get-list-by-entity($entity as node()?)
as xs:string {
switch ( $entity/local-name() )
case "event" return "listEvent"
......@@ -89,6 +89,19 @@ switch ( $entity/local-name() )
$list/local-name() || "-" || string($list/@type)
};
declare function local:get-icon-by-entity($entity as node())
as xs:string {
switch ( $entity/local-name() )
case "event" return "fa-flag"
case "org" return "fa-university"
case "person" return "fa-user"
case "personGrp" return "fa-users"
case "place" return "fa-map-marker"
case "item" return "fa-book"
default return
"fa-exclamation-triangle"
};
(:~
: Helper function to use an efficient map data type to store the model.
:)
......@@ -285,7 +298,10 @@ let $response :=
then doc( $docname )
else
httpclient:get(xs:anyURI($url), $persist, $request-headers)
let $store := xmldb:store($gndCollection, $filename, $response)
let $store :=
if(config:get("sade.develop") = "true")
then xmldb:store($gndCollection, $filename, $response)
else ()
return
string($response//foaf:page/@rdf:resource)
};
......@@ -407,13 +423,31 @@ element xhtml:li {
declare function local:has-former-or-current-location($links as element(tei:link)*)
as element(xhtml:li)* {
for $link in $links
let $id := $link/@target => substring-after(" ") => substring-after(":")
let $thisId := string($link/parent::tei:linkGrp/parent::tei:*/@xml:id)
let $id := ($link/@target => replace("\w{3}:|#", "") => tokenize(" "))[. != ""][. != $thisId]
return
if(count($id) != 1) then
(update insert comment {"unable to parse target: " || serialize($link)} following $link,
update delete $link)
else
let $targetNode := $f-indexproc:dataCollection/id($id)
return
if(count($targetNode) gt 1)
then (update insert comment {"xml:id used multiple times. this occurence is removed. please check and reinsert item when xml:id is unique. " || serialize($id[2])} following $id[2],
update delete $id[2]
)
else if(count($targetNode) = 0)
then
(update insert comment {"ID " || $id || " not found: Please create an appropriate item. " || serialize($link)} following $link,
update delete $link
)
else
let $list := local:get-list-by-entity($targetNode)
return
element xhtml:li {
attribute class { "former-or-current-location" },
element xhtml:a {
attribute href { "register-listPlace.html?e=" || $id },
attribute href { "register-" || $list || ".html?e=" || $id },
<xhtml:i class="fa fa-map-marker" aria-hidden="true"></xhtml:i>,
"&#160;",
$targetNode/*[1]/string(),
......@@ -528,10 +562,11 @@ element xhtml:li {
: :)
declare function local:pointer($entry as element())
as element(xhtml:li) {
let $labelMain := ($entry/*)[1]
let $target := $entry/tei:note/tei:ptr/@target => substring-after('#')
let $labelMain := $entry/*[1]
let $target := substring-after(($entry/tei:note/tei:ptr/@target), '#')
let $targetNode := $f-indexproc:dataCollection/id($target)
return
if(not($targetNode)) then <div>target not found</div> else
element xhtml:li {
attribute class {
"registerEintrag",
......
......@@ -9,6 +9,8 @@ module namespace f-indexviewer="http://fontane-nb.dariah.eu/indexviewer";
import module namespace f-indexproc="http://fontane-nb.dariah.eu/indexproc" at "index-processor.xqm";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../config/config.xqm";
import module namespace functx="http://www.functx.com";
declare namespace ore="http://www.openarchives.org/ore/terms/";
declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
......@@ -140,8 +142,7 @@ declare function f-indexviewer:main($model as map()*, $node as node(), $index as
if ($f-indexproc:notebookParam)
then
f-indexproc:register($index)[./@id = $index]
(: xhtml prefixes w/o xmlns attr in the output. work around with: :)
=> serialize() => parse-xml()
=> functx:change-element-ns-deep("http://www.w3.org/1999/xhtml", "")
else
let $doc := doc( local:cache() )
return
......
......@@ -2,6 +2,7 @@ xquery version "3.1";
module namespace f-misc="http://fontane-nb.dariah.eu/ns/SADE/misc";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../config/config.xqm";
import module namespace console="http://exist-db.org/xquery/console";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace test="http://exist-db.org/xquery/xqsuite";
......@@ -197,17 +198,17 @@ return
};
declare function f-misc:kaesten($node as node(), $model as map(*)){
let $q := request:get-parameter('n', '')
let $q := if(string-length($q) = 1) then $q||"0" else $q
let $num := if(matches($q, "\d+$")) then number(substring($q, 2, 2)) else 0
let $q := substring($q, 1, 1)
let $n := request:get-parameter('n', 'a0')
let $num := if(matches($n, "\d+$")) then number(substring($n, 2)) else 0
let $k := lower-case(substring($n, 1, 1))
let $q := $k || $num
let $data-dir := config:get("data-dir")
return
(<ul class="nav nav-tabs">
{for $kasten in (('a', 'b', 'c', 'd', 'e'))
return
if ($q = $kasten)
if ($k = $kasten)
then
<li class="active">
<a href="#{$kasten}" data-toggle="tab">Kasten {upper-case($kasten)}</a>
......@@ -222,7 +223,7 @@ return
{
for $kasten in (('a', 'b', 'c', 'd', 'e'))
return
if ($q = $kasten)
if ($k = $kasten)
then
<div class="tab-pane active" id="{$kasten}">
<div class="panel-group" id="accordion{upper-case($kasten)}" role="tablist" aria-multiselectable="true">
......@@ -238,88 +239,93 @@ return
}
</div>)
};
declare function f-misc:list($datadir, $param, $num as xs:integer) {
let $tgnav:= doc('/db/sade-projects/textgrid/navigation-fontane.xml')
for $item at $pos in distinct-values($tgnav//object[string(@type)="text/xml"][starts-with(string(@title), 'Notizbuch ' || $param)]/string(@title))
(:
: use these lines, when more than on revision is in the database
: let $maxRev:= max($tgnav//object[@title = $item]/number(substring-after(@uri, '.'))),:)
(: $uri:= $tgnav//object[@title = $item][number(substring-after(@uri, '.')) = $maxRev]/substring-after(@uri, 'textgrid:'):)
let $uri:= $tgnav//object[string(@title) = $item]/substring-before(substring-after(@uri, 'textgrid:'), '.')
let $thisIn := upper-case(replace(request:get-parameter('n', ''), "\d", "")) || $num eq replace($item, "Notizbuch ([A-E])0(\d)", "$1$2")
declare function f-misc:list($datadir, $param, $num as xs:integer)
as element(xhtml:div)+ {
let $tgnav := doc("/db/sade-projects/textgrid/data/xml/data/3qnsx.xml")
let $tgnavObjects := $tgnav//object[starts-with(./@title, 'Notizbuch ' || $param)]/string(@title)
=> distinct-values()
for $item at $pos in $tgnavObjects
let $uri:= $tgnav//object[string(@title) = $item]/substring-after(@uri, 'textgrid:')
let $teiDoc := doc("/db/sade-projects/textgrid/data/xml/data/" || $uri || ".xml")
let $title := if (matches($item, '0\d')) then $item => replace('0', '') else $item
let $beta := if(contains(($teiDoc//tei:revisionDesc/tei:change)[last()]/text(), 'Version 0.')) then <xhtml:sup>beta</xhtml:sup> else ()
let $thisIn := (request:get-parameter('n', '') => replace("0(\d)", "$1") => upper-case()) = $param||$pos
return
<div class="panel panel-dark">
<div class="panel-heading" role="tab" id="heading{$param||$pos}">
<h3 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion{$param}" href="#collapse{$param||$pos}" aria-expanded="false" aria-controls="collapse{$param||$pos}">
{ if (matches($item, '0\d')) then replace($item, '0', '') else $item }{if($param||$pos = ('C5', 'C6', 'C7')) then <xhtml:sup>beta</xhtml:sup> else ()}
</a>
</h3>
</div>
<div id="collapse{$param||$pos}" class="panel-collapse collapse{if ($thisIn) then ' in' else ()}" role="tabpanel" aria-labelledby="heading{$param||$pos}">
<div class="panel-body">
<div class="row">
<div class="col-md-9">
<a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page=">Synoptische Ansicht</a>
<span style="margin-left:20px;"/>
<form class="form-inline" style="display:inline;" action="edition.html" metod="get">
<input type="hidden" name="id" value="/xml/data/{$uri[last()]}.xml"/>
<div class="form-group">
<div class="panel-heading" role="tab" id="heading{$param||$pos}">
<h3 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion{$param}" href="#collapse{$param||$pos}" aria-expanded="false" aria-controls="collapse{$param||$pos}">
{$title}
{$beta}
</a>
</h3>
</div>
<div id="collapse{$param||$pos}" class="panel-collapse collapse{if ($thisIn) then ' in' else ()}" role="tabpanel" aria-labelledby="heading{$param||$pos}">
<div class="panel-body">
<div class="row">
<div class="col-md-9">
<a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page=">Synoptische Ansicht</a>
<span style="margin-left:20px;"/>
<form class="form-inline" style="display:inline;" action="edition.html" metod="get">
<input type="hidden" name="id" value="/xml/data/{$uri[last()]}.xml"/>
<div class="form-group">
<input name="page" type="text" style="border-radius:0;border-style:solid;width:40px;" placeholder="1r" data-toggle="tooltip" data-placement="bottom" title="Blattnummer"/>
<button type="submit" class="btn btn-default"><i class="fa fa-chevron-right"></i></button>
<input name="page" type="text" style="border-radius:0;border-style:solid;width:40px;" placeholder="1r" data-toggle="tooltip" data-placement="bottom" title="Blattnummer"/>
<button type="submit" class="btn btn-default"><i class="fa fa-chevron-right"></i></button>
</div>
</form>
<br/>
</div>
</form>
<br/>
<ul>
<li><a href="mirador.html?n={$param||$pos}">Digitalisate</a></li>
<li><a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('trans')">Transkriptionsansicht</a></li>
<li>Edierter Text/Textkritischer Apparat</li>
<li>TEI/XML-Ansicht: <a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('code')"><i title="seitenweise" class="fa fa-file-o"></i></a> | <a href="xml.html?id=/xml/data/{$uri[last()]}.xml"><i title="gesamtes XML auf der Webseite betrachten" class="fa fa-file-code-o"></i></a> |<a target="_blank" href="/rest/data/{$uri[last()]}.xml">REST</a></li>
<li>Kommentare und Register
<ul>
<li><a href="ueberblickskommentar.html?id=/xml/data/{$uri[last()]}.xml">Überblickskommentar</a></li>
<li>Stellenkommentar</li>
<li>Register
<ul>
<li><a href="mirador.html?n={$param||$pos}">Digitalisate</a></li>
<li><a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('trans')">Transkriptionsansicht</a></li>
<li>Edierter Text/Textkritischer Apparat</li>
<li>TEI/XML-Ansicht: <a href="edition.html?id=/xml/data/{$uri[last()]}.xml&amp;page="
onclick="goldenState('code')"><i title="seitenweise" class="fa fa-file-o"></i></a> | <a href="xml.html?id=/xml/data/{$uri[last()]}.xml"><i title="gesamtes XML auf der Webseite betrachten" class="fa fa-file-code-o"></i></a> |<a target="_blank" href="/rest/data/{$uri[last()]}.xml">REST</a></li>
<li>Kommentare und Register
<ul>
<li><a href="ueberblickskommentar.html?id=/xml/data/{$uri[last()]}.xml">Überblickskommentar</a></li>
<li>Stellenkommentar</li>
<li>Register
<ul>
<li><a href="register-listPerson.html?nb={$uri[last()]}">Register der Personen und Werke</a></li>
<li><a href="register-list-works.html?nb={$uri[last()]}">Register der Werke</a></li>
<li><a href="register-list-Fontane.html?nb={$uri[last()]}">Register der Werke Theodor Fontanes</a></li>
<li><a href="register-list-periodicals.html?nb={$uri[last()]}">Register der Periodika</a></li>
<li><a href="register-listPlace.html?nb={$uri[last()]}">Geographisches Register</a></li>
<li><a href="register-listEvent.html?nb={$uri[last()]}">Register der Ereignisse</a></li>
<li><a href="register-listOrg.html?nb={$uri[last()]}">Register der Institutionen und Körperschaften</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="inhalt.html?id=/xml/data/{$uri[last()]}.xml">Inhaltsverzeichnis</a></li>
<li><a href="register-listPerson.html?nb={$uri[last()]}">Register der Personen und Werke</a></li>
<li><a href="register-list-works.html?nb={$uri[last()]}">Register der Werke</a></li>
<li><a href="register-list-Fontane.html?nb={$uri[last()]}">Register der Werke Theodor Fontanes</a></li>
<li><a href="register-list-periodicals.html?nb={$uri[last()]}">Register der Periodika</a></li>
<li><a href="register-listPlace.html?nb={$uri[last()]}">Geographisches Register</a></li>
<li><a href="register-listEvent.html?nb={$uri[last()]}">Register der Ereignisse</a></li>
<li><a href="register-listOrg.html?nb={$uri[last()]}">Register der Institutionen und Körperschaften</a></li>
</ul>
</div>
<div class="col-md-3">
<div id="thumb">{
let $img := "digilib/"||substring-after($item, ' ')||"_001.jpg?dh=350&amp;mo=jpg"
return
element xhtml:img {
attribute class {"imgLazy"},
attribute src {
if ($thisIn) then $img else "/public/img/loader.svg"
},
if(not($thisIn)) then
attribute data-original {$img}
else ()
}
}
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</li>
<li><a href="inhalt.html?id=/xml/data/{$uri[last()]}.xml">Inhaltsverzeichnis</a></li>
</ul>
</div>
<div class="col-md-3">
<div id="thumb">{
let $img := "digilib/"||substring-after($item, ' ')||"_001.jpg?dh=350&amp;mo=jpg"
return
element xhtml:img {
attribute class {"imgLazy"},
attribute src {
if ($thisIn) then $img else "/public/img/loader.svg"
},
if(not($thisIn)) then
attribute data-original {$img}
else ()
}
}
</div>
</div>
</div>
</div>
</div>
</div>
};
declare function f-misc:content($node as node(), $model as map(*), $id, $page){
......
......@@ -3,7 +3,7 @@ xquery version "3.1";
: Provides a REST-API to get table of contents
:
: @author Mathias Göbel
: @version 1.0
: @version 1.2
: @since 2.6
: :)
......@@ -59,13 +59,29 @@ function toc:table-of-contents($uri as xs:string)
attribute class {"panel-body tocview"},
element ul {
for $ref in $item//tei:ref
let $targetPage := $ref/@target => substring-after("[@n='") => substring-before("']")
let $target := string($ref/@target)
let $targetPage :=
if(starts-with($target, "#xpath(//surface"))
then $target => substring-after("[@n='") => substring-before("']")
else if (matches($target, "^#[A-E]\d\d_.+_[a-z0-9]+$"))
then $target => substring-after("_") => substring-before("_")
else error(QName("FONTANE", "TOC-API1"), "invalid target: " || $target)
let $targetXhtml := doc("/sade-projects/textgrid/data/xml/xhtml/" || $uri || "/" || $targetPage || ".xml")
return
element li {
attribute class { "target" || $targetPage },
element a {
attribute href { "edition.html?id=/xml/data/" || $uri || ".xml&amp;page=" || $targetPage },
text { string($ref) => replace("\s*Blatt\s+", "") }
element div {
attribute class {"upper"},
element img {
attribute src {($targetXhtml//xhtml:img/@src)[1] => replace("/,1000/0/default.jpg", "/,150/0/default.jpg")}
}
},
element div {
attribute class {"lower"},
text { string($ref) => replace("\s*Blatt\s+", "") }
}
}
}
}
......@@ -74,8 +90,6 @@ function toc:table-of-contents($uri as xs:string)
}
}
},
if(config:get("sade.develop") = "true")
then doc( $toc:xhtmlPath || $uri || "/toc.xml" )
else ()
doc( $toc:xhtmlPath || $uri || "/toc.xml" )
)
};
......@@ -13,6 +13,7 @@ declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010";
import module namespace code="http://bdn-edition.de/ns/code-view";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../config/config.xqm";
import module namespace index="https://fontane-nb.dariah.eu/indexapi" at "index-api.xqm";
declare variable $fontaneTransfo:tooltipReplacementPattern := '\s$|,$|\.|\($|\)$|;|&#x2003;';
declare variable $fontaneTransfo:bracket_left.svg := <svg
......@@ -49,6 +50,11 @@ declare variable $fontaneTransfo:bracket_left.svg := <svg
declare variable $fontaneTransfo:dataCollection := collection("/db/sade-projects/textgrid/data/xml/data");
declare variable $fontaneTransfo:base-url :=
if (config:get("sade.develop") = "true")
then "https://fontane-nb.dariah.eu/test/"
else "https://fontane-nb.dariah.eu/";
declare function fontaneTransfo:magic($nodes as node()*) {
fontaneTransfo:magic(($nodes), "undefined")
};
......@@ -396,6 +402,21 @@ typeswitch($node)
$node/@xml:id ! attribute id { string(.) },
fontaneTransfo:magic($node/node())
}
case element(tei:note) return
if(not($node/@type="editorial"))
then
element xhtml:span {
attribute class { 'teinote', string($node/@type), string($node/@subtype) },
if($node/@type = "authorial" and $node/@subtype = "text")
then element xhtml:div {attribute class {'noteHover'}, 'Autoranmerkung: Text'}
else if($node/@type = "authorial" and $node/@subtype = "revision")
then element xhtml:div {attribute class {'noteHover'}, 'Autoranmerkung: Revision'}
else if($node/@type = "authorial" and $node/@subtype = "notebook")
then element xhtml:div {attribute class {'noteHover'}, 'Autoranmerkung: Notizbuch'}
else (),
fontaneTransfo:magic($node/node())
}
else fontaneTransfo:magic($node/node())
case element(tei:expan) return ()
case element(tei:addSpan) return ()
case element(tei:handShift) return ()
......@@ -644,13 +665,17 @@ if (exists($n/preceding-sibling::tei:addSpan) and $n/preceding-sibling::tei:addS
element xhtml:div {attribute class {'addSpanHover italic'}, 'Hinzufügung'}
else(),
if($n/@rend="border-left-style:brace") then $fontaneTransfo:bracket_left.svg else (),
let $id := string($n/@xml:id)
let $metamark := $n/ancestor::tei:surface[1]//tei:metamark[contains(string(@corresp), $id)]
return
if( ($id != "") and ( $metamark//tei:ref/ends-with(., 'gestrichen; erledigt') = true()) )
then
element xhtml:div {attribute class {'zoneHover'}, 'Erledigungsstreichung'}
else ()
let $id := string($n/@xml:id)
let $metamark := $n/ancestor::tei:surface[1]//tei:metamark[contains(string(@corresp), $id)]
return
if( ($id != "") and ( $metamark//tei:ref/ends-with(., 'gestrichen; erledigt') = true()) )
then
element xhtml:div {attribute class {'zoneHover'}, 'Erledigungsstreichung'}
else (),
if($n/tei:metamark[@function="authorial_note"])
then element xhtml:div {attribute class {'zoneHover'}, 'Klammer zusammenfassende Funktion'}
else ()
};
(:~ returns a sequence of class names according to the given styles
......@@ -761,7 +786,7 @@ return
declare function fontaneTransfo:postText($n) {
(: former mod hover::)
let $text := if(matches($n/following::text()[1][ancestor::tei:line = $n/ancestor::tei:line], '^\s'))
let $text := if(matches($n/following::text()[1][ancestor::tei:line = $n/ancestor::tei:line], '^\s|^ '))
then ()
else
if( matches(string-join($n/following::text()[ancestor::tei:line = $n/ancestor::tei:line]), '\s' ))
......@@ -1802,17 +1827,28 @@ element xhtml:div {
<xhtml:a href="?id=/xml/data/{ $uri }.xml&amp;page={$child/@n}">
{replace($child/string(@n), "_", " ")} {$child/string(@subtype)}
</xhtml:a>
</xhtml:li>
</xhtml:li>,
$doubleView := map {
"2128f": map {
"27v":"30r"
},
"22jtm": map {
"23v":"24r",
"24v":"25r",
"25v":"26r"
}
}
return
( (: double pages at first :)
if(($uri || ":" || $n) = "2128f:27v")
then
<xhtml:li data-page="{$n}-30r">
<xhtml:a href="{$url}-30r">
{$n}/30r (Doppelseitenansicht)
if(not(exists($doubleView($uri)))) then ()
else
if(not(exists($doubleView($uri)($n)))) then ()
else
<xhtml:li data-page="{$n}-{$doubleView($uri)($n)}">
<xhtml:a href="{$url}-{$doubleView($uri)($n)}">
{$n}/{$doubleView($uri)($n)} (Doppelseitenansicht)
</xhtml:a>
</xhtml:li>
else (),
</xhtml:li>,
(: normal single surface :)
<xhtml:li data-page="{$n}">
......@@ -1940,6 +1976,7 @@ declare function fontaneTransfo:noteParser($note as node()*) {
[not(parent::*[contains(@class, "expan")])]
, " ") || "]"
},
element xhtml:ul {
element xhtml:li {
fontaneTransfo:noteParser($node/node())
......@@ -1975,8 +2012,9 @@ declare function fontaneTransfo:noteParser($note as node()*) {
if( matches($node/@target, $pattern))
then
element xhtml:a {
attribute href {"https://fontane-nb.dariah.eu/edition.html?id=%2Fxml%2Fdata%2F"|| $uri ||".xml&amp;page="||$targetParts[2]||"&amp;target="||substring-after($node/@target, "#"),
fontaneTransfo:noteParser($node/node())
attribute href {$fontaneTransfo:base-url || "edition.html?id=%2Fxml%2Fdata%2F"|| $uri ||".xml&amp;page="||$targetParts[2]||"&amp;target="||substring-after($node/@target, "#"),
fontaneTransfo:noteParser($node/node()),
$node/node()
}
}
else <xhtml:span style="color:red; font-weight:bold"> tei:ref/@target does not macht »{$pattern}« </xhtml:span>
......@@ -2006,9 +2044,10 @@ declare function local:teiref2href($ref as xs:string) as xs:string {
let $id := substring-after($ref, ":")
return
switch ($prefix)
case "lit" return "https://fontane-nb.dariah.eu/literaturvz.html?id="||$id
case "wrk" return "https://fontane-nb.dariah.eu/test/register.html?e=" || $id
default return error(QName("https://fontane-nb.dariah.eu/error", "REF01"), "Unsupported type for @tei:ref. Must start with »lit:« or »wrk:«")
case "lit" return $fontaneTransfo:base-url || "literaturvz.html?id=" || $id
default return
let $listName := index:get-list-by-id($id)
return $fontaneTransfo:base-url || "register-" || $listName || ".html?e=" || $id
};
declare function fontaneTransfo:figure($node as node()*) {
......@@ -2031,7 +2070,7 @@ if( $node/parent::zone/@points ) then
</svg>,
element xhtml:div {
attribute class {'hrHover'},
'<'||tokenize($node//tei:figDesc/tei:ref/text(), ' ')[2]||'>'
tokenize($node//tei:figDesc/tei:ref/text(), ' ')[2] => replace(";", "")
}
)
else
......
......@@ -9,7 +9,9 @@ xquery version "3.1";
:)
module namespace wiki="http://textgrid.de/ns/SADE/wiki";
import module namespace code="http://bdn-edition.de/ns/code-view";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../config/config.xqm";
import module namespace functx="http://www.functx.com";
declare namespace http="http://expath.org/ns/http-client";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
......@@ -259,12 +261,16 @@ for $node in $nodes return
}
case element (pre)
return
element xhtml:pre {
element xhtml:code {
attribute class {'html'},
local:dokuwikiparser($node/node(), $char)
}
let $code := try {
string($node) => parse-xml()
} catch * {
try {
("<temporary-wrap>" || string($node) || "</temporary-wrap>") => parse-xml()
} catch * {<temporary-wrap>{string($node)}</temporary-wrap>}
}
return
code:main($code) => local:remove-temporary-root() => functx:change-element-ns-deep("http://www.functx.com", "")
case element (em)
return
element xhtml:em {
......@@ -432,3 +438,25 @@ if(false() = xmldb:login( '/sade-projects/textgrid/data/xml/doku/', config:get('
then (xmldb:login('/sade-projects/textgrid/data/xml/doku/', "admin", ""))
else true()
};
declare function local:remove-temporary-root($nodes) {
let $test := <xhtml:span class="hljs-tag">&lt;<xhtml:span class="hljs-name">temporary-wrap</xhtml:span>&gt;</xhtml:span>
for $node in $nodes
return
typeswitch ( $node )
case element( xhtml:span ) return
if( deep-equal($node, $test) ) then ()
else
element {$node/node-name()} {
$node/@*,
local:remove-temporary-root($node/node())
}
case text() return
normalize-space($node)
default return
element {$node/node-name()} {
$node/@*,
local:remove-temporary-root($node/node())
}
};
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