From jira at crosswire.org Fri Apr 5 05:58:00 2024 From: jira at crosswire.org (Scott Buchanan (JIRA)) Date: Fri, 5 Apr 2024 05:58:00 -0400 (EDT) Subject: [sword-svn] [JIRA] (API-253) Invalid module replacement in SWMgr::createAllModules() In-Reply-To: References: Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 341 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 1084 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 746 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2983 bytes Desc: not available URL: From jira at crosswire.org Fri Apr 5 05:59:00 2024 From: jira at crosswire.org (Scott Buchanan (JIRA)) Date: Fri, 5 Apr 2024 05:59:00 -0400 (EDT) Subject: [sword-svn] [JIRA] (API-253) Invalid module replacement in SWMgr::createAllModules() In-Reply-To: References: Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 341 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 1084 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 746 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2983 bytes Desc: not available URL: From jira at crosswire.org Fri Apr 5 05:59:00 2024 From: jira at crosswire.org (Scott Buchanan (JIRA)) Date: Fri, 5 Apr 2024 05:59:00 -0400 (EDT) Subject: [sword-svn] [JIRA] (API-253) Invalid module replacement in SWMgr::createAllModules() In-Reply-To: References: Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 341 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 1084 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 746 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2983 bytes Desc: not available URL: From scribe at crosswire.org Tue Apr 23 10:37:57 2024 From: scribe at crosswire.org (scribe at crosswire.org) Date: Tue, 23 Apr 2024 10:37:57 -0400 (EDT) Subject: [sword-svn] r3895 - in trunk: cmake include src/modules/filters Message-ID: <20240423143757.230A01213B0@mail.crosswire.org> Author: scribe Date: 2024-04-23 10:37:56 -0400 (Tue, 23 Apr 2024) New Revision: 3895 Added: trunk/include/rtfplain.h trunk/src/modules/filters/rtfplain.cpp Modified: trunk/cmake/sources.cmake trunk/src/modules/filters/Makefile.am Log: added rtfplain filter Modified: trunk/cmake/sources.cmake =================================================================== --- trunk/cmake/sources.cmake 2023-11-22 17:17:51 UTC (rev 3894) +++ trunk/cmake/sources.cmake 2024-04-23 14:37:56 UTC (rev 3895) @@ -145,6 +145,7 @@ src/modules/filters/cipherfil.cpp src/modules/filters/rtfhtml.cpp + src/modules/filters/rtfplain.cpp src/modules/filters/greeklexattribs.cpp src/modules/filters/papyriplain.cpp @@ -354,6 +355,7 @@ include/roman.h include/rtfhtml.h + include/rtfplain.h include/sapphire.h include/scsuutf8.h include/strkey.h Added: trunk/include/rtfplain.h =================================================================== --- trunk/include/rtfplain.h (rev 0) +++ trunk/include/rtfplain.h 2024-04-23 14:37:56 UTC (rev 3895) @@ -0,0 +1,41 @@ +/*************************************************************************** + * + * rtfplain.h - class RTFPlain: a RenderFilter to render plain text from + * a very limited subset of RTF + * + * + * $Id: rtfplain.h 3786 2020-08-30 11:35:14Z scribe $ + * + * Copyright 2000-2013 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. + * + */ + +#ifndef RTFPLAIN_H +#define RTFPLAIN_H + +#include + +SWORD_NAMESPACE_START + +/** this filter converts RTF text into plain text + */ +class SWDLLEXPORT RTFPlain : public SWFilter { +public: + RTFPlain(); + virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0); +}; + +SWORD_NAMESPACE_END +#endif Modified: trunk/src/modules/filters/Makefile.am =================================================================== --- trunk/src/modules/filters/Makefile.am 2023-11-22 17:17:51 UTC (rev 3894) +++ trunk/src/modules/filters/Makefile.am 2024-04-23 14:37:56 UTC (rev 3895) @@ -84,6 +84,7 @@ libsword_la_SOURCES += $(filtersdir)/cipherfil.cpp PLFIL = $(filtersdir)/rtfhtml.cpp +PLFIL += $(filtersdir)/rtfplain.cpp PLFIL += $(filtersdir)/greeklexattribs.cpp PLFIL += $(filtersdir)/papyriplain.cpp Added: trunk/src/modules/filters/rtfplain.cpp =================================================================== --- trunk/src/modules/filters/rtfplain.cpp (rev 0) +++ trunk/src/modules/filters/rtfplain.cpp 2024-04-23 14:37:56 UTC (rev 3895) @@ -0,0 +1,93 @@ +/*************************************************************************** + * + * rtfplain.cpp - filter to convert RTF to plain text + * + * $Id: rtfplain.cpp 3749 2020-07-06 23:51:56Z scribe $ + * + * Copyright 1999 The team of Bibletime (info at bibletime.de) + * Copyright 2000-2013 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 +#include +#include +#include +#include +#include + +SWORD_NAMESPACE_START + +RTFPlain::RTFPlain() +{ +} + + +char RTFPlain::processText(SWBuf &text, const SWKey *key, const SWModule *module) +{ + bool center = false; + + const char *from; + SWBuf orig = text; + from = orig.c_str(); + for (text = ""; *from; from++) + { + if (*from == '\\') // a RTF command + { + // \u12345? + if ( *(from+1) == 'u' && (*(from+2) == '-' || isdigit(*(from+2)))) { + from += 2; + const char *end = from; + while (isdigit(*++end)); + SWBuf num; + num.append(from, end-from); + SW_s16 n = atoi(num.c_str()); + SW_u32 u = (SW_u16)n; + getUTF8FromUniChar(u, &text); + from += (end-from); + continue; + } + if (!strncmp(from+1, "pard", 4)) { // switch all modifiers off + if (center) { + center = false; + } + from += 4; + continue; + } + if (!strncmp(from+1, "par", 3)) { + text += "\n"; + from += 3; + continue; + } + if (from[1] == ' ') { + from += 1; + continue; + } + if (!strncmp(from+1, "qc", 2)) { // center on + if (!center) { + text += "\t\t"; + center = true; + } + from += 2; + continue; + } + } + + text += *from; + } + return 0; +} + +SWORD_NAMESPACE_END