diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/filters/osisplain.cpp | 4 | ||||
-rw-r--r-- | src/modules/filters/osiswebif.cpp | 9 | ||||
-rw-r--r-- | src/modules/filters/osisxhtml.cpp | 57 | ||||
-rw-r--r-- | src/modules/swmodule.cpp | 4 |
4 files changed, 55 insertions, 19 deletions
diff --git a/src/modules/filters/osisplain.cpp b/src/modules/filters/osisplain.cpp index 24f5518..d594028 100644 --- a/src/modules/filters/osisplain.cpp +++ b/src/modules/filters/osisplain.cpp @@ -2,7 +2,7 @@ * * osisplain.cpp - An SWFilter that provides stripping of OSIS tags * - * $Id: osisplain.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ + * $Id: osisplain.cpp 3290 2014-12-04 04:54:52Z greg.hellings $ * * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -235,7 +235,7 @@ bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * } else { buf.append("*"); - buf.append(u->lastTextNode); + buf.append(u->lastSuspendSegment); buf.append("*"); } u->suspendTextPassThru = false; diff --git a/src/modules/filters/osiswebif.cpp b/src/modules/filters/osiswebif.cpp index 2cbca0b..4894777 100644 --- a/src/modules/filters/osiswebif.cpp +++ b/src/modules/filters/osiswebif.cpp @@ -3,7 +3,7 @@ * osiswebif.cpp - OSIS to HTML filter with hrefs for strongs and * morph tags * - * $Id: osiswebif.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: osiswebif.cpp 3285 2014-12-03 06:14:50Z greg.hellings $ * * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -37,6 +37,13 @@ OSISWEBIF::OSISWEBIF() : baseURL(""), passageStudyURL(baseURL + "passagestudy.js } +BasicFilterUserData *OSISWEBIF::createUserData(const SWModule *module, const SWKey *key) { + MyUserData *u = (MyUserData *)OSISXHTML::createUserData(module, key); + u->interModuleLinkStart = "<a href=\"#\" onclick=\"return im('%s', '%s');\">"; + u->interModuleLinkEnd = "</a>"; + return u; +} + bool OSISWEBIF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) { MyUserData *u = (MyUserData *)userData; SWBuf scratch; diff --git a/src/modules/filters/osisxhtml.cpp b/src/modules/filters/osisxhtml.cpp index 3f75c4a..fb743e2 100644 --- a/src/modules/filters/osisxhtml.cpp +++ b/src/modules/filters/osisxhtml.cpp @@ -2,7 +2,7 @@ * * osisxhtml.cpp - Render filter for classed XHTML of an OSIS module * - * $Id: osisxhtml.cpp 3205 2014-05-01 02:31:28Z greg.hellings $ + * $Id: osisxhtml.cpp 3290 2014-12-04 04:54:52Z greg.hellings $ * * Copyright 2011-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -43,7 +43,11 @@ const char *OSISXHTML::getHeader() const { .indent2 { margin-left: 20px }\n\ .indent3 { margin-left: 30px }\n\ .indent4 { margin-left: 40px }\n\ + .small-caps { font-variant: small-caps; }\n\ + .selah { text-align: right; width: 50%; margin: 0; padding: 0; }\n\ + .acrostic { text-align: center; }\n\ "; + // Acrostic for things like the titles in Psalm 119 return header; } @@ -161,6 +165,8 @@ OSISXHTML::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : Ba suspendLevel = 0; wordsOfChristStart = "<span class=\"wordsOfJesus\"> "; wordsOfChristEnd = "</span> "; + interModuleLinkStart = "<a href=\"sword://%s/%s\">"; + interModuleLinkEnd = "</a>"; if (module) { osisQToTick = ((!module->getConfigEntry("OSISqToTick")) || (strcmp(module->getConfigEntry("OSISqToTick"), "false"))); version = module->getName(); @@ -379,14 +385,14 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * else { // Dictionary link, or something - buf.appendFormatted("<a href=\"sword://%s/%s\">", + buf.appendFormatted(u->interModuleLinkStart, URL::encode(work.c_str()).c_str(), URL::encode(ref.c_str()).c_str() ); } } else { - outText("</a>", buf, u); + outText(u->interModuleLinkEnd, buf, u); } } } @@ -395,14 +401,28 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * else if (!strcmp(tag.getName(), "l")) { // start line marker if (tag.getAttribute("sID") || (!tag.isEndTag() && !tag.isEmpty())) { - // nested lines plus if the line itself has an x-indent type attribute value - outText(SWBuf("<span class=\"line indent").appendFormatted("%d\">", u->lineStack->size() + (SWBuf("x-indent") == tag.getAttribute("type")?1:0)).c_str(), buf, u); + SWBuf type = tag.getAttribute("type"); + if (type == "selah") { + outText("<p class=\"selah\">", buf, u); + } else { + // nested lines plus if the line itself has an x-indent type attribute value + outText(SWBuf("<span class=\"line indent").appendFormatted("%d\">", u->lineStack->size() + (SWBuf("x-indent") == tag.getAttribute("type")?1:0)).c_str(), buf, u); + } u->lineStack->push(tag.toString()); } // end line marker else if (tag.getAttribute("eID") || tag.isEndTag()) { - outText("</span>", buf, u); - u->outputNewline(buf); + SWBuf type = ""; + if (!u->lineStack->empty()) { + XMLTag startTag(u->lineStack->top()); + type = startTag.getAttribute("type"); + } + if (type == "selah") { + outText("</p>", buf, u); + } else { + outText("</span>", buf, u); + u->outputNewline(buf); + } if (u->lineStack->size()) u->lineStack->pop(); } // <l/> without eID or sID @@ -450,31 +470,36 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * // <title> else if (!strcmp(tag.getName(), "title")) { if ((!tag.isEndTag()) && (!tag.isEmpty())) { + SWBuf type = tag.getAttribute("type"); + bool keepType = false; + if (type.size()) { + keepType = true; + } VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, u->key); if (vkey && !vkey->getVerse()) { if (!vkey->getChapter()) { if (!vkey->getBook()) { if (!vkey->getTestament()) { - buf += "<h1 class=\"moduleHeader\">"; + buf += SWBuf("<h1 class=\"moduleHeader ") + (keepType ? type : "") + "\">"; tag.setAttribute("pushed", "h1"); } else { - buf += "<h1 class=\"testamentHeader\">"; + buf += SWBuf("<h1 class=\"testamentHeader ") + (keepType ? type : "") + "\">"; tag.setAttribute("pushed", "h1"); } } else { - buf += "<h1 class=\"bookHeader\">"; + buf += SWBuf("<h1 class=\"bookHeader ") + (keepType ? type : "") + "\">"; tag.setAttribute("pushed", "h1"); } } else { - buf += "<h2 class=\"chapterHeader\">"; + buf += SWBuf("<h2 class=\"chapterHeader ") + (keepType ? type : "") + "\">"; tag.setAttribute("pushed", "h2"); } } else { - buf += "<h3>"; + buf += SWBuf("<h3 class=\"") + (keepType ? type : "") + "\">"; tag.setAttribute("pushed", "h3"); } u->titleStack->push(tag.toString()); @@ -571,8 +596,10 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * else if (type == "sub") { outText("<sub>", buf, u); } - else { // all other types + else if (type == "i" || type == "italic") { outText("<i>", buf, u); + } else { // all other types + outText(SWBuf("<span class=\"") + type + SWBuf("\">"), buf, u); } u->hiStack->push(tag.toString()); } @@ -596,8 +623,10 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * else if (type == "sub") { outText("</sub>", buf, u); } - else { + else if (type == "i" || type == "italic") { outText("</i>", buf, u); + } else { + outText("</span>", buf, u); } } } diff --git a/src/modules/swmodule.cpp b/src/modules/swmodule.cpp index 6944c4e..a2d7873 100644 --- a/src/modules/swmodule.cpp +++ b/src/modules/swmodule.cpp @@ -4,7 +4,7 @@ * for all types of modules (e.g. texts, commentaries, * maps, lexicons, etc.) * - * $Id: swmodule.cpp 2976 2013-09-10 14:09:44Z scribe $ + * $Id: swmodule.cpp 3282 2014-12-03 06:09:06Z greg.hellings $ * * Copyright 1999-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -295,7 +295,7 @@ char SWModule::setKey(const SWKey *ikey) { if (oldKey) delete oldKey; - return 0; + return error = key->popError(); } |