Skip to content

Commit f86c89a

Browse files
committed
fj-doc-maven-plugin 8.6.5
1 parent a93d65e commit f86c89a

File tree

6 files changed

+258
-43
lines changed

6 files changed

+258
-43
lines changed

code-samples-fj-doc/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# code-sample-fj-doc
2+
3+
My code samples for Fugerit Doc Venus.
4+
5+
Configured with command :
6+
7+
```shell
8+
mvn org.fugerit.java:fj-doc-maven-plugin:8.6.5:add
9+
```

code-samples-fj-doc/pom.xml

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,54 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
5-
<artifactId>code-samples-fj-doc</artifactId>
6-
7-
<parent>
8-
<groupId>org.fugerit.java</groupId>
9-
<artifactId>code-samples</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
11-
</parent>
12-
13-
<name>Fugerit Code Samples - Fugerit Venus</name>
14-
<description>My code samples.</description>
15-
16-
<licenses>
17-
<license>
18-
<name>Apache License, Version 2.0</name>
19-
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
20-
<distribution>repo</distribution>
21-
</license>
22-
</licenses>
23-
24-
<properties>
25-
</properties>
26-
27-
<scm>
28-
<connection>scm:git:git://github.com/fugerit-org/code-samples.git</connection>
29-
<developerConnection>scm:git:ssh://github.com/fugerit-org/code-samples.git</developerConnection>
30-
<url>https://github.com/fugerit-org/code-samples.git</url>
31-
<tag>HEAD</tag>
32-
</scm>
33-
34-
<dependencies>
35-
</dependencies>
36-
37-
<organization>
38-
<url>https://www.fugerit.org</url>
39-
<name>Fugerit</name>
40-
</organization>
41-
42-
<url>https://www.fugerit.org/</url>
43-
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.fugerit.java</groupId>
7+
<artifactId>code-samples</artifactId>
8+
<version>1.0.0-SNAPSHOT</version>
9+
</parent>
10+
<artifactId>code-samples-fj-doc</artifactId>
11+
<name>Fugerit Code Samples - Fugerit Venus</name>
12+
<description>My code samples.</description>
13+
<url>https://www.fugerit.org/</url>
14+
<organization>
15+
<name>Fugerit</name>
16+
<url>https://www.fugerit.org</url>
17+
</organization>
18+
<licenses>
19+
<license>
20+
<name>Apache License, Version 2.0</name>
21+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
22+
<distribution>repo</distribution>
23+
</license>
24+
</licenses>
25+
<scm>
26+
<connection>scm:git:git://github.com/fugerit-org/code-samples.git</connection>
27+
<developerConnection>scm:git:ssh://github.com/fugerit-org/code-samples.git</developerConnection>
28+
<url>https://github.com/fugerit-org/code-samples.git</url>
29+
</scm>
30+
<properties>
31+
<fj-doc-version>8.6.5</fj-doc-version>
32+
</properties>
33+
<dependencyManagement>
34+
<dependencies>
35+
<dependency>
36+
<groupId>org.fugerit.java</groupId>
37+
<artifactId>fj-doc</artifactId>
38+
<version>${fj-doc-version}</version>
39+
<type>pom</type>
40+
<scope>import</scope>
41+
</dependency>
42+
</dependencies>
43+
</dependencyManagement>
44+
<dependencies>
45+
<dependency>
46+
<groupId>org.fugerit.java</groupId>
47+
<artifactId>fj-doc-base</artifactId>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.fugerit.java</groupId>
51+
<artifactId>fj-doc-freemarker</artifactId>
52+
</dependency>
53+
</dependencies>
4454
</project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.fugerit.java.codesamplesfjdoc;
2+
3+
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig;
4+
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
5+
6+
/**
7+
* DocHelper, version : auto generated on 2024-08-23 22:54:48.183
8+
*/
9+
public class DocHelper {
10+
11+
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://code-samples-fj-doc/fm-doc-process-config.xml" );
12+
13+
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
14+
15+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package org.fugerit.java.codesamplesfjdoc;
2+
3+
import org.fugerit.java.doc.base.config.DocConfig;
4+
import org.fugerit.java.doc.base.process.DocProcessContext;
5+
6+
import java.io.ByteArrayOutputStream;
7+
import java.nio.charset.StandardCharsets;
8+
import java.util.Arrays;
9+
import java.util.List;
10+
11+
/**
12+
* This is a basic example of Fugerit Venus Doc usage,
13+
* running this main the program will :
14+
* - creates data to be used in document model
15+
* - renders the 'document.ftl' template
16+
* - print the result in markdown format on the stanndard output
17+
*
18+
* For further documentation :
19+
* https://github.com/fugerit-org/fj-doc
20+
*
21+
* NOTE: This is a 'Hello World' style example, adapt it to your scenario, especially :
22+
* - remove system out and system err with your logging system
23+
* - change the doc handler and the output mode (here a ByteArrayOutputStream buffer is used)
24+
*/
25+
public class DocHelperExample {
26+
27+
public static void main(String[] args) {
28+
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
29+
// creates the doc helper
30+
DocHelper docHelper = new DocHelper();
31+
// create custom data for the fremarker template 'document.ftl'
32+
List<People> listPeople = Arrays.asList( new DocHelperExample.People( "Luthien", "Tinuviel", "Queen" ), new DocHelperExample.People( "Thorin", "Oakshield", "King" ) );
33+
// handler id
34+
String handlerId = DocConfig.TYPE_MD;
35+
// output generation
36+
docHelper.getDocProcessConfig().fullProcess( "document", DocProcessContext.newContext( "listPeople", listPeople ), handlerId, baos );
37+
// print the output
38+
System.out.println( "html output : \n"+ new String( baos.toByteArray(), StandardCharsets.UTF_8 ) );
39+
} catch (Exception e) {
40+
e.printStackTrace();
41+
}
42+
}
43+
44+
/*
45+
* Class used to wrap data to be rendered in the document template
46+
*/
47+
public static class People {
48+
49+
private String name;
50+
51+
private String surname;
52+
53+
private String title;
54+
55+
public People(String name, String surname, String title) {
56+
this.name = name;
57+
this.surname = surname;
58+
this.title = title;
59+
}
60+
61+
public String getName() {
62+
return name;
63+
}
64+
65+
public String getSurname() {
66+
return surname;
67+
}
68+
69+
public String getTitle() {
70+
return title;
71+
}
72+
}
73+
74+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<freemarker-doc-process-config
3+
xmlns="https://freemarkerdocprocess.fugerit.org"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://freemarkerdocprocess.fugerit.org https://www.fugerit.org/data/java/doc/xsd/freemarker-doc-process-1-0.xsd" >
6+
7+
<!--
8+
Documentation :
9+
https://venusguides.fugerit.org/
10+
11+
Configuration reference :
12+
https://venusdocs.fugerit.org/fj-doc-freemarker/src/main/docs/fdp_xsd_config_ref.html
13+
-->
14+
15+
<docHandlerConfig registerById="true">
16+
<!-- Type handler for markdown format -->
17+
<docHandler id="md-ext" info="md" type="org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownExtTypeHandler" />
18+
<!-- Type henalder for xml format, generates the source xml:doc -->
19+
<docHandler id="xml-doc" info="xml" type="org.fugerit.java.doc.base.config.DocTypeHandlerXMLUTF8" />
20+
<!-- Type handler for html using freemarker -->
21+
<docHandler id="html-fm" info="html" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerEscapeUTF8" />
22+
<!-- Type handler for html using freemarker (fragment version, only generates body content no html or head part -->
23+
<docHandler id="html-fragment-fm" info="fhtml" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlFragmentTypeHandlerEscapeUTF8" />
24+
</docHandlerConfig>
25+
26+
<docChain id="shared">
27+
<chainStep stepType="config">
28+
<config
29+
id="fj_doc_config_fm_codesamplesfjdoc"
30+
class="org.fugerit.java.codesamplesfjdoc.DocHelper"
31+
exception-handler="RETHROW_HANDLER"
32+
fallback-on-null-loop-variable="false"
33+
log-exception="false"
34+
mode="class"
35+
path="/code-samples-fj-doc/template/"
36+
version="2.3.33"
37+
wrap-unchecked-exceptions="true"
38+
load-bundled-functions="true"
39+
/>
40+
</chainStep>
41+
</docChain>
42+
43+
<!-- example document chain -->
44+
<docChain id="document" parent="shared">
45+
<chainStep stepType="complex" map-atts="listPeople" template-path="${chainId}.ftl"/>
46+
</docChain>
47+
48+
</freemarker-doc-process-config>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<doc
3+
xmlns="http://javacoredoc.fugerit.org"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-1.xsd" >
6+
7+
<#--
8+
This is a Venus Fugerit Doc (https://github.com/fugerit-org/fj-doc) FreeMarker Template XML (ftl[x]).
9+
For consideration of Venus Fugerit Doc and Apache FreeMarker integration see :
10+
https://venusguides.fugerit.org/src/docs/common/doc_format_freemarker.html
11+
The result will be a :
12+
-->
13+
<!--
14+
This is a Venus Fugerit Doc (https://github.com/fugerit-org/fj-doc) XML Source Document.
15+
For documentation on how to write a valid Venus Doc XML Meta Model refer to :
16+
https://venusguides.fugerit.org/src/docs/common/doc_format_summary.html
17+
-->
18+
19+
<#assign defaultTitle="My sample title">
20+
21+
<metadata>
22+
<!-- Margin for document : left;right;top;bottom -->
23+
<info name="margins">10;10;10;30</info>
24+
<!-- documenta meta information -->
25+
<info name="doc-title">${docTitle!defaultTitle}</info>
26+
<info name="doc-subject">fj doc venus sample source FreeMarker Template XML - ftlx</info>
27+
<info name="doc-author">fugerit79</info>
28+
<info name="doc-language">en</info>
29+
<!-- font must be loaded -->
30+
<info name="default-font-name">TitilliumWeb</info>
31+
<!-- property specific for xls/xlsx -->
32+
<info name="excel-table-id">data-table=print</info>
33+
<!-- property specific for csv -->
34+
<info name="csv-table-id">data-table</info>
35+
<footer-ext>
36+
<para align="right">${r"${currentPage}"} / ${r"${pageCount}"}</para>
37+
</footer-ext>
38+
</metadata>
39+
<body>
40+
<para>${docTitle!defaultTitle}</para>
41+
<table columns="3" colwidths="30;30;40" width="100" id="data-table" padding="2">
42+
<row header="true">
43+
<cell align="center"><para>Name</para></cell>
44+
<cell align="center"><para>Surname</para></cell>
45+
<cell align="center"><para>Title</para></cell>
46+
</row>
47+
<#if listPeople??>
48+
<#list listPeople as current>
49+
<row>
50+
<cell><para>${current.name}</para></cell>
51+
<cell><para>${current.surname}</para></cell>
52+
<cell><para>${current.title}</para></cell>
53+
</row>
54+
</#list>
55+
</#if>
56+
</table>
57+
</body>
58+
59+
</doc>

0 commit comments

Comments
 (0)