Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
97a819c2
Commit
97a819c2
authored
Jul 02, 2018
by
Mathias Goebel
🎠
Browse files
closes
#34
parent
af55b851
Changes
3
Hide whitespace changes
Inline
Side-by-side
controller.xql
View file @
97a819c2
...
...
@@ -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:", "")
...
...
modules/fontane/misc.xqm
View file @
97a819c2
...
...
@@ -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($page
l
ist, $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 $page
List2 := $indexFile//@data-page/string()
let $index
2
:= index-of($page
L
ist
2
, $page)
let $return :=
(
(
if ( $index gt 1 )
if ( $index
2
gt 1 )
then
<a id="navPrev" href="edition.html?id={$id}&page={$page
l
ist[$index - 1]}">
<a id="navPrev" href="edition.html?id={$id}&page={$page
L
ist
2
[$index
2
- 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($page
l
ist) )
if ( $index
2
lt count($page
L
ist
2
) )
then
<a id="navNext" href="edition.html?id={$id}&page={$page
l
ist[$index + 1]}">
<a id="navNext" href="edition.html?id={$id}&page={$page
L
ist
2
[$index
2
+ 1]}">
<!-- slash needed in LIVE? -->
<span id="navNextInfo"> nächste Seite </span>
<i class="fa fa-chevron-right"></i>
...
...
modules/fontane/transform.xqm
View file @
97a819c2
...
...
@@ -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&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&page={$child/@n}">
{$child/string(@n)} {$child/string(@subtype)}
<xhtml:a href="?id=/xml/data/{
$uri
}.xml&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&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>
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment