Skip to content

Commit

Permalink
added permaLink function
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed May 30, 2014
1 parent bb60ba6 commit 51143b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 12 additions & 1 deletion webapp/modules/core.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import module namespace cache="http://exist-db.org/xquery/cache" at "java:org.ex
: Get document by ID
:
: @author Peter Stadler
: @param $id the ID of the document
: @param $docID the ID of the document
: @return returns the document node of the resource found for the specified ID.
:)
declare function core:doc($docID as xs:string) as document-node()? {
Expand Down Expand Up @@ -249,3 +249,14 @@ declare function core:create-sort-persname($person as element(tei:person)) as xs
declare function core:normalize-space($string as xs:string?) as xs:string {
normalize-space(replace($string, ' | | | |[\.,]\s*$', ' '))
};

(:~
: Creates a permalink for a given ID
:
: @author Peter Stadler
: @param $docID the ID of the document
: @return xs:string
:)
declare function core:permalink($docID as xs:string) as xs:anyURI? {
xs:anyURI(config:get-option('permaLinkPrefix') || core:link-to-current-app($docID))
};
7 changes: 4 additions & 3 deletions webapp/modules/xho.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ declare function xho:createFooter($lang as xs:string, $docPath as xs:string) as
let $encryptedBugEmail := wega:encryptString(config:get-option('bugEmail'), ())
let $version := concat(config:get-option('version'), if($config:isDevelopment) then 'dev' else '')
let $versionDate := date:strfdate(xs:date(config:get-option('versionDate')), $lang, $dateFormat)
let $permalink := config:get-option('permaLinkPrefix') || core:link-to-current-app($docID)
let $permalink := core:permalink($docID)
return
if(exists($author) and exists($date)) then
<xhtml:div id="footer">
Expand Down Expand Up @@ -343,8 +343,9 @@ declare function xho:collectCommonMetaData($doc as document-node()?) as element(
<xhtml:meta name="DC.publisher" content="Carl-Maria-von-Weber-Gesamtausgabe"/>
<xhtml:meta name="DC.type" content="Text" scheme="DCTERMS.DCMIType"/>
<xhtml:meta name="DC.format" content="text/html" scheme="DCTERMS.IMT"/>
{$contributors}
<xhtml:meta name="DC.identifier" content="{concat(config:get-option('baseHref'), request:get-uri())}" scheme="DCTERMS.URI"/>
{$contributors,
if ($docID) then <xhtml:meta name="DC.identifier" content="{core:permalink($docID)}" scheme="DCTERMS.URI"/>
else ()}
</wega:metaData>
};
Expand Down

0 comments on commit 51143b5

Please sign in to comment.