From 20263805178077fde0038a47e6b4310d7fe62142 Mon Sep 17 00:00:00 2001 From: Teus Benschop Date: Wed, 17 Oct 2018 14:17:24 +0200 Subject: New upstream version 1.7.4 --- src/modules/filters/osisplain.cpp | 4 +-- src/modules/filters/osiswebif.cpp | 9 ++++++- src/modules/filters/osisxhtml.cpp | 57 +++++++++++++++++++++++++++++---------- 3 files changed, 53 insertions(+), 17 deletions(-) (limited to 'src/modules/filters') 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 = ""; + u->interModuleLinkEnd = ""; + 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 = " "; wordsOfChristEnd = " "; + interModuleLinkStart = ""; + interModuleLinkEnd = ""; 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("", + buf.appendFormatted(u->interModuleLinkStart, URL::encode(work.c_str()).c_str(), URL::encode(ref.c_str()).c_str() ); } } else { - outText("", 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("", u->lineStack->size() + (SWBuf("x-indent") == tag.getAttribute("type")?1:0)).c_str(), buf, u); + SWBuf type = tag.getAttribute("type"); + if (type == "selah") { + outText("

", buf, u); + } else { + // nested lines plus if the line itself has an x-indent type attribute value + outText(SWBuf("", 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("", buf, u); - u->outputNewline(buf); + SWBuf type = ""; + if (!u->lineStack->empty()) { + XMLTag startTag(u->lineStack->top()); + type = startTag.getAttribute("type"); + } + if (type == "selah") { + outText("

", buf, u); + } else { + outText("
", buf, u); + u->outputNewline(buf); + } if (u->lineStack->size()) u->lineStack->pop(); } // without eID or sID @@ -450,31 +470,36 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * // 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); } } } -- cgit v1.2.3