You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2020/10/11 20:13:48 UTC

[freemarker-generator] branch FREEMARKER-154 updated (72a9247 -> 0e42ba6)

This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a change to branch FREEMARKER-154
in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git.


    from 72a9247  FREEMARKER-154 Continued converting documentation to XDocbook. Cleaned up POM and docgen config a bit.
     new 9ee2bbc  FREEMARKER-154: Added option to demo.ftl to deduct potentially sensitive information, that we don't want to include in the documentation (the output is inserted into it).
     new 0e42ba6  FREEMARKER-154: Updated for newer Docgen

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/app/examples/templates/demo.ftl              | 20 +++++++++++++++++++-
 .../src/app/scripts/run-examples.bat                 |  2 +-
 .../src/app/scripts/run-examples.sh                  |  2 +-
 .../freemarker/generator/cli/ExamplesTest.java       |  2 +-
 .../src/main/docgen/book.xml                         |  8 ++++----
 5 files changed, 26 insertions(+), 8 deletions(-)


[freemarker-generator] 02/02: FREEMARKER-154: Updated for newer Docgen

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch FREEMARKER-154
in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git

commit 0e42ba6ef019cc7ad750578cfa7faf9a602d7ed3
Author: ddekany <dd...@apache.org>
AuthorDate: Sun Oct 11 22:10:53 2020 +0200

    FREEMARKER-154: Updated for newer Docgen
---
 freemarker-generator-website/src/main/docgen/book.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/freemarker-generator-website/src/main/docgen/book.xml b/freemarker-generator-website/src/main/docgen/book.xml
index 3c5ccd8..ac7439c 100644
--- a/freemarker-generator-website/src/main/docgen/book.xml
+++ b/freemarker-generator-website/src/main/docgen/book.xml
@@ -939,8 +939,8 @@ EDITOR ==&gt; vi</programlisting>
 
         <listitem>
           <para>Fragment: Used rarely for providing additional attributes,
-          e.g. <literal>mimeType</literal> of <literal>charset</literal>
-          </para>
+          e.g. <literal>mimeType</literal> of
+          <literal>charset</literal></para>
         </listitem>
       </orderedlist>
 
@@ -954,13 +954,13 @@ EDITOR ==&gt; vi</programlisting>
       fragment, e.g. the charset of the text file:</para>
 
       <programlisting>freemarker-generator -t freemarker-generator/info.ftl my_users=examples/data/csv/user.csv#charset=UTF-16
-[docgen.insertFile "@websitePomGenerated/named-uri-my_users-charset-fragment.txt" from="FreeMarker Generator DataSources" to="?FreeMarker Generator Parameters"]</programlisting>
+[docgen.insertFile "@websitePomGenerated/named-uri-my_users-charset-fragment.txt" from="FreeMarker Generator DataSources" toIfPresent="FreeMarker Generator Parameters"]</programlisting>
 
       <para>In addition to the simplified file syntax full URIs can be
       used:</para>
 
       <programlisting>freemarker-generator -t freemarker-generator/info.ftl http://google.com?foo=bar
-[docgen.insertFile "@websitePomGenerated/named-uri-example-no-name.txt" from="FreeMarker Generator DataSources" to="?FreeMarker Generator Parameters"]</programlisting>
+[docgen.insertFile "@websitePomGenerated/named-uri-example-no-name.txt" from="FreeMarker Generator DataSources" toIfPresent="FreeMarker Generator Parameters"]</programlisting>
     </section>
 
     <section xml:id="datasources">


[freemarker-generator] 01/02: FREEMARKER-154: Added option to demo.ftl to deduct potentially sensitive information, that we don't want to include in the documentation (the output is inserted into it).

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch FREEMARKER-154
in repository https://gitbox.apache.org/repos/asf/freemarker-generator.git

commit 9ee2bbc094aa980ece39a223f9c679be522fa049
Author: ddekany <dd...@apache.org>
AuthorDate: Sun Oct 11 20:28:15 2020 +0200

    FREEMARKER-154: Added option to demo.ftl to deduct potentially sensitive information, that we don't want to include in the documentation (the output is inserted into it).
---
 .../src/app/examples/templates/demo.ftl              | 20 +++++++++++++++++++-
 .../src/app/scripts/run-examples.bat                 |  2 +-
 .../src/app/scripts/run-examples.sh                  |  2 +-
 .../freemarker/generator/cli/ExamplesTest.java       |  2 +-
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/freemarker-generator-cli/src/app/examples/templates/demo.ftl b/freemarker-generator-cli/src/app/examples/templates/demo.ftl
index 8ec3ac4..e35e2a9 100644
--- a/freemarker-generator-cli/src/app/examples/templates/demo.ftl
+++ b/freemarker-generator-cli/src/app/examples/templates/demo.ftl
@@ -15,6 +15,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
+<#assign deductSensitiveInformation = (tools.system.parameters.deductSensitiveInformation!'false') != 'false'>
 1) FreeMarker Special Variables
 ---------------------------------------------------------------------------
 FreeMarker version     : ${.version}
@@ -74,14 +75,31 @@ user.home    : ${tools.system.systemProperties["user.home"]!""}
 9) List Environment Variables
 ---------------------------------------------------------------------------
 <#list tools.system.envs as name,value>
+<#if !deductSensitiveInformation
+    || ['BASEDIR', 'USERNAME', 'CLASSPATH', 'TEMP', 'JAVA_HOME']?seq_contains(name?upper_case)
+>
 - ${name} ==> ${value}<#lt>
+</#if>
 </#list>
+<#if deductSensitiveInformation>
+[...]
+Some items were deducted!
+</#if>
 
 10) List System Properties
 ---------------------------------------------------------------------------
-<#list tools.system.systemProperties as name,value>
+<#list tools.system.systemProperties as name, value>
+<#if !deductSensitiveInformation
+    || ['app.dir', 'app.home', 'app.pid', 'basedir', 'java.version', 'user.home', 'user.dir', 'user.name', 'user.timezone'
+        'file.separator', 'java.class.path', 'java.home']?seq_contains(name)
+>
 - ${name} ==> ${value}<#lt>
+</#if>
 </#list>
+<#if deductSensitiveInformation>
+[...]
+Some items were deducted!
+</#if>
 
 11) Access DataSources
 ---------------------------------------------------------------------------
diff --git a/freemarker-generator-cli/src/app/scripts/run-examples.bat b/freemarker-generator-cli/src/app/scripts/run-examples.bat
index c472333..7d92ef5 100644
--- a/freemarker-generator-cli/src/app/scripts/run-examples.bat
+++ b/freemarker-generator-cli/src/app/scripts/run-examples.bat
@@ -35,7 +35,7 @@ REM Demo
 REM =========================================================================
 
 echo "examples\templates\demo.ftl"
-%FREEMARKER_CMD% -t examples\templates\demo.ftl README.md --output-encoding CP1252 > target\out\demo.txt
+%FREEMARKER_CMD% -t examples\templates\demo.ftl --output-encoding CP1252 -PdeductSensitiveInformation=true  README.md > target\out\demo.txt
 
 REM =========================================================================
 REM Interactive Mode
diff --git a/freemarker-generator-cli/src/app/scripts/run-examples.sh b/freemarker-generator-cli/src/app/scripts/run-examples.sh
index 89f86e7..5063fe9 100755
--- a/freemarker-generator-cli/src/app/scripts/run-examples.sh
+++ b/freemarker-generator-cli/src/app/scripts/run-examples.sh
@@ -40,7 +40,7 @@ $FREEMARKER_CMD -t freemarker-generator/info.ftl README.md > target/out/info.txt
 #############################################################################
 
 echo "examples/templates/demo.ftl"
-$FREEMARKER_CMD -t examples/templates/demo.ftl README.md > target/out/demo.txt || { echo >&2 "Test failed.  Aborting."; exit 1; }
+$FREEMARKER_CMD -t examples/templates/demo.ftl -PdeductSensitiveInformation=true README.md > target/out/demo.txt || { echo >&2 "Test failed.  Aborting."; exit 1; }
 
 #############################################################################
 # Interactive Mode
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 a2e7c79..9c7f2e0 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
@@ -44,7 +44,7 @@ public class ExamplesTest extends AbstractMainTest {
 
     @Test
     public void shouldRunDemoExamples() throws IOException {
-        assertValid(execute("-t src/app/examples/templates/demo.ftl README.md"));
+        assertValid(execute("-t src/app/examples/templates/demo.ftl -PdeductSensitiveInformation=true README.md"));
     }
 
     @Test