Skip to content

Commit

Permalink
Endline with prop
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Dec 5, 2024
1 parent 50535dc commit 4015e7b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

<!-- example document chain -->
<docChain id="endline-fop" parent="shared">
<chainStep stepType="complex" template-path="${chainId}.ftl"/>
<chainStep stepType="complex" map-atts="labels" template-path="${chainId}.ftl"/>
</docChain>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
as a single line.</para>
<para white-space-collapse="preserve">This will be rendered
as two lines.</para>
<para white-space-collapse="preserve">${labels['endline.prop']}</para>

</body>

</doc>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
endline.prop = Test endline\nproperty
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test.testorg.fugerit.java.codesamplesfjdoc;

import org.fugerit.java.codesamplesfjdoc.DocHelper;
import org.fugerit.java.core.util.PropsIO;
import org.fugerit.java.doc.base.config.DocConfig;
import org.fugerit.java.doc.base.process.DocProcessContext;
import org.junit.jupiter.api.Assertions;
Expand All @@ -9,23 +10,21 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Properties;

class TestEndlineFop {

@Test
void test() throws IOException {
File outputFile = new File( "target/endline-fop.pdf" );
try ( FileOutputStream fos = new FileOutputStream( outputFile ) ) {
Properties labels = PropsIO.loadFromClassLoaderSafe( "config/label.properties" );
DocHelper docHelper = new DocHelper();
// create custom data for the fremarker template 'document.ftl'
List<DocHelperTest.People> listPeople = Arrays.asList( new DocHelperTest.People( "Luthien", "Tinuviel", "Queen" ), new DocHelperTest.People( "Thorin", "Oakshield", "King" ) );
// handler id
String handlerId = DocConfig.TYPE_PDF;
// output generation
docHelper.getDocProcessConfig().fullProcess( "endline-fop", DocProcessContext.newContext(), handlerId, fos );
docHelper.getDocProcessConfig().fullProcess( "endline-fop",
DocProcessContext.newContext( "labels", labels ), handlerId, fos );
Assertions.assertTrue( outputFile.exists() );
}
}
Expand Down

0 comments on commit 4015e7b

Please sign in to comment.