NIHVIVO-1610 Extracted datetime code in propStatement templates into a macro.
This commit is contained in:
parent
3b95c44b39
commit
28a2be38bc
1 changed files with 34 additions and 1 deletions
|
@ -8,6 +8,37 @@
|
|||
but not data extraction.
|
||||
-->
|
||||
|
||||
<#-- Macro yearInterval
|
||||
|
||||
Display a year interval in a property statement
|
||||
|
||||
Set endYearAsRange=false to display an end year without a start year without a preceding hyphen. The hyphen indicates that
|
||||
a range is expected but the start year is not provided (e.g., core:personInPosition); no hyphen indicates that
|
||||
a single date is typical (e.g., core:educationalTraining).
|
||||
-->
|
||||
|
||||
<#macro yearInterval startDateTime endDateTime endYearAsRange=true>
|
||||
<#local yearInterval>
|
||||
<#if startDateTime?has_content>
|
||||
<#local startYear = xsdDateTimeToYear(startDateTime)>
|
||||
</#if>
|
||||
<#if endDateTime?has_content>
|
||||
<#local endYear = xsdDateTimeToYear(endDateTime)>
|
||||
</#if>
|
||||
<#if startYear?? && endYear??>
|
||||
${startYear} - ${endYear}
|
||||
<#elseif startYear??>
|
||||
${startYear} -
|
||||
<#elseif endYear ??>
|
||||
<#if endYearAsRange>- </#if>${endYear}
|
||||
</#if>
|
||||
</#local>
|
||||
|
||||
<#if yearInterval?has_content>
|
||||
<span class="listDateTime">${yearInterval}</span>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#-- Function xsdDateTimeToYear
|
||||
|
||||
Display an XSD datetime string as a year.
|
||||
|
@ -17,4 +48,6 @@
|
|||
|
||||
<#function xsdDateTimeToYear datetime>
|
||||
<#return datetime?date("yyyy")?string("yyyy") >
|
||||
</#function>
|
||||
</#function>
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue