Skip to content

Commit

Permalink
Merge pull request #158 from metanorma/layout_table
Browse files Browse the repository at this point in the history
Layout table
  • Loading branch information
Intelligent2013 authored Nov 3, 2022
2 parents e53429a + 0146611 commit 3046f17
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.50
JAR_VERSION := 1.51
JAR_FILE := mn2pdf-$(JAR_VERSION).jar

all: target/$(JAR_FILE)
Expand Down
10 changes: 5 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.50.jar --xml-file <XML-FileName> --xsl-file <XSLT-FileName> --pdf-file <Output-PDF-FileName> [--syntax-highlight]
java -Xss5m -Xmx2048m -jar target/mn2pdf-1.51.jar --xml-file <XML-FileName> --xsl-file <XSLT-FileName> --pdf-file <Output-PDF-FileName> [--syntax-highlight]
----

e.g.

[source,sh]
----
java -Xss5m -Xmx2048m -jar target/mn2pdf-1.50.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.51.jar --xml-file tests/G.191.xml --xsl-file tests/itu.recommendation.xsl --pdf-file tests/G.191.pdf
----

=== PDF encryption features
Expand Down Expand Up @@ -100,7 +100,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>org.metanorma.fop</groupId>
<artifactId>mn2pdf</artifactId>
<version>1.50</version>
<version>1.51</version>
<name>Metanorma XML to PDF converter</name>
----

Expand All @@ -111,8 +111,8 @@ Tag the same version in Git:

[source,xml]
----
git tag v1.50
git push origin v1.50
git tag v1.51
git push origin v1.51
----

Then the corresponding GitHub release will be automatically created at:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metanorma.fop</groupId>
<artifactId>mn2pdf</artifactId>
<version>1.50</version>
<version>1.51</version>
<name>Metanorma XML to PDF converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/org/apache/fop/events/EventFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.commons.logging.LogFactory;

import org.apache.fop.events.model.EventSeverity;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.util.XMLResourceBundle;
import org.apache.fop.util.text.AdvancedMessageFormat;
Expand Down Expand Up @@ -90,6 +89,16 @@ private static String format(Event event, ResourceBundle bundle) {
String template;
if (bundle != null) {
String elementName = (String)event.getParams().get("elementName");
if (elementName != null) {
String className = event.getSource().getClass().toString();
try {
String elementId = ((LayoutManager) (event.getSource())).getFObj().getId();
if (elementId != null && elementId.startsWith("__internal_layout__")) { //
// special case when element (for instance, table) is using for block position on the page, no need warning
return "";
}
} catch (Exception ex) { }
}
if (key.equals("overconstrainedAdjustEndIndent") && elementName != null && elementName.equals("fo:table")) {
key = "overconstrainedAdjustEndIndentTable";
event.setSeverity(EventSeverity.WARN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class LoggingEventListener implements EventListener {
/** {@inheritDoc} */
public void processEvent(Event event) {
String msg = EventFormatter.format(event);
if (msg.isEmpty()) {
return;
}
EventSeverity severity = event.getSeverity();
if (severity == EventSeverity.INFO) {
logger.info(msg);
Expand Down

0 comments on commit 3046f17

Please sign in to comment.