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 073ede04dd08387c9f104f9c429f6f7033fd94c1 Author: ddekany <[email protected]> AuthorDate: Fri Nov 13 22:39:38 2020 +0100 FREEMARKER-154 Continued converting documentation to XDocbook. --- freemarker-generator-website/pom.xml | 24 ++++++++++ .../src/main/docgen/book.xml | 54 +++++++++++++++++++--- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/freemarker-generator-website/pom.xml b/freemarker-generator-website/pom.xml index 97d4ad7..2d0a5fe 100644 --- a/freemarker-generator-website/pom.xml +++ b/freemarker-generator-website/pom.xml @@ -171,6 +171,30 @@ <outputFile>${docgenInsertedOutputsDirectory}/named-uri-example-no-name.txt</outputFile> </configuration> </execution> + <execution> + <id>named-uri-example-with-name</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>java</executable> + <arguments> + <argument>-classpath</argument> + <classpath/> + + <!-- Setting up things without calling the launcher scripts in app/bin: --> + <argument>-Dapp.home=${freemarkerGeneratorAppHome}</argument> + + <argument>org.apache.freemarker.generator.cli.Main</argument> + <argument>-t</argument> + <argument>freemarker-generator/info.ftl</argument> + <argument>page=http://google.com?foo=bar</argument> + </arguments> + <workingDirectory>${freemarkerGeneratorAppHome}</workingDirectory> + <outputFile>${docgenInsertedOutputsDirectory}/named-uri-example-with-name.txt</outputFile> + </configuration> + </execution> </executions> </plugin> <plugin> diff --git a/freemarker-generator-website/src/main/docgen/book.xml b/freemarker-generator-website/src/main/docgen/book.xml index ac7439c..377a1e4 100644 --- a/freemarker-generator-website/src/main/docgen/book.xml +++ b/freemarker-generator-website/src/main/docgen/book.xml @@ -947,26 +947,66 @@ EDITOR ==> vi</programlisting> <para>The following Named URI loads a <literal>user.csv</literal> and the data source is available as <literal>my_users</literal>:</para> - <programlisting>freemarker-generator -t freemarker-generator/info.ftl my_users=examples/data/csv/user.csv -[docgen.insertFile "@websitePomGenerated/named-uri-my_users-simple.txt" from="FreeMarker Generator DataSources"]</programlisting> + <programlisting>> freemarker-generator -t freemarker-generator/info.ftl my_users=examples/data/csv/user.csv +[docgen.insertFile "@websitePomGenerated/named-uri-my_users-simple.txt" from="FreeMarker Generator DataSources" toIfPresent=r"^\s*$"]</programlisting> <para>A Named URI allows to pass additional information as part of the 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" toIfPresent="FreeMarker Generator Parameters"]</programlisting> + <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" toIfPresent=r"^\s*$"]</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" toIfPresent="FreeMarker Generator Parameters"]</programlisting> + <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" toIfPresent=r"^\s*$"]</programlisting> + + <para>and also combined with a name:</para> + + <programlisting>> freemarker-generator -t freemarker-generator/info.ftl page=http://google.com?foo=bar +[docgen.insertFile "@websitePomGenerated/named-uri-example-with-name.txt" from="FreeMarker Generator DataSources" toIfPresent=r"^\s*$"]</programlisting> </section> <section xml:id="datasources"> <title>Data sources</title> - <para>TODO</para> + <para>A <literal>DataSource</literal> consists of lazy-loaded data + available in Apache FreeMarker's model (context) - it provides:</para> + + <itemizedlist> + <listitem> + <para>a <literal>charset</literal> for reading textual + content</para> + </listitem> + + <listitem> + <para>a <literal>content type</literal></para> + </listitem> + + <listitem> + <para>a <literal>name</literal> and a + <literal>group</literal></para> + </listitem> + + <listitem> + <para>access to textual content directly or using a line + iterator</para> + </listitem> + + <listitem> + <para>access to the data input stream</para> + </listitem> + </itemizedlist> + + <simplesect> + <title>Loading a <literal>DataSource</literal></title> + + <para>A <literal>DataSource</literal> can be loaded from the file + system, for example with a positional command line argument:</para> + + <programlisting/> + </simplesect> </section> <section>
