summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorDominique Corbex <dominique@corbex.org>2017-04-08 22:19:17 +0200
committerDominique Corbex <dominique@corbex.org>2017-04-08 22:19:17 +0200
commitb807e45de36da012c98603a46c38cda7536b2886 (patch)
tree5bf179ac6a82c8f60fbcb8aa758150e7bafb1188 /debian/patches
parentb8d5aa7e1844c40eb81c22a857459ea7c674fd51 (diff)
Add Images support to TEI encoded modules
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/sword-TEI-images.patch118
2 files changed, 119 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series
index 7a831e8..212c446 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+sword-TEI-images.patch
13_curl.diff
multiarch-clucene.patch
no-included-zconf.h.diff
diff --git a/debian/patches/sword-TEI-images.patch b/debian/patches/sword-TEI-images.patch
new file mode 100644
index 0000000..b881847
--- /dev/null
+++ b/debian/patches/sword-TEI-images.patch
@@ -0,0 +1,118 @@
+Description: Add Images and Tables support to TEI encoded modules (dictionaries)
+Author: Dominique Corbex <dominique@corbex.org>
+Origin: upstream, http://www.crosswire.org/pipermail/sword-devel/2015-November/042858.html
+Applied-Upstream: Fri, 18 Dec 2015, http://www.crosswire.org/pipermail/sword-devel/2015-December/042888.html
+Last-Update: 2017-04-08
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+
+--- sword-1.7.5/src/modules/filters/teihtmlhref.cpp 2014-04-17 06:02:17.000000000 +0200
++++ sword-1.7.5a2+dfsg/src/modules/filters/teihtmlhref.cpp 2015-11-28 16:10:41.485646005 +0100
+@@ -275,6 +275,52 @@
+ u->suspendTextPassThru = false;
+ }
+ }
++ // <graphic> image tag
++ else if (!strcmp(tag.getName(), "graphic")) {
++ const char *url = tag.getAttribute("url");
++ if (url) { // assert we have a url attribute
++ SWBuf filepath;
++ if (userData->module) {
++ filepath = userData->module->getConfigEntry("AbsoluteDataPath");
++ if ((filepath.size()) && (filepath[filepath.size()-1] != '/') && (url[0] != '/'))
++ filepath += '/';
++ }
++ filepath += url;
++ // images become clickable, if the UI supports showImage.
++ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showImage&value=%s&module=%s\"><img src=\"file:%s\" border=\"0\" /></a>",
++ URL::encode(filepath.c_str()).c_str(),
++ URL::encode(u->version.c_str()).c_str(),
++ filepath.c_str());
++ u->suspendTextPassThru = true;
++ }
++ }
++ // <table> <row> <cell>
++ else if (!strcmp(tag.getName(), "table")) {
++ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
++ buf += "<table><tbody>\n";
++ }
++ else if (tag.isEndTag()) {
++ buf += "</tbody></table>\n";
++ u->supressAdjacentWhitespace = true;
++ }
++
++ }
++ else if (!strcmp(tag.getName(), "row")) {
++ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
++ buf += "\t<tr>";
++ }
++ else if (tag.isEndTag()) {
++ buf += "</tr>\n";
++ }
++ }
++ else if (!strcmp(tag.getName(), "cell")) {
++ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
++ buf += "<td>";
++ }
++ else if (tag.isEndTag()) {
++ buf += "</td>";
++ }
++ }
+
+ else {
+ return false; // we still didn't handle token
+diff -bru sword-1.7.5/src/modules/filters/teixhtml.cpp sword-1.7.5a2+dfsg/src/modules/filters/teixhtml.cpp
+--- sword-1.7.5/src/modules/filters/teixhtml.cpp 2014-04-17 06:04:03.000000000 +0200
++++ sword-1.7.5a2+dfsg/src/modules/filters/teixhtml.cpp 2015-11-28 16:46:46.638563403 +0100
+@@ -276,7 +276,50 @@
+ u->suspendTextPassThru = false;
+ }
+ }
+-
++ // <graphic> image tag
++ else if (!strcmp(tag.getName(), "graphic")) {
++ const char *url = tag.getAttribute("url");
++ if (url) { // assert we have a url attribute
++ SWBuf filepath;
++ if (userData->module) {
++ filepath = userData->module->getConfigEntry("AbsoluteDataPath");
++ if ((filepath.size()) && (filepath[filepath.size()-1] != '/') && (url[0] != '/'))
++ filepath += '/';
++ }
++ filepath += url;
++ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showImage&value=%s&module=%s\"><img src=\"file:%s\" border=\"0\" /></a>",
++ URL::encode(filepath.c_str()).c_str(),
++ URL::encode(u->version.c_str()).c_str(),
++ filepath.c_str());
++ u->suspendTextPassThru = false;
++ }
++ }
++ // <table> <row> <cell>
++ else if (!strcmp(tag.getName(), "table")) {
++ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
++ buf += "<table><tbody>\n";
++ }
++ else if (tag.isEndTag()) {
++ buf += "</tbody></table>\n";
++ u->supressAdjacentWhitespace = true;
++ }
++ }
++ else if (!strcmp(tag.getName(), "row")) {
++ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
++ buf += "\t<tr>";
++ }
++ else if (tag.isEndTag()) {
++ buf += "</tr>\n";
++ }
++ }
++ else if (!strcmp(tag.getName(), "cell")) {
++ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
++ buf += "<td>";
++ }
++ else if (tag.isEndTag()) {
++ buf += "</td>";
++ }
++ }
+ else {
+ return false; // we still didn't handle token
+ }