NIHVIVO-1610 Extracted datetime code in propStatement templates into a macro.

This commit is contained in:
rjy7 2011-01-06 21:19:42 +00:00
parent 3b95c44b39
commit 28a2be38bc

View file

@ -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.
@ -18,3 +49,5 @@
<#function xsdDateTimeToYear datetime>
<#return datetime?date("yyyy")?string("yyyy") >
</#function>