Skip to content

Commit

Permalink
skip table auto layout for plateau added, #245, metanorma/metanorma-p…
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed May 22, 2024
1 parent 332aad7 commit b8120f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/java/org/metanorma/fop/PDFGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public class PDFGenerator {
private boolean isAddCommentaryPageNumbers = false;

private boolean isAddMathAsAttachment = false;

private boolean isApplyAutolayoutAlgorithm = true;

private boolean isAddAnnotations = false;

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

isApplyAutolayoutAlgorithm = xsltConverter.isApplyAutolayoutAlgorithm();

if (isSyntaxHighlight) {
xsltParams.put("syntax-highlight", "true");
}
Expand Down Expand Up @@ -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 ...");
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/metanorma/fop/SourceXMLDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/metanorma/fop/XSLTconverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b8120f9

Please sign in to comment.