new version of the template
This commit is contained in:
parent
53a60b110e
commit
987dc4f378
|
@ -6,15 +6,29 @@
|
||||||
<#assign tags=[]>
|
<#assign tags=[]>
|
||||||
<#assign extras=[]>
|
<#assign extras=[]>
|
||||||
|
|
||||||
|
<#function sanitizeString(value)>
|
||||||
|
<#if value??>
|
||||||
|
<#return value?trim?replace('\n','')?replace('\"','')>
|
||||||
|
</#if>
|
||||||
|
<#return "">
|
||||||
|
</#function>
|
||||||
|
|
||||||
|
<#function onlyAlphanumericString(value)>
|
||||||
|
<#if value??>
|
||||||
|
<#return value?trim?replace('\n','')?replace('\"','')?replace("[^\\w]+", "-", "r")>
|
||||||
|
</#if>
|
||||||
|
<#return "">
|
||||||
|
</#function>
|
||||||
|
|
||||||
<#-- Macro to assign Tags -->
|
<#-- Macro to assign Tags -->
|
||||||
<#macro assignTag in_tags>
|
<#macro assignTag in_tags>
|
||||||
<#if in_tags??>
|
<#if in_tags??>
|
||||||
<#if in_tags?is_sequence>
|
<#if in_tags?is_sequence>
|
||||||
<#list in_tags as my_tag>
|
<#list in_tags as my_tag>
|
||||||
<#assign tags = tags + [my_tag] />
|
<#assign tags = tags + [onlyAlphanumericString(my_tag)] />
|
||||||
</#list>
|
</#list>
|
||||||
<#else>
|
<#else>
|
||||||
<#assign tags = tags + [in_tags] />
|
<#assign tags = tags + [onlyAlphanumericString(in_tags)] />
|
||||||
</#if>
|
</#if>
|
||||||
</#if>
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
@ -26,7 +40,7 @@
|
||||||
<#assign description = ""/>
|
<#assign description = ""/>
|
||||||
</#if>
|
</#if>
|
||||||
<#if url??>
|
<#if url??>
|
||||||
<#assign resource = {"name": name, "url": url, "description": description, "format": format}>
|
<#assign resource = {"name": name, "url": url, "description": sanitizeString(description), "format": format}>
|
||||||
<#assign resources = resources + [resource]/>
|
<#assign resources = resources + [resource]/>
|
||||||
</#if>
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
@ -47,7 +61,11 @@
|
||||||
<#-- Macro to assign Extras field -->
|
<#-- Macro to assign Extras field -->
|
||||||
<#macro assignExtraField key value asObject>
|
<#macro assignExtraField key value asObject>
|
||||||
<#if key??>
|
<#if key??>
|
||||||
<#assign extra = {"key": key, "value": value, "asObject": asObject}>
|
<#assign checkedValue = value/>
|
||||||
|
<#if key != "spatial">
|
||||||
|
<#assign checkedValue = sanitizeString(value)/>
|
||||||
|
</#if>
|
||||||
|
<#assign extra = {"key": sanitizeString(key), "value": checkedValue, "asObject": asObject}>
|
||||||
<#assign extras = extras + [extra]/>
|
<#assign extras = extras + [extra]/>
|
||||||
</#if>
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
@ -120,17 +138,17 @@
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<#--
|
<#--
|
||||||
Starting document mapping to Catalogue
|
Starting document mapping to Catalogue
|
||||||
-->
|
-->
|
||||||
|
<#compress>
|
||||||
{
|
{
|
||||||
"name": "${jsonProj._id}",
|
"name": "${jsonProj._id}",
|
||||||
"title": "${theDocument.nome}",
|
"title": "${theDocument.nome}",
|
||||||
"license_id": "CC-BY-SA-4.0",
|
"license_id": "CC-BY-SA-4.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
<#assign description = theDocument.introduzione?trim />
|
<#assign sanitizedNotes = sanitizeString(theDocument.introduzione) />
|
||||||
<#assign sanitizedNotes = description?replace("\\n", "")>
|
|
||||||
"notes": "${sanitizedNotes}",
|
"notes": "${sanitizedNotes}",
|
||||||
|
|
||||||
<#--
|
<#--
|
||||||
|
@ -263,10 +281,10 @@ Starting document mapping to Catalogue
|
||||||
<#if theDocument.contestoIndagine??>
|
<#if theDocument.contestoIndagine??>
|
||||||
<#if theDocument.contestoIndagine?is_sequence>
|
<#if theDocument.contestoIndagine?is_sequence>
|
||||||
<#list theDocument.contestoIndagine as my_extra>
|
<#list theDocument.contestoIndagine as my_extra>
|
||||||
<@assignExtraField key="Definizione del contesto d'indagine" value=my_extra asObject=false></@assignExtraField>
|
<@assignExtraField key="Contesto Indagine" value=my_extra asObject=false></@assignExtraField>
|
||||||
</#list>
|
</#list>
|
||||||
<#else>
|
<#else>
|
||||||
<@assignExtraField key="Definizione del contesto d'indagine" value=theDocument.contestoIndagine asObject=false></@assignExtraField>
|
<@assignExtraField key="Contesto Indagine" value=theDocument.contestoIndagine asObject=false></@assignExtraField>
|
||||||
</#if>
|
</#if>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
@ -281,10 +299,10 @@ Starting document mapping to Catalogue
|
||||||
<#if theDocument.cronologiaMacrofase??>
|
<#if theDocument.cronologiaMacrofase??>
|
||||||
<#if theDocument.cronologiaMacrofase?is_sequence>
|
<#if theDocument.cronologiaMacrofase?is_sequence>
|
||||||
<#list theDocument.cronologiaMacrofase as my_extra>
|
<#list theDocument.cronologiaMacrofase as my_extra>
|
||||||
<@assignExtraField key="Cronologia (Macrofase)" value=my_extra asObject=false></@assignExtraField>
|
<@assignExtraField key="Cronologia Macrofase" value=my_extra asObject=false></@assignExtraField>
|
||||||
</#list>
|
</#list>
|
||||||
<#else>
|
<#else>
|
||||||
<@assignExtraField key="Cronologia (Macrofase)" value=theDocument.cronologiaMacrofase asObject=false></@assignExtraField>
|
<@assignExtraField key="Cronologia Macrofase" value=theDocument.cronologiaMacrofase asObject=false></@assignExtraField>
|
||||||
</#if>
|
</#if>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
@ -304,4 +322,4 @@ Starting document mapping to Catalogue
|
||||||
|
|
||||||
<@buildExtrasFields the_extras=extras></@buildExtrasFields>
|
<@buildExtrasFields the_extras=extras></@buildExtrasFields>
|
||||||
}
|
}
|
||||||
|
</#compress>
|
||||||
|
|
Loading…
Reference in New Issue