Skip to content

Commit

Permalink
Updated for release 2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmraya committed May 25, 2022
1 parent 66b728e commit e2b4825
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
Binary file modified lib/openxliff.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/com/maxprograms/fluenta/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ private Constants() {
}

public static final String NAME = "Fluenta"; //$NON-NLS-1$
public static final String VERSION = "2.3.1"; //$NON-NLS-1$
public static final String BUILD = "20220405_0839"; //$NON-NLS-1$
public static final String VERSION = "2.4.0"; //$NON-NLS-1$
public static final String BUILD = "20220525_1409"; //$NON-NLS-1$
}
35 changes: 26 additions & 9 deletions src/com/maxprograms/fluenta/controllers/LocalController.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,20 @@ public void importXliff(Project project, String xliffDocument, String targetFold
logger.displayError(error);
return;
}
// remove referenced content imported on XLIFF creation
SAXBuilder builder = new SAXBuilder();
Catalog catalog = new Catalog(Fluenta.getCatalogFile());
builder.setEntityResolver(catalog);
XMLOutputter outputter = new XMLOutputter();
outputter.preserveSpace(true);
Document d = builder.build(backfile);
Element r = d.getRootElement();
removeContent(r);
Indenter.indent(r, 2);
try (FileOutputStream out = new FileOutputStream(new File(backfile))) {
outputter.output(d, out);
}
// remove temporay XLIFF
File f = new File(paramsList.get(i).get("xliff")); //$NON-NLS-1$
Files.delete(Paths.get(f.toURI()));
}
Expand Down Expand Up @@ -2102,20 +2116,23 @@ public Project getProject(long id) throws IOException {
return projectsMap.get(id);
}

private void removeContent(Element e) {
if ("removeContent".equals(e.getAttributeValue("state"))) {
e.setContent(new ArrayList<>());
e.removeAttribute("state");
}
List<Element> children = e.getChildren();
Iterator<Element> it = children.iterator();
while (it.hasNext()) {
removeContent(it.next());
}
}

private void recurse(Element e) {
e.removeAttribute("class"); //$NON-NLS-1$
e.removeAttribute("xmlns:ditaarch"); //$NON-NLS-1$
e.removeAttribute("ditaarch:DITAArchVersion"); //$NON-NLS-1$
e.removeAttribute("domains"); //$NON-NLS-1$
if (e.getName().equals("mapref") && e.getAttributeValue("format", "").equals("ditamap")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
e.removeAttribute("format"); //$NON-NLS-1$
}
if (e.getName().equals("keydef") && e.getAttributeValue("processing-role", "").equals("resource-only")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
e.removeAttribute("processing-role"); //$NON-NLS-1$
}
if (e.getName().equals("image") && e.getAttributeValue("placement", "").equals("inline")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
e.removeAttribute("placement"); //$NON-NLS-1$
}
List<Element> children = e.getChildren();
Iterator<Element> it = children.iterator();
while (it.hasNext()) {
Expand Down

0 comments on commit e2b4825

Please sign in to comment.