Skip to content

Commit 50535dc

Browse files
committed
white-space-collapse preserve
1 parent 7403caf commit 50535dc

File tree

8 files changed

+123
-0
lines changed

8 files changed

+123
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package test.org.fugerit.java.code.samples.lang;
2+
3+
public class Impl implements Interface1, Interface2 {
4+
5+
@Override
6+
public int method1() {
7+
return 1;
8+
}
9+
10+
@Override
11+
public int method2() {
12+
return 2;
13+
}
14+
15+
@Override
16+
public String test() {
17+
return Interface1.super.test();
18+
}
19+
20+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package test.org.fugerit.java.code.samples.lang;
2+
3+
public interface Interface1 {
4+
5+
int method1();
6+
7+
default String test() {
8+
return Interface1.class.getSimpleName();
9+
}
10+
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package test.org.fugerit.java.code.samples.lang;
2+
3+
public interface Interface2 {
4+
5+
int method2();
6+
7+
default String test() {
8+
return Interface2.class.getSimpleName();
9+
}
10+
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package test.org.fugerit.java.code.samples.lang;
2+
3+
public class TestInterface {
4+
}

code-samples-fj-doc/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@
5050
<groupId>org.fugerit.java</groupId>
5151
<artifactId>fj-doc-freemarker</artifactId>
5252
</dependency>
53+
<dependency>
54+
<groupId>org.fugerit.java</groupId>
55+
<artifactId>fj-doc-mod-fop</artifactId>
56+
</dependency>
5357
</dependencies>
5458
</project>

code-samples-fj-doc/src/main/resources/code-samples-fj-doc/fm-doc-process-config.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
<docHandler id="html-fm" info="html" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerEscapeUTF8" />
2222
<!-- Type handler for html using freemarker (fragment version, only generates body content no html or head part -->
2323
<docHandler id="html-fragment-fm" info="fhtml" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlFragmentTypeHandlerEscapeUTF8" />
24+
<!-- Simple default PDF FOP Type handler with no added configuration -->
25+
<docHandler id="pdf-fop" info="pdf" type="org.fugerit.java.doc.mod.fop.PdfFopTypeHandler"/>
2426
</docHandlerConfig>
2527

2628
<docChain id="shared">
@@ -55,4 +57,10 @@
5557
<chainStep stepType="complex" map-atts="params" template-path="${chainId}.ftl"/>
5658
</docChain>
5759

60+
<!-- example document chain -->
61+
<docChain id="endline-fop" parent="shared">
62+
<chainStep stepType="complex" template-path="${chainId}.ftl"/>
63+
</docChain>
64+
65+
5866
</freemarker-doc-process-config>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
<metadata>
8+
<!-- Margin for document : left;right;top;bottom -->
9+
<info name="margins">10;10;10;30</info>
10+
<!-- documenta meta information -->
11+
<info name="doc-title">Endline fop example</info>
12+
<info name="doc-subject">fj doc venus sample source FreeMarker Template XML - ftlx</info>
13+
<info name="doc-author">fugerit79</info>
14+
<info name="doc-language">en</info>
15+
<!-- font must be loaded -->
16+
<info name="default-font-name">TitilliumWeb</info>
17+
<!-- property specific for xls/xlsx -->
18+
<info name="excel-table-id">data-table=print</info>
19+
<!-- property specific for csv -->
20+
<info name="csv-table-id">data-table</info>
21+
<footer-ext>
22+
<para align="right">${r"${currentPage}"} / ${r"${pageCount}"}</para>
23+
</footer-ext>
24+
</metadata>
25+
<body>
26+
<para>This will be rendered
27+
as a single line.</para>
28+
<para white-space-collapse="preserve">This will be rendered
29+
as two lines.</para>
30+
</body>
31+
32+
</doc>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package test.testorg.fugerit.java.codesamplesfjdoc;
2+
3+
import org.fugerit.java.codesamplesfjdoc.DocHelper;
4+
import org.fugerit.java.doc.base.config.DocConfig;
5+
import org.fugerit.java.doc.base.process.DocProcessContext;
6+
import org.junit.jupiter.api.Assertions;
7+
import org.junit.jupiter.api.Test;
8+
9+
import java.io.File;
10+
import java.io.FileOutputStream;
11+
import java.io.IOException;
12+
import java.util.Arrays;
13+
import java.util.Collection;
14+
import java.util.List;
15+
16+
class TestEndlineFop {
17+
18+
@Test
19+
void test() throws IOException {
20+
File outputFile = new File( "target/endline-fop.pdf" );
21+
try ( FileOutputStream fos = new FileOutputStream( outputFile ) ) {
22+
DocHelper docHelper = new DocHelper();
23+
// create custom data for the fremarker template 'document.ftl'
24+
List<DocHelperTest.People> listPeople = Arrays.asList( new DocHelperTest.People( "Luthien", "Tinuviel", "Queen" ), new DocHelperTest.People( "Thorin", "Oakshield", "King" ) );
25+
// handler id
26+
String handlerId = DocConfig.TYPE_PDF;
27+
// output generation
28+
docHelper.getDocProcessConfig().fullProcess( "endline-fop", DocProcessContext.newContext(), handlerId, fos );
29+
Assertions.assertTrue( outputFile.exists() );
30+
}
31+
}
32+
33+
}

0 commit comments

Comments
 (0)