[sword-svn] r3393 - trunk/src/modules/filters
refdoc at crosswire.org
refdoc at crosswire.org
Sat Dec 19 14:01:49 MST 2015
Author: refdoc
Date: 2015-12-19 14:01:48 -0700 (Sat, 19 Dec 2015)
New Revision: 3393
Modified:
trunk/src/modules/filters/teilatex.cpp
Log:
added tables and image support for TEI in Latex filter
Modified: trunk/src/modules/filters/teilatex.cpp
===================================================================
--- trunk/src/modules/filters/teilatex.cpp 2015-12-19 21:00:55 UTC (rev 3392)
+++ trunk/src/modules/filters/teilatex.cpp 2015-12-19 21:01:48 UTC (rev 3393)
@@ -256,6 +256,63 @@
}
}
+ // <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("\\figure{\\includegraphics{%s}}",
+ filepath.c_str());
+ u->suspendTextPassThru = false;
+
+ }
+ }
+
+ // <table> <row> <cell>
+ else if (!strcmp(tag.getName(), "table")) {
+ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+ buf += "\n\\begin{tabular}";
+ }
+ else if (tag.isEndTag()) {
+ buf += "\n\\end{tabular}";
+ ++u->consecutiveNewlines;
+ u->supressAdjacentWhitespace = true;
+ }
+
+ }
+ else if (!strcmp(tag.getName(), "row")) {
+ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+ buf += "\n";
+ u->firstCell = true;
+ }
+ else if (tag.isEndTag()) {
+ buf += "//";
+ u->firstCell = false;
+ }
+
+ }
+ else if (!strcmp(tag.getName(), "cell")) {
+ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+ if (u->firstCell == false) {
+ buf += " & ";
+ }
+ else {
+ u->firstCell = false;
+ }
+ }
+ else if (tag.isEndTag()) {
+ buf += "";
+ }
+ }
+
+
else {
return false; // we still didn't handle token
}
More information about the sword-cvs
mailing list