Commit 97a819c2 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

closes #34

parent af55b851
......@@ -54,7 +54,13 @@ else if (tokenize($exist:path, '/') = "get") then
let $reqid := request:get-parameter("id", "/xml/data/16b00.xml"),
$id := $reqid => substring-after("/xml/data/") => substring-before(".xml"),
$pagereq := request:get-parameter("page", "1r"),
$page := if( $pagereq = "" ) then "outer_front_cover" else $pagereq,
$alternative := contains($pagereq, "-alt"),
$page := if( $pagereq = "" )
then "outer_front_cover"
else
if($alternative)
then $pagereq => substring-before("-alt")
else $pagereq,
$docCollection := $config:projects-dir || $project ||"/data/xml/xhtml/"|| $id ||"/",
$docpath := $docCollection || $page ||".xml",
$doc := doc( $docpath ),
......@@ -67,10 +73,18 @@ else if (tokenize($exist:path, '/') = "get") then
)
case "trans.html" return
replace(serialize($doc/xhtml:body/xhtml:div/xhtml:div[not(@class="teixml")][not(@class="facs")]), "xhtml:", "")
if($alternative)
then serialize($doc/xhtml:body/xhtml:div/xhtml:div[not(@class="teixml")][not(@class="facs")])
=> replace("xhtml:", "") => replace('class="surface"', 'class="surface no-nesting"')
else
serialize($doc/xhtml:body/xhtml:div/xhtml:div[not(@class="teixml")][not(@class="facs")])
=> replace("xhtml:", "")
case "facs.html" return
replace(serialize($doc//xhtml:div[@class="facs"]), "xhtml:", "")
if ($alternative and $id="2128f") (: using one transformation for two renderings :)
then replace(serialize($doc//xhtml:div[@class="facs"]), "xhtml:", "")
=> replace("1671z", "16725")
else
replace(serialize($doc//xhtml:div[@class="facs"]), "xhtml:", "")
case "toc.html" return
replace(serialize(doc( $docCollection || "toc.xml" )), "xhtml:", "")
......
......@@ -270,7 +270,7 @@ declare function f-misc:content($node as node(), $model as map(*), $id, $page){
<div id="nb-title" class="col-xs-3 col-md-2" title="reset layout">
<h1 class="animated slideInLeft">
<span>{f-misc:nbTitle(request:get-parameter('id', ''), $model)}
{if(matches($page, '\d+(r|v)')) then ': '||$page else ()}</span>
{if(matches($page, '\d+(r|v)')) then ': '||replace($page, "-alt", "") else ()}</span>
</h1>
</div>,
<div id="facsBtn" class="col-xs-1 col-md-2{ if(contains(request:get-cookie-value('facs'), 'inactive')) then ' inactive' else ()}">
......@@ -348,7 +348,7 @@ switch ( config:get('sade.develop') )
</div>
default return
<div class="row">
<div id="rsBtn" class="col-xs-3{ if(not(request:get-cookie-names() = 'rs') or contains(request:get-cookie-value('rs'), 'inactive')) then ' inactive' else ()}">
<div id="rsBtn" class="col-xs-4{ if(not(request:get-cookie-names() = 'rs') or contains(request:get-cookie-value('rs'), 'inactive')) then ' inactive' else ()}">
<h1 class="animated slideInLeft">
<span>Entitäten</span>
</h1>
......@@ -358,7 +358,7 @@ switch ( config:get('sade.develop') )
</ul>
</div>
</div>
<div id="dateBtn" class="col-xs-3{ if(not(request:get-cookie-names() = 'date') or contains(request:get-cookie-value('date'), 'inactive')) then ' inactive' else ()}">
<div id="dateBtn" class="col-xs-4{ if(not(request:get-cookie-names() = 'date') or contains(request:get-cookie-value('date'), 'inactive')) then ' inactive' else ()}">
<h1 class="animated slideInLeft">
<span>Datierung</span>
</h1>
......@@ -510,20 +510,21 @@ return (
)
};
declare function f-misc:pageNav($node as node(), $model as map(*), $id){
declare function f-misc:pageNav($node as node(), $model as map(*), $id as xs:string, $page as xs:string)
as element()* {
if(request:get-parameter-names() = 'page')
then
let $page := if(request:get-parameter('page', '') = '') then 'outer_front_cover' else request:get-parameter('page', '')
let $doc:= doc('/db/sade-projects/textgrid/data'||$id)/tei:TEI
let $pagelist := $doc//tei:sourceDoc//tei:surface[parent::tei:sourceDoc or @type="clipping" or @type="additional"]/string(@n)
let $page := if ($page = '') then 'outer_front_cover' else $page
let $index := index-of($pagelist, $page)
let $uri := $id => substring-after("/xml/data") => substring-before(".xml")
let $page := if($page = '') then 'outer_front_cover' else $page
let $indexFile := doc('/db/sade-projects/textgrid/data/xml/xhtml/' || $uri || "/toc.xml" )
let $pageList2 := $indexFile//@data-page/string()
let $index2 := index-of($pageList2, $page)
let $return :=
(
(
if ( $index gt 1 )
if ( $index2 gt 1 )
then
<a id="navPrev" href="edition.html?id={$id}&amp;page={$pagelist[$index - 1]}">
<a id="navPrev" href="edition.html?id={$id}&amp;page={$pageList2[$index2 - 1]}">
<!-- slash needed in LIVE? -->
<i class="fa fa-chevron-left"></i>
<span id="navPrevInfo"> vorige Seite </span>
......@@ -531,9 +532,9 @@ if(request:get-parameter-names() = 'page')
)
,
(
if ( $index lt count($pagelist) )
if ( $index2 lt count($pageList2) )
then
<a id="navNext" href="edition.html?id={$id}&amp;page={$pagelist[$index + 1]}">
<a id="navNext" href="edition.html?id={$id}&amp;page={$pageList2[$index2 + 1]}">
<!-- slash needed in LIVE? -->
<span id="navNextInfo"> nächste Seite </span>
<i class="fa fa-chevron-right"></i>
......
......@@ -1846,16 +1846,19 @@ return
(: prerendered toc :)
declare function fontaneTransfo:toc($doc) {
let $responsilbeHands as xs:string+ :=
($doc//tei:profileDesc/tei:handNotes[string(@n) = ("5", "4")]/tei:handNote/("#"||@xml:id),"#Druck_p")
let $console := console:log( string-join($responsilbeHands , " "))
let $uri := $doc/*//tei:idno[@type="TextGrid"]/text() => substring-after('textgrid:')
return
element xhtml:div {
attribute id {'toc'},
$doc/tei:fileDesc/tei:titleStmt/tei:title/string(.),
<xhtml:ol>
{for $surface in $doc/tei:sourceDoc/tei:surface
let $url := "?id=/xml/data/"
|| $uri
|| ".xml&amp;page="
|| $surface/@n
let $vakat := if(fontaneTransfo:vakat($surface)) then "vakat" else (),
$fragment := if($surface/@type="fragment")
then ('Fragment',
......@@ -1872,12 +1875,13 @@ element xhtml:div {
$childs := for $child in $surface/tei:surface[@type= ('clipping', 'additional')]
return
<xhtml:li>
<xhtml:a href="?id=/xml/data/{substring-after( $doc//tei:teiHeader//tei:publicationStmt/tei:ab//tei:idno[@type="TextGrid"]/text(), 'textgrid:' )}.xml&amp;page={$child/@n}">
{$child/string(@n)} {$child/string(@subtype)}
<xhtml:a href="?id=/xml/data/{ $uri }.xml&amp;page={$child/@n}">
{replace($child/string(@n), "_", " ")} {$child/string(@subtype)}
</xhtml:a>
</xhtml:li>
return
<xhtml:li><xhtml:a href="?id=/xml/data/{substring-after( $doc//tei:teiHeader//tei:publicationStmt/tei:ab//tei:idno[@type="TextGrid"]/text(), 'textgrid:' )}.xml&amp;page={$surface/@n}">{
(<xhtml:li data-page="{$surface/string(@n)}">
<xhtml:a href="{$url}">{
if(contains($surface/string(@n), 'endpaper')) then
let $seq := tokenize($surface/string(@n), '_')
return
......@@ -1887,18 +1891,26 @@ element xhtml:div {
default return 'ungültiger Wert in @n')
|| ' Vorsatzblatt ' || $seq[last()])
else
switch ($surface/string(@n))
case "outer_front_cover" return "vordere Einbanddecke außen"
case "inner_front_cover" return "vordere Einbanddecke innen"
case "inner_back_cover" return "hintere Einbanddecke innen"
case "outer_back_cover" return "hintere Einbanddecke außen"
case "spine" return "Buchrücken"
default return $surface/string(@n)
} {if($info = '') then () else
' ('||$info||')'}
</xhtml:a>
{if($childs = ()) then () else <xhtml:ul> {$childs} </xhtml:ul>}
</xhtml:li>
switch ($surface/string(@n))
case "outer_front_cover" return "vordere Einbanddecke außen"
case "inner_front_cover" return "vordere Einbanddecke innen"
case "inner_back_cover" return "hintere Einbanddecke innen"
case "outer_back_cover" return "hintere Einbanddecke außen"
case "spine" return "Buchrücken"
default return $surface/string(@n)
} {if($info = '') then () else
' ('||$info||')'}
</xhtml:a>
{if($childs = ()) then () else <xhtml:ul> {$childs} </xhtml:ul>}
</xhtml:li>,
if ($surface/tei:surface/starts-with(@n, "Beilage_") = true())
then
<xhtml:li data-page="{$surface/string(@n)}-alt">
<xhtml:a href="{$url}-alt">
{$surface/string(@n)} (ohne Beilage)
</xhtml:a>
</xhtml:li>
else ())
}
</xhtml:ol>
}
......
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