From 791d39bd2c0f928f5ea940165a46c2f00a66b20b Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Wed, 25 Mar 2020 12:46:09 +0000 Subject: [PATCH] FOP-2923: Allow to suppress fo:leader within empty paragaphs from structure tree git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1875639 13f79535-47bb-0310-9956-ffa450edef68 --- .../accessibility/fo/FO2StructureTreeConverter.java | 2 +- .../fo/FO2StructureTreeConverterTestCase.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java b/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java index 2381f2f03..92c7cf7d9 100644 --- a/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java +++ b/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java @@ -686,7 +686,7 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler { public void run() { eventHandler.startLeader(l); } - }, true); + }, false); super.startLeader(l); } diff --git a/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java b/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java index ef7b57f47..39b6cbaf0 100644 --- a/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java @@ -83,6 +83,7 @@ public class FO2StructureTreeConverterTestCase { private static final String STRUCTURE_TREE_SEQUENCE_NAME = "structure-tree-sequence"; private FOLoader foLoader; + private boolean keepEmptyTags = true; @Test public void testCompleteDocument() throws Exception { @@ -139,6 +140,7 @@ public class FO2StructureTreeConverterTestCase { @Test public void testRemoveBlocks() throws Exception { + keepEmptyTags = false; compare("\n" + " \n" + " \n" @@ -150,6 +152,8 @@ public class FO2StructureTreeConverterTestCase { + " " + " \n" + " a\n" + + " \n" + + " a\n" + " \n" + " \n" + "\n", @@ -162,6 +166,9 @@ public class FO2StructureTreeConverterTestCase { + "\n" + "\n" + "\n" + + "\n" + + "\n" + + "\n" + "\n" + "\n" + "\n"); @@ -228,7 +235,7 @@ public class FO2StructureTreeConverterTestCase { return actualStructureTree; } - private static void createStructureTreeFromDocument(InputStream foInputStream, + private void createStructureTreeFromDocument(InputStream foInputStream, Result result) throws Exception { TransformerHandler tHandler = createTransformerHandler(result); startStructureTreeSequence(tHandler); @@ -264,10 +271,10 @@ public class FO2StructureTreeConverterTestCase { }); } - private static FOUserAgent createFOUserAgent(FODocumentParser documentParser) { + private FOUserAgent createFOUserAgent(FODocumentParser documentParser) { FOUserAgent userAgent = documentParser.createFOUserAgent(); userAgent.setAccessibility(true); - userAgent.setKeepEmptyTags(false); + userAgent.setKeepEmptyTags(keepEmptyTags); return userAgent; } -- 2.39.5