Skip to content

Commit b8120f9

Browse files
skip table auto layout for plateau added, #245, metanorma/metanorma-plateau#2
1 parent 332aad7 commit b8120f9

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/main/java/org/metanorma/fop/PDFGenerator.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public class PDFGenerator {
8888
private boolean isAddCommentaryPageNumbers = false;
8989

9090
private boolean isAddMathAsAttachment = false;
91+
92+
private boolean isApplyAutolayoutAlgorithm = true;
9193

9294
private boolean isAddAnnotations = false;
9395

@@ -275,6 +277,8 @@ public boolean process() {
275277
isAddMathAsText = xsltConverter.hasParamAddMathAsText() && isMathExists;
276278
isAddMathAsAttachment = xsltConverter.hasParamAddMathAsAttachment();
277279

280+
isApplyAutolayoutAlgorithm = xsltConverter.isApplyAutolayoutAlgorithm();
281+
278282
if (isSyntaxHighlight) {
279283
xsltParams.put("syntax-highlight", "true");
280284
}
@@ -1174,7 +1178,7 @@ private void setTablesWidths(fontConfig fontcfg, XSLTconverter xsltConverter, Fi
11741178
long startMethodTime = System.currentTimeMillis();
11751179

11761180
try {
1177-
if (isTableExists && xmlTableIF.isEmpty()) {
1181+
if (isTableExists && xmlTableIF.isEmpty() && isApplyAutolayoutAlgorithm) {
11781182
// generate IF with table width data
11791183
xsltConverter.setParam("table_if", "true");
11801184
logger.info("[INFO] Generation of XSL-FO with information about the table's widths ...");

src/main/java/org/metanorma/fop/SourceXMLDocument.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ public SourceXMLDocument(String strXML) {
9898
private void readMetaInformation() {
9999
String element_review = readValue("//*[local-name() = 'review'][1]");
100100
this.hasAnnotations = element_review.length() != 0;
101-
String element_table = readValue("//*[local-name() = 'table' or local-name() = 'dl'][1]");
101+
// check table without colgroup/col (width) or dl
102+
String element_table = readValue("//*[(local-name() = 'table' and not(*[local-name() = 'colgroup']/*[local-name() = 'col'])) or local-name() = 'dl'][1]");
102103
this.hasTables = element_table.length() != 0;
103104
String element_math = readValue("//*[local-name() = 'math'][1]");
104105
this.hasMath = element_math.length() != 0;

src/main/java/org/metanorma/fop/XSLTconverter.java

+5
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ public boolean hasParamAddMathAsAttachment() {
187187
return param_add_math_as_attachment.equalsIgnoreCase("true");
188188
}
189189

190+
public boolean isApplyAutolayoutAlgorithm() {
191+
String variable_isApplyAutolayoutAlgorithm = readValue("/*[local-name() = 'stylesheet']/*[local-name() = 'variable'][@name = 'isApplyAutolayoutAlgorithm_']");
192+
return variable_isApplyAutolayoutAlgorithm.trim().equalsIgnoreCase("true");
193+
}
194+
190195
public void deleteTmpXSL() {
191196
if (tmpfileXSL != null) {
192197
try {

0 commit comments

Comments
 (0)