This is an automated email from the ASF dual-hosted git repository. sgoeschl pushed a commit to branch FREEMARKER-188 in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git
commit ff7ca34e58169d7439daee51427914b487b9db4a Author: Siegfried Goeschl <[email protected]> AuthorDate: Tue Sep 7 23:08:35 2021 +0200 FREEMARKER-188 Improve "freemarker-generator/info.ftl" --- .../templates/freemarker-generator/datasources.ftl | 40 --------- .../app/templates/freemarker-generator/info.ftl | 96 +++++++++++++--------- .../freemarker/generator/cli/ExamplesTest.java | 1 - 3 files changed, 58 insertions(+), 79 deletions(-) diff --git a/freemarker-generator-cli/src/app/templates/freemarker-generator/datasources.ftl b/freemarker-generator-cli/src/app/templates/freemarker-generator/datasources.ftl deleted file mode 100644 index 17dc43c..0000000 --- a/freemarker-generator-cli/src/app/templates/freemarker-generator/datasources.ftl +++ /dev/null @@ -1,40 +0,0 @@ -<#ftl output_format="plainText" strip_whitespace=true> -<#-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -FreeMarker Generator DataSources -============================================================================== - -<#if dataSources?has_content> -<#list dataSources?values as ds> -DataSource #${ds?counter} ------------------------------------------------------------------------------- -name=${ds.name} -group=${ds.group} -contentType=${ds.contentType} -fileName=${ds.fileName} -baseName=${ds.baseName} -extension=${ds.extension} -relativeFilePath=${ds.relativeFilePath} -charset=${ds.charset} -mimeType=${ds.mimeType} -uri=charset=${ds.uri} -length=${ds.length} Bytes - -</#list> -<#else> -No data sources found ... -</#if> diff --git a/freemarker-generator-cli/src/app/templates/freemarker-generator/info.ftl b/freemarker-generator-cli/src/app/templates/freemarker-generator/info.ftl index 487f650..388bd85 100644 --- a/freemarker-generator-cli/src/app/templates/freemarker-generator/info.ftl +++ b/freemarker-generator-cli/src/app/templates/freemarker-generator/info.ftl @@ -1,22 +1,23 @@ <#ftl output_format="plainText" strip_whitespace=true> <#-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. --> FreeMarker Generator Information ------------------------------------------------------------------------------- +============================================================================== + FreeMarker version : ${.version} Template name : ${.current_template_name} Language : ${.lang} @@ -26,49 +27,68 @@ Output encoding : ${.output_encoding} Output format : ${.output_format} FreeMarker Command-line Parameters ------------------------------------------------------------------------------- +============================================================================== + <#list tools.system.getCommandLineArgs() as arg> -[#${arg?counter}] ${arg} + [#${arg?counter}] ${arg} </#list> FreeMarker Generator Template Loader Directories ------------------------------------------------------------------------------- +============================================================================== + <#list tools.system.getTemplateDirectories() as directory> -[#${directory?counter}] ${directory} + [#${directory?counter}] ${directory} </#list> FreeMarker Generator Data Model ---------------------------------------------------------------------------- +============================================================================== + <#list .data_model?keys?sort as key> -- ${key}<#lt> + - ${key}<#lt> </#list> -FreeMarker Generator DataSources ------------------------------------------------------------------------------- +FreeMarker Generator Data Sources +============================================================================== <#if dataSources?has_content> -<#list dataSources?values as ds> -[#${ds?counter}]: name=${ds.name}, group=${ds.group}, fileName=${ds.fileName}, mimeType=${ds.mimeType}, charset=${ds.charset}, length=${ds.length} Bytes -</#list> + <#list dataSources?values as ds> + + DataSource #${ds?counter} + ------------------------------------------------------------------------------ + name=${ds.name} + group=${ds.group} + contentType=${ds.contentType} + fileName=${ds.fileName} + baseName=${ds.baseName} + extension=${ds.extension} + relativeFilePath=${ds.relativeFilePath} + charset=${ds.charset} + mimeType=${ds.mimeType} + uri=${ds.uri} + length=${ds.length} Bytes + </#list> <#else> -No data sources found ... + + No data sources found ... </#if> FreeMarker Generator Parameters ------------------------------------------------------------------------------- +============================================================================== + <#if tools.system.parameters?has_content> -<#list tools.system.parameters as key,value> -<#if value?is_hash> -- ${key} ==> { <#list value as name,value>${name}=${value} </#list>} -<#else> -- ${key} ==> ${value} -</#if> -</#list> + <#list tools.system.parameters as key,value> + <#if value?is_hash> + - ${key} ==> { <#list value as name,value>${name}=${value} </#list>} + <#else> + - ${key} ==> ${value} + </#if> + </#list> <#else> -No parameters found ... + No parameters found ... </#if> FreeMarker Generator Tools ------------------------------------------------------------------------------- +============================================================================== + <#list tools?keys?sort as name> -- ${name?right_pad(20)} : ${tools[name]} + - ${name?right_pad(20)} : ${tools[name]} </#list> diff --git a/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java b/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java index d14b57a..49e536f 100644 --- a/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java +++ b/freemarker-generator-cli/src/test/java/org/apache/freemarker/generator/cli/ExamplesTest.java @@ -49,7 +49,6 @@ public class ExamplesTest extends AbstractMainTest { @Test public void shouldRunDataSourceExamples() throws IOException { - assertValid(execute("-t freemarker-generator/datasources.ftl .")); assertValid(execute("-t src/app/examples/templates/datasources.ftl -s :csv=src/app/examples/data/csv")); }
