Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for different authors in the URL, closes #316 #333

Merged
merged 13 commits into from
Nov 28, 2019
Prev Previous commit
Next Next commit
fix breadcrumb for authors without key #316
  • Loading branch information
peterstadler committed Nov 14, 2019
commit 7f530c727308d11a2e4ed1f93965c5065bf7cf2c
14 changes: 7 additions & 7 deletions modules/app.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ declare function app:set-line-wrap($node as node(), $model as map(*)) as element
declare
%templates:default("lang", "en")
function app:breadcrumb-person($node as node(), $model as map(*), $lang as xs:string) as element(a) {
let $authorElem := query:get-author-element($model?doc)[(@key, @dbkey) = tokenize($model?('exist:path'), '/')]
let $authorID :=
if(config:is-person($model('docID'))) then $model('docID')
else $authorElem/(@key, @dbkey)
let $authorID := tokenize($model?('exist:path'), '/')[3]
let $anonymusID := config:get-option('anonymusID')
let $authorElem :=
if ($authorID = $anonymusID) then query:get-author-element($model?doc)[count((@key | @dbkey) = 0) or ((@key, @dbkey) = $anonymusID)]
else query:get-author-element($model?doc)[(@key, @dbkey) = $authorID]
let $href :=
if ($authorID = config:get-option('anonymusID')) then ()
else if($authorID) then app:createUrlForDoc(core:doc($authorID), $lang)
else ()
if ($authorID = $anonymusID) then ()
else app:createUrlForDoc(core:doc($authorID), $lang)
let $elem :=
if($href) then QName('http://www.w3.org/1999/xhtml', 'a')
else QName('http://www.w3.org/1999/xhtml', 'span')
Expand Down