Skip to content

426 bug fj mod doc fop error if a element phrase is inside a cell #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [CHORE]: 'direct' goal + 'add' / 'init' configure support for extra modules <https://github.com/fugerit-org/fj-doc/pull/424>

### Fixed

- [BUG]: [fj-mod-doc-fop] error if a element 'phrase' is inside a 'cell' <https://github.com/fugerit-org/fj-doc/pull/426>

## [8.13.9] - 2025-04-28

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<fo:table-cell<#if (cell.backColor??)> background-color="${cell.backColor}" </#if><@addCssValue name='padding' value=docTable.padding def=0 unit='mm'/><@addCssValue name='margin' value=docTable.padding def=0 unit='mm'/><@handleAlign alignValue=cell.align/><@handleVerticalAlign valignValue=cell.valign/><@handleBorders docBorders=cell.docBorders/><@handleCellSpan cell=cell/>>
<#if (cell.elementList?size > 0)>
<#list cell.elementList as cellElement>
<@handleElement current=cellElement/>
<#if cellElement.class.simpleName = 'DocPhrase'><fo:block><@handleElement current=cellElement/></fo:block><o></o><#else><@handleElement current=cellElement/></#if>
</#list>
<#else>
<fo:block></fo:block>
Expand Down
9 changes: 7 additions & 2 deletions fj-doc-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@
<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc-lib-simpletable</artifactId>
</dependency>

</dependency>

<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc-lib-direct</artifactId>
</dependency>

<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc-mod-openpdf-ext</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
docTitle: 'Issue 426 POC'
listSample:
- field1: 1
field2: 'test a'
- field1: 2
field2: 'test b'
- field1: 3
field2: 'test c'
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
configId: 'venus-direct-config-sample'
templatePath: '${projectBasedir}/src/main/resources/venus-config-direct/venus-template/'
templateMode: 'folder'
createParentDirectory: true
handlerList:
- type: org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerUTF8
- type: org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownExtTypeHandlerNoCommentsUTF8
- type: org.fugerit.java.doc.freemarker.asciidoc.FreeMarkerAsciidocTypeHandlerUTF8
- type: org.fugerit.java.doc.mod.poi.XlsxPoiTypeHandler
- type: org.fugerit.java.doc.mod.fop.FreeMarkerFopTypeHandlerUTF8
- type: org.fugerit.java.doc.mod.fop.PdfFopTypeHandler
chainList:
- chainId: 'issue-426'
dataModelYaml: '${projectBasedir}/src/main/resources/venus-config-direct/data-model/issue-426.yaml'
outputList:
- outputId: 'issue-426.md'
chainId: 'issue-426'
handlerId: 'md'
file: '${projectBasedir}/target/direct-sample/issue-426.md'
- outputId: 'issue-426.adoc'
chainId: 'issue-426'
handlerId: 'adoc'
file: '${projectBasedir}/target/direct-sample/issue-426.adoc'
- outputId: 'issue-426.xlsx'
chainId: 'issue-426'
handlerId: 'xlsx'
file: '${projectBasedir}/target/direct-sample/issue-426.xlsx'
- outputId: 'issue-426.fo'
chainId: 'issue-426'
handlerId: 'fo'
file: '${projectBasedir}/target/direct-sample/issue-426.fo'
- outputId: 'issue-426.pdf'
chainId: 'issue-426'
handlerId: 'pdf'
file: '${projectBasedir}/target/direct-sample/issue-426.pdf'
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<#ftl output_format="XML"><#-- Set the output format for XML, not mandatory but reccomended, otherwise escaping should be handled in a cusomt way, for example through CDATA sections -->
<?xml version="1.0" encoding="utf-8"?>
<doc
xmlns="http://javacoredoc.fugerit.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-1.xsd" >

<#--
This is a Venus Fugerit Doc (https://github.com/fugerit-org/fj-doc) FreeMarker Template XML (ftl[x]).
For consideration of Venus Fugerit Doc and Apache FreeMarker integration see :
https://venusdocs.fugerit.org/guide/#doc-freemarker-entry-point
The result will be a :
-->
<!--
This is a Venus Fugerit Doc (https://github.com/fugerit-org/fj-doc) XML Source Document.
For documentation on how to write a valid Venus Doc XML Meta Model refer to :
https://venusdocs.fugerit.org/guide/#doc-format-entry-point
-->

<metadata>
<!-- Margin for document : left;right;top;bottom -->
<info name="margins">10;10;10;30</info>
<!-- documenta meta information -->
<info name="doc-title">${dataModel.docTitle}</info>
<info name="doc-author">Matteo Franci</info>
<info name="doc-language">it</info>
<!-- only apply to xls/xlsx format -->
<info name="excel-table-id">issue-426-table=issue-426-table</info>
<!-- only apply to csv format -->
<info name="csv-table-id">issue-426-table</info>
<!-- font must be loaded -->
<info name="default-font-name">TitilliumWeb</info>
<!-- default table-border-collapse, can be 'separate' or 'collapse' -->
<info name="table-border-collapse">collapse</info>
<footer-ext>
<para align="right">${r"${currentPage}"} / ${r"${pageCount}"}</para>
</footer-ext>
<bookmark-tree>
<bookmark ref="top">${dataModel.docTitle}</bookmark>
</bookmark-tree>
</metadata>

<body>

<h head-level="1" id="top" size="16">${dataModel.docTitle}</h>

<table colwidths="50;50" columns="2" width="100" id="issue-426-table">
<row header="true">
<cell align="center"><para style="bold">Field 1</para></cell>
<cell align="center"><para style="bold">Field 2</para></cell>
</row>
<#list dataModel.listSample as current>
<row>
<cell><phrase>${current.field1}</phrase></cell>
<cell><phrase>${current.field2}</phrase></cell>
</row>
</#list>
</table>

</body>

</doc>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package test.org.fugerit.java.doc.sample;

import org.fugerit.java.core.lang.helpers.ClassHelper;
import org.fugerit.java.doc.lib.direct.VenusDirectFacade;
import org.fugerit.java.doc.lib.direct.config.VenusDirectConfig;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;

class TestSampleDirect {

@Test
void testDirect() throws IOException {
File testOutputMd = new File( "./target/direct-sample/issue-426.md" );
testOutputMd.delete();
try (Reader reader = new InputStreamReader(ClassHelper.loadFromDefaultClassLoader( "venus-config-direct/venus-direct-config.yaml" ) )) {
Map<String, String> envMap = new HashMap<>();
envMap.put( "projectBasedir", "." );
VenusDirectConfig config = VenusDirectFacade.readConfig( reader, envMap );
VenusDirectFacade.handleAllOutput( config );
}
Assertions.assertTrue( testOutputMd.exists() );
}

}