diff --git a/Makefile b/Makefile index 8902093..93acdcf 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ SHELL ?= /bin/bash endif #JAR_VERSION := $(shell mvn -q -Dexec.executable="echo" -Dexec.args='$${project.version}' --non-recursive exec:exec -DforceStdout) -JAR_VERSION := 1.87 +JAR_VERSION := 1.88 JAR_FILE := mn2pdf-$(JAR_VERSION).jar all: target/$(JAR_FILE) diff --git a/README.adoc b/README.adoc index 3233998..5cad1d1 100644 --- a/README.adoc +++ b/README.adoc @@ -17,14 +17,14 @@ You will need the Java Development Kit (JDK) version 8, Update 241 (8u241) or hi [source,sh] ---- -java -Xss5m -Xmx2048m -jar target/mn2pdf-1.87.jar --xml-file --xsl-file --pdf-file [--syntax-highlight] +java -Xss5m -Xmx2048m -jar target/mn2pdf-1.88.jar --xml-file --xsl-file --pdf-file [--syntax-highlight] ---- e.g. [source,sh] ---- -java -Xss5m -Xmx2048m -jar target/mn2pdf-1.87.jar --xml-file tests/G.191.xml --xsl-file tests/itu.recommendation.xsl --pdf-file tests/G.191.pdf +java -Xss5m -Xmx2048m -jar target/mn2pdf-1.88.jar --xml-file tests/G.191.xml --xsl-file tests/itu.recommendation.xsl --pdf-file tests/G.191.pdf ---- === PDF encryption features @@ -100,7 +100,7 @@ Update version in `pom.xml`, e.g.: ---- org.metanorma.fop mn2pdf -1.87 +1.88 Metanorma XML to PDF converter ---- @@ -111,8 +111,8 @@ Tag the same version in Git: [source,xml] ---- -git tag v1.87 -git push origin v1.87 +git tag v1.88 +git push origin v1.88 ---- Then the corresponding GitHub release will be automatically created at: diff --git a/pom.xml b/pom.xml index 2c84f13..e73e861 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.metanorma.fop mn2pdf - 1.87 + 1.88 Metanorma XML to PDF converter jar https://www.metanorma.org diff --git a/src/main/java/org/metanorma/fop/PDFGenerator.java b/src/main/java/org/metanorma/fop/PDFGenerator.java index ba9e7ed..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"); } @@ -418,6 +422,8 @@ private void convertmn2pdf(fontConfig fontcfg, XSLTconverter xsltConverter, File additionalXSLTparams.setProperty("inputxml_basepath", fInputXMLParent); additionalXSLTparams.setProperty("inputxml_filename", fInputXML.getName()); + additionalXSLTparams.setProperty("output_path", pdf.getAbsolutePath()); + xsltConverter.setParams(additionalXSLTparams); setTablesWidths(fontcfg, xsltConverter, pdf); @@ -1172,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 { diff --git a/src/main/resources/tables_only.xsl b/src/main/resources/tables_only.xsl index 0310c23..70eec00 100644 --- a/src/main/resources/tables_only.xsl +++ b/src/main/resources/tables_only.xsl @@ -14,6 +14,13 @@ + + + + + + + @@ -28,7 +35,8 @@ local-name() = 'sections' or local-name() = 'annex' or local-name() = 'indexsect' - ]//*[local-name() = 'p' or + ]//*[local-name() = 'clause' or + local-name() = 'p' or local-name() = 'ul' or local-name() = 'ol' or local-name() = 'note' or @@ -131,4 +139,21 @@ + + + + + + + + + + + + Clause + + + + +