Documentation for the Freemarker function libs provided by ccm-themedirectory

git-svn-id: https://svn.libreccm.org/ccm/trunk@6279 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-10-21 18:49:39 +00:00
parent 717e51d750
commit 404b91129e
2 changed files with 36 additions and 4 deletions

View File

@ -6,7 +6,8 @@
>
<#---
Retrieves the languages in which the content of the current page is available.
Retrieves the languages in which the content of the current page is
available.
@return A sequence of the available languages (as ISO language codes)
#-->

View File

@ -5,26 +5,46 @@
"ui": "http://www.arsdigita.com/ui/1.0"}
>
<#--
Gets the application of the page served from the model
<#---
Gets the application of the page served from the model.
@return The current application.
-->
<#function getPageApplication>
<#return model["/bebop:page/@application"]>
</#function>
<#---
Get the title of the current page.
This will only work of the current page is a navigation page with a category
menu.
@return The title of the current page
-->
<#function getPageTitle>
<#return model["//nav:categoryMenu/nav:category/@title"]>
</#function>
<#---
Get the hostname from the sitebanner data.
-->
<#function getSiteHostName>
<#return model["/bebop:page/ui:siteBanner/@hostname"]>
</#function>
<#---
Get the name of the site from the sitebanner data.
-->
<#function getSiteName>
<#return model["/bebop:page/ui:siteBanner/@sitename"]>
</#function>
<#-- Internal function -->
<#--
Internal function. Not for public use.
Internal function for coverting several string values like `yes`, `true`,
`no` etc. to a boolean value.
-->
<#function getBooleanAttrValue fromNode attrName>
<#assign path='@' + attrName>
<#if (fromNode[path]?size > 0)>
@ -35,6 +55,17 @@
</#if>
</#function>
<#---
A wrapper for the `_formatDateTime` function which adds missing numbers.
`_formatDateTime` uses Java APIs for formatting which don't work well with
incomplete dates. This function takes a date from the data model and checks
if a component (year, month, day, hour, minute, second) is missing. If the
the component is missing the function adds uses a default value of that
component.
@param style The date format style from the theme manifest to use.
@param date the date to format.
-->
<#function formatDateTime style date>
<#assign year = (date["./@year"]?size > 0)?then(date["./@year"]?number, 0)>
<#assign month = (date["./@month"]?size > 0)?then(date["./@month"]?number, 0)>