[Pkg-crosswire-commits] [sword] 01/01: Add Images support to TEI encoded modules

Dominique Corbex domcox-guest at moszumanska.debian.org
Sat Apr 8 20:18:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

domcox-guest pushed a commit to branch master
in repository sword.

commit b807e45de36da012c98603a46c38cda7536b2886
Author: Dominique Corbex <dominique at corbex.org>
Date:   Sat Apr 8 22:19:17 2017 +0200

    Add Images support to TEI encoded modules
---
 debian/patches/series                 |   1 +
 debian/patches/sword-TEI-images.patch | 118 ++++++++++++++++++++++++++++++++++
 2 files changed, 119 insertions(+)

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 at 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
+ 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-crosswire/sword.git



More information about the Pkg-crosswire-commits mailing list