Added TextSigle to RTF export and made snippets justified
Change-Id: I703dcaa04c357abf77624625a49f380264bc21b3
diff --git a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java
index 13e041f..633448e 100644
--- a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java
+++ b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java
@@ -1,9 +1,5 @@
package de.ids_mannheim.korap.plkexport;
-import com.tutego.jrtf.*;
-import static com.tutego.jrtf.RtfText.*;
-
-
import java.lang.StringBuffer;
import java.nio.charset.*;
@@ -67,6 +63,7 @@
public void addMatch (JsonNode n, Writer w) throws IOException {
try {
+
MatchExport match = mapper.treeToValue(n, MatchExport.class);
Snippet s = match.getSnippetO();
@@ -75,7 +72,7 @@
// Snippet
w.append("{\\pard ");
- w.append("\\ql ");
+ w.append("\\qj ");
rtfText(w, s.getLeft());
w.append(" {\\b ");
rtfText(w, s.getMark());
@@ -95,6 +92,11 @@
w.append(")}");
w.append("\\par}");
+ // TextSigle
+ w.append("{\\pard\\qr\\b [");
+ rtfText(w, match.getTextSigle());
+ w.append("]\\par}");
+
} catch (JsonProcessingException jpe) {
System.err.println(jpe);
w.append("{\\pard {\\b Unable to process match} \\par}");
@@ -151,8 +153,9 @@
else {
w.append("\\u" ).append(Integer.toString(c));
- if (!charsetEncoder.canEncode(c))
+ if (!charsetEncoder.canEncode(c)) {
w.append("?");
+ };
try {
final ByteBuffer bytes = charsetEncoder.encode(
diff --git a/plugin/src/test/java/de/ids_mannheim/korap/plkexport/RtfExportTest.java b/plugin/src/test/java/de/ids_mannheim/korap/plkexport/RtfExportTest.java
index 436ba79..0ba95c7 100644
--- a/plugin/src/test/java/de/ids_mannheim/korap/plkexport/RtfExportTest.java
+++ b/plugin/src/test/java/de/ids_mannheim/korap/plkexport/RtfExportTest.java
@@ -35,11 +35,13 @@
"{\"author\":\"Goethe\","+
"\"title\":\"Title1\","+
"\"pubDate\":\"20051103\","+
+ "\"textSigle\":\"RTF/G59/34284\","+
"\"snippet\":\"Simple <mark>match1</mark> Snippet\"}"+
","+
"{\"author\":\"Schiller\","+
"\"title\":\"Title2\","+
"\"pubDate\":\"20051104\","+
+ "\"textSigle\":\"RTF/G59/34285\","+
"\"snippet\":\"Simpler <mark>match2</mark> Snippet\"}"+
"]}");