Skip to content

Commit

Permalink
Merge pull request #210 from metanorma/tags_tree
Browse files Browse the repository at this point in the history
Tags tree
  • Loading branch information
Intelligent2013 authored Jun 15, 2023
2 parents 6d37980 + 72be49a commit f3da485
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 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.73
JAR_VERSION := 1.74
JAR_FILE := mn2pdf-$(JAR_VERSION).jar

all: target/$(JAR_FILE)
Expand Down
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>org.metanorma.fop</groupId>
<artifactId>mn2pdf</artifactId>
<version>1.73</version>
<version>1.74</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.73
git push origin v1.73
git tag v1.74
git push origin v1.74
----

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.73</version>
<version>1.74</version>
<name>Metanorma XML to PDF converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
package org.apache.fop.render.pdf;

import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import javax.xml.XMLConstants;

import org.apache.fop.pdf.*;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;

Expand All @@ -34,16 +36,9 @@
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fo.extensions.InternalElementMapping;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.pdf.PDFFactory;
import org.apache.fop.pdf.PDFParentTree;
import org.apache.fop.pdf.PDFStructElem;
import org.apache.fop.pdf.PDFStructTreeRoot;
import org.apache.fop.pdf.StandardStructureAttributes.Table.Scope;
import org.apache.fop.pdf.StandardStructureTypes;
import org.apache.fop.pdf.StandardStructureTypes.Grouping;
import org.apache.fop.pdf.StandardStructureTypes.Table;
import org.apache.fop.pdf.StructureHierarchyMember;
import org.apache.fop.pdf.StructureType;
import org.apache.fop.util.LanguageTags;
import org.apache.fop.util.XMLUtil;

Expand Down Expand Up @@ -144,13 +139,44 @@ public final PDFStructElem build(StructureHierarchyMember parent, Attributes att
structureType.toString());
}
}
/*if (structureType.toString().equals("P")) {
//findParentP(parent);
// if ancestor contains P already, then add current P after it
PDFStructElem ancestor = ((PDFStructElem) parent).getParentStructElem();
while (ancestor != null && !ancestor.getStructureType().toString().equals("P")) {
ancestor = ancestor.getParentStructElem();
}
if (ancestor != null && ancestor.getParentStructElem() != null) { // if found P
//ancestor.getKids().get(0).
List<PDFObject> kids = ancestor.getParentStructElem().getKids();
int pos = 0;
for (int i = 0; i < kids.size(); i++) {
if (ancestor == kids.get(i)) {
pos = i + 1;
}
}
//((PDFStructElem) parent).addKidInSpecificOrder(pos,parent).
// move to level up
ancestor = ancestor.getParentStructElem();
PDFStructElem structElem = createStructureElement(ancestor, structureType);
setAttributes(structElem, attributes);
//addKidToParent(structElem, ancestor, attributes);
ancestor.addKidInSpecificOrder(pos,structElem);
registerStructureElement(structElem, pdfFactory, attributes);
return structElem;
}
}*/
PDFStructElem structElem = createStructureElement(parent, structureType);
setAttributes(structElem, attributes);
addKidToParent(structElem, parent, attributes);
registerStructureElement(structElem, pdfFactory, attributes);
return structElem;
}

/*private PDFObject findParentP(StructureHierarchyMember parent) {
return parent.getParent();
}*/

protected PDFStructElem createStructureElement(StructureHierarchyMember parent,
StructureType structureType) {
return new PDFStructElem(parent, structureType);
Expand Down Expand Up @@ -415,7 +441,9 @@ public void endNode(String name) {

private boolean isPDFA1Safe(String name) {
return !((pdfFactory.getDocument().getProfile().getPDFAMode().isPart1()
|| pdfFactory.getDocument().getProfile().getPDFUAMode().isEnabled())
// commented, see https://github.com/metanorma/metanorma-iso/issues/1001#issuecomment-1592786352
// || pdfFactory.getDocument().getProfile().getPDFUAMode().isEnabled()
)
&& (name.equals("table-body")
|| name.equals("table-header")
|| name.equals("table-footer")));
Expand Down

0 comments on commit f3da485

Please sign in to comment.