]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-2923: Allow to suppress fo:leader within empty paragaphs from structure tree
authorSimon Steiner <ssteiner@apache.org>
Wed, 25 Mar 2020 12:46:09 +0000 (12:46 +0000)
committerSimon Steiner <ssteiner@apache.org>
Wed, 25 Mar 2020 12:46:09 +0000 (12:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1875639 13f79535-47bb-0310-9956-ffa450edef68

fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java
fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java

index 2381f2f031048a0388204e311d22763f3b08e52c..92c7cf7d914f16091cdbedc98f666f227e9ac244 100644 (file)
@@ -686,7 +686,7 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler {
             public void run() {
                 eventHandler.startLeader(l);
             }
-        }, true);
+        }, false);
         super.startLeader(l);
     }
 
index ef7b57f4775ff64add8a3694bb3de91245574f04..39b6cbaf02eea96e221d4a73b45c7d563c6a94e3 100644 (file)
@@ -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("<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n"
                         + "  <fo:layout-master-set>\n"
                         + "    <fo:simple-page-master master-name=\"simple\">\n"
@@ -150,6 +152,8 @@ public class FO2StructureTreeConverterTestCase {
                         + "    <fo:block/>"
                         + "    <fo:block><fo:block/></fo:block>\n"
                         + "    <fo:block>a</fo:block>\n"
+                        + "    <fo:block><fo:leader/></fo:block>\n"
+                        + "    <fo:block>a<fo:leader/></fo:block>\n"
                         + "    </fo:flow>\n"
                         + "  </fo:page-sequence>\n"
                         + "</fo:root>\n",
@@ -162,6 +166,9 @@ public class FO2StructureTreeConverterTestCase {
                         + "<fo:block>\n"
                         + "<marked-content/>\n"
                         + "</fo:block>\n"
+                        + "<fo:block>\n"
+                        + "<marked-content/>\n"
+                        + "</fo:block>\n"
                         + "</fo:flow>\n"
                         + "</structure-tree>\n"
                         + "</structure-tree-sequence>\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;
     }