Skip to content

Commit

Permalink
promoting creation date, closes #219
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Mar 21, 2018
1 parent 08e3635 commit fa20cf7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
14 changes: 7 additions & 7 deletions modules/app.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ declare
function app:doc-details($node as node(), $model as map(*)) as map(*) {
map {
'hasFacsimile' := exists(query:facsimile($model?doc)),
'hasCreation' := exists($model?doc//tei:creation),
'xml-download-url' := replace(app:createUrlForDoc($model('doc'), $model('lang')), '\.html', '.xml'),
'thematicCommentaries' := $model('doc')//tei:note[@type='thematicCom']/@target,
'backlinks' := wdt:backlinks(())('filter-by-person')($model?docID)
Expand Down Expand Up @@ -1358,13 +1359,11 @@ declare

declare
%templates:default("lang", "en")
function app:print-creation($node as node(), $model as map(*), $lang as xs:string) as element(p) {
let $creation := wega-util:transform($model('doc')//tei:creation, doc(concat($config:xsl-collection-path, '/editorial.xsl')), config:get-xsl-params(()))
return
element p {
if(exists($creation)) then $creation
else '–'
}
%templates:wrap
function app:print-creation($node as node(), $model as map(*), $lang as xs:string) as item()* {
if($model?hasCreation and $model('result-page-entry')) then wega-util:txtFromTEI($model('doc')//tei:creation)
else if($model?hasCreation) then wega-util:transform($model('doc')//tei:creation, doc(concat($config:xsl-collection-path, '/editorial.xsl')), config:get-xsl-params(()))
else '–'
};

declare
Expand Down Expand Up @@ -1515,6 +1514,7 @@ declare
map {
'doc' := $model('result-page-entry'),
'docID' := $model('result-page-entry')/root()/*/data(@xml:id),
'hasCreation' := exists($model('result-page-entry')//tei:creation),
'relators' := $model('result-page-entry')//mei:fileDesc/mei:titleStmt/mei:respStmt/mei:persName[@role] | query:get-author-element($model('result-page-entry')),
'biblioType' := $model('result-page-entry')/tei:biblStruct/data(@type),
'workType' := $model('result-page-entry')//mei:term/data(@classcode)
Expand Down
3 changes: 2 additions & 1 deletion modules/query.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ declare function query:get-normalized-date($doc as document-node()) as xs:date?
let $docID := $doc/*/data(@xml:id)
let $date :=
switch(config:get-doctype-by-id($docID))
case 'writings' return date:getOneNormalizedDate(query:get-main-source($doc)/tei:monogr/tei:imprint/tei:date, true())
(: for Weber writings the creation date should take precedence over the publication date :)
case 'writings' return date:getOneNormalizedDate(($doc[query:get-authorID(.) = 'A002068']//tei:creation/tei:date[@* except @cert],query:get-main-source($doc)/tei:monogr/tei:imprint/tei:date)[1], true())
case 'letters' return date:getOneNormalizedDate(($doc//tei:correspAction[@type='sent']/tei:date, $doc//tei:correspAction[@type='received']/tei:date)[1], true())
case 'biblio' return date:getOneNormalizedDate($doc//tei:imprint[1]/tei:date, true())
case 'diaries' return $doc/tei:ab/data(@n)
Expand Down
4 changes: 3 additions & 1 deletion templates/document.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ <h3 data-template="lang:translate" class="media-heading">generalRemark</h3>

<div data-template="app-shared:if-matches" data-template-key="docType" data-template-value="writings documents">
<h3 data-template="lang:translate" class="media-heading">creation</h3>
<div data-template="app:print-creation"/>
<div>
<p data-template="app:print-creation"/>
</div>
</div>

<div>
Expand Down
4 changes: 4 additions & 0 deletions templates/includes/preview-writings.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ <h3 class="media-heading">
Allgemeine Musikalische Zeitung (13.
September 1809)
</p>
<p data-template="app-shared:if-exists" data-template-key="hasCreation">
<strong><span data-template="lang:translate">creation</span>:</strong>
<span data-template="app:print-creation">vor 1800</span>
</p>
<p>
<strong><span data-template="lang:translate">identifier</span>:</strong>
<span data-template="app-shared:print" data-template-key="docID">A030043</span>
Expand Down

0 comments on commit fa20cf7

Please sign in to comment.