summaryrefslogtreecommitdiffstats
path: root/src/plainhtml.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2014-07-16 22:03:27 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2014-07-16 22:03:27 +0900
commitd8a29a35c7912d2b0fb0aa32d9b58a82acd91d86 (patch)
treedfb02761202d2cfa806de373841ec118b7fe1b9b /src/plainhtml.cpp
parentb615364cbafc5aa8e6ae22027cdf8df4dde9168c (diff)
downloadtdeio-sword-d8a29a35c7912d2b0fb0aa32d9b58a82acd91d86.tar.gz
tdeio-sword-d8a29a35c7912d2b0fb0aa32d9b58a82acd91d86.zip
Fixed FTBFS on Jessie caused by new version of libsword-dev.
Diffstat (limited to 'src/plainhtml.cpp')
-rw-r--r--src/plainhtml.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/plainhtml.cpp b/src/plainhtml.cpp
new file mode 100644
index 0000000..3f989fa
--- /dev/null
+++ b/src/plainhtml.cpp
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * plainhtml.cpp - description
+ * -------------------
+ * begin : Thu Jun 24 1999
+ * copyright : (C) 1999 by Torsten Uhlmann
+ * email : TUhlmann@gmx.de
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <plainhtml.h>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
+
+PLAINHTML::PLAINHTML()
+{
+}
+
+
+char PLAINHTML::processText(SWBuf &text, const SWKey *key, const SWModule *module)
+{
+ int count = 0;
+
+ SWBuf orig = text;
+ const char *from = orig.c_str();
+ for (text = ""; *from; from++)
+ {
+ if ((*from == '\n') && (from[1] == '\n')) // two newlinea are a paragraph
+ {
+ text += "<P>";
+ from++;
+ continue;
+ } else {
+ if ((*from == '\n')) // && (from[1] != '\n')) // only one new line
+ {
+ text += "<BR>";
+ continue;
+ }
+ }
+
+ if (*from == '{') { //footnote start
+ text += "<FONT COLOR=\"#80000\"><SMALL> (";
+ continue;
+ }
+ else if (*from == '}') //footnote end
+ {
+ text += ") </SMALL></FONT>";
+ continue;
+ }
+ else if (*from == '<') {
+ text += "&lt;";
+ continue;
+ }
+ else if (*from == '>') {
+ text += "&gt;";
+ continue;
+ }
+ else if (*from == '&') {
+ text += "&amp;";
+ continue;
+ }
+ else if ((*from == ' ') && (count > 5000))
+ {
+ text += "<WBR>";
+ count = 0;
+ continue;
+ }
+
+ text += *from;
+ count++;
+ }
+ return 0;
+}
+
+SWORD_NAMESPACE_END