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/08/05 20:36:26 UTC
[freemarker-generator] branch FREEMARKER-154 updated:
FREEMARKER-154 Replaced content that's the output of some
freemarker-generator runs with dynamically generated content. Thus,
for example,
the output of --help that we show in the documentation will be always up to
date in the output.
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
The following commit(s) were added to refs/heads/FREEMARKER-154 by this push:
new 1f16fc5 FREEMARKER-154 Replaced content that's the output of some freemarker-generator runs with dynamically generated content. Thus, for example, the output of --help that we show in the documentation will be always up to date in the output.
1f16fc5 is described below
commit 1f16fc57e9ec47f49f8416177a44989fd9f7fb29
Author: ddekany <dd...@apache.org>
AuthorDate: Wed Aug 5 22:36:20 2020 +0200
FREEMARKER-154 Replaced content that's the output of some freemarker-generator runs with dynamically generated content. Thus, for example, the output of --help that we show in the documentation will be always up to date in the output.
---
freemarker-generator-website/pom.xml | 53 ++++++++++++
.../src/main/docgen/book.xml | 95 +---------------------
.../src/main/docgen/docgen.cjson | 16 ++--
3 files changed, 67 insertions(+), 97 deletions(-)
diff --git a/freemarker-generator-website/pom.xml b/freemarker-generator-website/pom.xml
index abc6b13..b840bb7 100644
--- a/freemarker-generator-website/pom.xml
+++ b/freemarker-generator-website/pom.xml
@@ -35,16 +35,68 @@
<maven.compiler.target>1.8</maven.compiler.target>
<websiteOutputDirectory>${project.build.directory}/website</websiteOutputDirectory>
+ <docgenCustomVariableFileDirectory>${project.build.directory}/docgen-custom-variable-files</docgenCustomVariableFileDirectory>
+ <generatorTemplateDirectory>${project.basedir}/../freemarker-generator-cli/templates</generatorTemplateDirectory>
</properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.freemarker.generator</groupId>
+ <artifactId>freemarker-generator-cli</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generateCliHelp</id>
+ <phase>package</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>java</executable>
+ <arguments>
+ <argument>-classpath</argument>
+ <classpath/>
+ <argument>org.apache.freemarker.generator.cli.Main</argument>
+ <argument>--help</argument>
+ </arguments>
+ <outputFile>${docgenCustomVariableFileDirectory}/cli-help-output.txt</outputFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generateInfoTemplateOutput</id>
+ <phase>package</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>java</executable>
+ <arguments>
+ <argument>-classpath</argument>
+ <classpath/>
+ <argument>org.apache.freemarker.generator.cli.Main</argument>
+ <argument>-t</argument>
+ <argument>${generatorTemplateDirectory}/info.ftl</argument>
+ </arguments>
+ <outputFile>${docgenCustomVariableFileDirectory}/info-template-output.txt</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.freemarker.docgen</groupId>
<artifactId>freemarker-docgen-maven</artifactId>
<version>0.0.2-SNAPSHOT</version>
<executions>
<execution>
+ <id>docgen-transform</id>
<phase>package</phase>
<goals>
<goal>transform</goal>
@@ -54,6 +106,7 @@
<configuration>
<sourceDirectory>src/main/docgen</sourceDirectory>
<outputDirectory>${websiteOutputDirectory}</outputDirectory>
+ <customVariableFileDirectory>${docgenCustomVariableFileDirectory}</customVariableFileDirectory>
<customVariables>
<version>${project.version}</version>
</customVariables>
diff --git a/freemarker-generator-website/src/main/docgen/book.xml b/freemarker-generator-website/src/main/docgen/book.xml
index 4b4577d..94f0072 100644
--- a/freemarker-generator-website/src/main/docgen/book.xml
+++ b/freemarker-generator-website/src/main/docgen/book.xml
@@ -156,47 +156,7 @@ version=0.1.0-SNAPSHOT, time=2020-06-25T21:48:02+0200, commit=b320d00094be878908
below:</para>
<programlisting>> freemarker-cli -h
- Usage: freemarker-cli (-t=<templates> [-t=<templates>]... |
- -i=<interactiveTemplate>) [-hV] [--stdin] [-b=<baseDir>]
- [--config=<configFile>]
- [--data-source-exclude=<dataSourceExcludePattern>]
- [--data-source-include=<dataSourceIncludePattern>]
- [-e=<inputEncoding>] [-l=<locale>]
- [--output-encoding=<outputEncoding>] [--times=<times>]
- [-D=<String=String>]... [-m=<dataModels>]...
- [-o=<outputs>]... [-P=<String=String>]...
- [-s=<dataSources>]... [<sources>...]
- Apache FreeMarker CLI
- [<sources>...] data source files and/or directories
- -b, --basedir=<baseDir> additional template base directory
- --config=<configFile> FreeMarker CLI configuration file
- -D, --system-property=<String=String>
- set system property
- --data-source-exclude=<dataSourceExcludePattern>
- file exclude pattern for data sources
- --data-source-include=<dataSourceIncludePattern>
- file include pattern for data sources
- -e, --input-encoding=<inputEncoding>
- encoding of data source
- -h, --help Show this help message and exit.
- -i, --interactive=<interactiveTemplate>
- interactive template to process
- -l, --locale=<locale> locale being used for the output, e.g. 'en_US'
- -m, --data-model=<dataModels>
- data model used for rendering
- -o, --output=<outputs> output files or directories
- --output-encoding=<outputEncoding>
- encoding of output, e.g. UTF-8
- -P, --param=<String=String>
- set parameter
- -s, --data-source=<dataSources>
- data source used for rendering
- --stdin read data source from stdin
- -t, --template=<templates>
- templates to process
- --times=<times> re-run X times for profiling
- -V, --version Print version information and exit.
-</programlisting>
+[docgen.customVariables.cliHelpOutput]</programlisting>
</simplesect>
<simplesect>
@@ -207,56 +167,7 @@ version=0.1.0-SNAPSHOT, time=2020-06-25T21:48:02+0200, commit=b320d00094be878908
better understand Apache FreeMarker CLI.</para>
<programlisting>> freemarker-cli -t templates/info.ftl
-FreeMarker CLI Information
-------------------------------------------------------------------------------
-FreeMarker version : 2.3.30
-Template name : templates/info.ftl
-Language : en
-Locale : en_US
-Timestamp : Jun 26, 2020 10:44:15 AM
-Output encoding : UTF-8
-Output format : plainText
-
-FreeMarker CLI Template Loader Directories
-------------------------------------------------------------------------------
-[#1] /Users/sgoeschl/work/github/apache/freemarker-generator
-[#2] /Users/sgoeschl/.freemarker-cli
-[#3] /Applications/Java/freemarker-cli-2.0.0
-
-FreeMarker CLI Tools
-------------------------------------------------------------------------------
-- CSVTool : Process CSV files using Apache Commons CSV (see https://commons.apache.org/proper/commons-csv/)
-- DataFrameTool : Bridge to [nRo/DataFrame](https://github.com/nRo/DataFrame)
-- ExcelTool : Process Excels files (XLS, XLSX) using Apache POI (see https://poi.apache.org)
-- ExecTool : Execute command line tools using Apache Commons Exec (see https://commons.apache.org/proper/commons-exec/)
-- FreeMarkerTool : Expose advanced Apache FreeMarker classes
-- GrokTool : Process text files using Grok expressions (see https://github.com/thekrakken/java-grok)
-- GsonTool : Process JSON files using GSON (see https://github.com/google/gson)
-- JsonPathTool : Process JSON files using Java JSON Path (see https://github.com/json-path/JsonPath)
-- JsoupTool : Process HTML files using Jsoup (see https://jsoup.org)
-- PropertiesTool : Process JDK properties files
-- SystemTool : Expose System-related utility methods
-- UUIDTool : Create UUIDs
-- XmlTool : Process XML files using Apache FreeMarker (see https://freemarker.apache.org/docs/xgui.html)
-- YamlTool : Process YAML files using SnakeYAML(see https://bitbucket.org/asomov/snakeyaml/wiki/Home)
-
-FreeMarker CLI Data Model
----------------------------------------------------------------------------
-- CSVTool
-- DataFrameTool
-- DataSources
-- ExcelTool
-- ExecTool
-- FreeMarkerTool
-- GrokTool
-- GsonTool
-- JsonPathTool
-- JsoupTool
-- PropertiesTool
-- SystemTool
-- UUIDTool
-- XmlTool
-- YamlTool</programlisting>
+[docgen.customVariables.infoTemplateOutput]</programlisting>
<para>Above:</para>
@@ -443,7 +354,7 @@ FreeMarker CLI Data Model
</section>
<section xml:id="legal">
- <title>Legal matters</title>
+ <title>Legal</title>
<section xml:id="license">
<title>License</title>
diff --git a/freemarker-generator-website/src/main/docgen/docgen.cjson b/freemarker-generator-website/src/main/docgen/docgen.cjson
index ddca35e..1847f3d 100644
--- a/freemarker-generator-website/src/main/docgen/docgen.cjson
+++ b/freemarker-generator-website/src/main/docgen/docgen.cjson
@@ -22,9 +22,11 @@ onlineTrackerHTML: "docgen-misc/googleAnalytics.html"
cookieConsentScriptURL: "https://cdn.jsdelivr.net/npm/cookie-bar/cookiebar-latest.min.js"
searchKey: "003127866208504630097:arjqbv_znfw" // TODO Creat a seach key for the subdirectory
validation: {
- programlistingsRequireRole
+ // programlistingsRequireRole
// programlistingsRequireLanguage
- maximumProgramlistingWidth: 100
+ // maximumProgramlistingWidth: 100
+ // TODO: Remove this later, as we don't want autoid_${n}.html-s as output.
+ outputFilesCanUseAutoID
}
showXXELogo
@@ -91,7 +93,11 @@ socialLinks: {
"Stack Overflow": { class: "stack-overflow", href: "olink:newStackOverflowQuestion" }
}
-validation: {
- // TODO: Remove this later, as we don't want autoid_${n}.html-s as output.
- outputFilesCanUseAutoID
+customVariables: {
+ version: null // Must be set by the caller
+}
+
+customVariablesFromFiles: {
+ cliHelpOutput: cli-help-output.txt
+ infoTemplateOutput: info-template-output.txt
}