diff --git a/src/main/java/org/metanorma/fop/PDFGenerator.java b/src/main/java/org/metanorma/fop/PDFGenerator.java index 4bc02b6..7981c59 100644 --- a/src/main/java/org/metanorma/fop/PDFGenerator.java +++ b/src/main/java/org/metanorma/fop/PDFGenerator.java @@ -88,6 +88,8 @@ public class PDFGenerator { private boolean isAddCommentaryPageNumbers = false; private boolean isAddMathAsAttachment = false; + + private boolean isApplyAutolayoutAlgorithm = true; private boolean isAddAnnotations = false; @@ -275,6 +277,8 @@ public boolean process() { isAddMathAsText = xsltConverter.hasParamAddMathAsText() && isMathExists; isAddMathAsAttachment = xsltConverter.hasParamAddMathAsAttachment(); + isApplyAutolayoutAlgorithm = xsltConverter.isApplyAutolayoutAlgorithm(); + if (isSyntaxHighlight) { xsltParams.put("syntax-highlight", "true"); } @@ -1174,7 +1178,7 @@ private void setTablesWidths(fontConfig fontcfg, XSLTconverter xsltConverter, Fi long startMethodTime = System.currentTimeMillis(); try { - if (isTableExists && xmlTableIF.isEmpty()) { + if (isTableExists && xmlTableIF.isEmpty() && isApplyAutolayoutAlgorithm) { // generate IF with table width data xsltConverter.setParam("table_if", "true"); logger.info("[INFO] Generation of XSL-FO with information about the table's widths ..."); diff --git a/src/main/java/org/metanorma/fop/SourceXMLDocument.java b/src/main/java/org/metanorma/fop/SourceXMLDocument.java index dbcb96d..9d31d78 100644 --- a/src/main/java/org/metanorma/fop/SourceXMLDocument.java +++ b/src/main/java/org/metanorma/fop/SourceXMLDocument.java @@ -98,7 +98,8 @@ public SourceXMLDocument(String strXML) { private void readMetaInformation() { String element_review = readValue("//*[local-name() = 'review'][1]"); this.hasAnnotations = element_review.length() != 0; - String element_table = readValue("//*[local-name() = 'table' or local-name() = 'dl'][1]"); + // check table without colgroup/col (width) or dl + String element_table = readValue("//*[(local-name() = 'table' and not(*[local-name() = 'colgroup']/*[local-name() = 'col'])) or local-name() = 'dl'][1]"); this.hasTables = element_table.length() != 0; String element_math = readValue("//*[local-name() = 'math'][1]"); this.hasMath = element_math.length() != 0; diff --git a/src/main/java/org/metanorma/fop/XSLTconverter.java b/src/main/java/org/metanorma/fop/XSLTconverter.java index fa5fad9..346c5cb 100644 --- a/src/main/java/org/metanorma/fop/XSLTconverter.java +++ b/src/main/java/org/metanorma/fop/XSLTconverter.java @@ -187,6 +187,11 @@ public boolean hasParamAddMathAsAttachment() { return param_add_math_as_attachment.equalsIgnoreCase("true"); } + public boolean isApplyAutolayoutAlgorithm() { + String variable_isApplyAutolayoutAlgorithm = readValue("/*[local-name() = 'stylesheet']/*[local-name() = 'variable'][@name = 'isApplyAutolayoutAlgorithm_']"); + return variable_isApplyAutolayoutAlgorithm.trim().equalsIgnoreCase("true"); + } + public void deleteTmpXSL() { if (tmpfileXSL != null) { try {