From 936d9e8484ff73282c8c0a277310d1ffdde86e10 Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Sat, 29 Mar 2014 10:54:02 -0400 Subject: Imported Upstream version 1.6.1+dfsg --- src/modules/filters/Makefile.am | 7 ++----- src/modules/filters/osishtmlhref.cpp | 24 +++++++++++++++--------- src/modules/filters/osisrtf.cpp | 16 ++++++++-------- src/modules/filters/teirtf.cpp | 2 +- src/modules/filters/utf8transliterator.cpp | 9 +++++++++ 5 files changed, 35 insertions(+), 23 deletions(-) (limited to 'src/modules/filters') diff --git a/src/modules/filters/Makefile.am b/src/modules/filters/Makefile.am index f212cbf..80e65d9 100644 --- a/src/modules/filters/Makefile.am +++ b/src/modules/filters/Makefile.am @@ -83,13 +83,11 @@ SWICUSRC += $(filtersdir)/utf8nfkd.cpp SWICUSRC += $(filtersdir)/utf8arshaping.cpp SWICUSRC += $(filtersdir)/utf8bidireorder.cpp -if ICU -ICUDEFS = -D_ICU_ +if HAVE_ICU DISTSWICUSRC = SWREALICUSRC = $(SWICUSRC) else -if ICUSWORD -ICUDEFS = -D_ICU_ -D_ICUSWORD_ +if HAVE_ICUSWORD DISTSWICUSRC = SWREALICUSRC = $(SWICUSRC) else @@ -98,7 +96,6 @@ SWREALICUSRC = endif endif -AM_CPPFLAGS += $(ICUDEFS) libsword_la_SOURCES += $(SWREALICUSRC) EXTRA_DIST = $(DISTSWICUSRC) diff --git a/src/modules/filters/osishtmlhref.cpp b/src/modules/filters/osishtmlhref.cpp index 6fce987..bdabd83 100644 --- a/src/modules/filters/osishtmlhref.cpp +++ b/src/modules/filters/osishtmlhref.cpp @@ -83,8 +83,8 @@ OSISHTMLHREF::OSISHTMLHREF() { setTokenCaseSensitive(true); - addTokenSubstitute("lg", "
"); - addTokenSubstitute("/lg", "
"); + // addTokenSubstitute("lg", "
"); + // addTokenSubstitute("/lg", "
"); morphFirst = false; } @@ -194,11 +194,17 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat outText(val, buf, u); } if ((attrib = tag.getAttribute("gloss"))) { + // I'm sure this is not the cleanest way to do it, but it gets the job done + // for rendering ruby chars properly ^_^ + buf -= lastText.length(); + + outText("", buf, u); + outText(lastText, buf, u); val = strchr(attrib, ':'); val = (val) ? (val + 1) : attrib; - outText("(", buf, u); + outText("(", buf, u); outText(val, buf, u); - outText(")", buf, u); + outText(")", buf, u); } if (!morphFirst) { processLemma(u->suspendTextPassThru, tag, buf); @@ -272,8 +278,8 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat } } - //

paragraph tag - else if (!strcmp(tag.getName(), "p")) { + //

paragraph and linegroup tags + else if (!strcmp(tag.getName(), "p") || !strcmp(tag.getName(), "lg")) { if ((!tag.isEndTag()) && (!tag.isEmpty())) { // non-empty start tag outText("
", buf, u); } @@ -474,7 +480,7 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat else if (!strcmp(tag.getName(), "hi")) { SWBuf type = tag.getAttribute("type"); if ((!tag.isEndTag()) && (!tag.isEmpty())) { - if (type == "b" || type == "x-b") { + if (type == "bold" || type == "b" || type == "x-b") { outText("", buf, u); u->inBold = true; } @@ -602,9 +608,9 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat outText(URL::encode(u->version.c_str()).c_str(), buf, u); outText("\">", buf, u); - outText("", buf, u); + outText("\" border=\"0\" />", buf, u); outText("", buf, u); } diff --git a/src/modules/filters/osisrtf.cpp b/src/modules/filters/osisrtf.cpp index 84801e3..b8cf30c 100644 --- a/src/modules/filters/osisrtf.cpp +++ b/src/modules/filters/osisrtf.cpp @@ -87,8 +87,8 @@ OSISRTF::OSISRTF() { addEscapeStringSubstitute("lt", "<"); addEscapeStringSubstitute("gt", ">"); addEscapeStringSubstitute("quot", "\""); - addTokenSubstitute("lg", "{\\par}"); - addTokenSubstitute("/lg", "{\\par}"); + // addTokenSubstitute("lg", "{\\par}"); + // addTokenSubstitute("/lg", "{\\par}"); setTokenCaseSensitive(true); } @@ -239,8 +239,8 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us if (!tag.isEmpty()) { SWBuf type = tag.getAttribute("type"); - if ( (type != "x-strongsMarkup") // leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off - && (type != "strongsMarkup") // deprecated + if ((type != "x-strongsMarkup") // leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off + && (type != "strongsMarkup") // deprecated ) { SWBuf footnoteNumber = tag.getAttribute("swordFootnote"); VerseKey *vkey = NULL; @@ -265,8 +265,8 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us } } - //

paragraph tag - else if (!strcmp(tag.getName(), "p")) { + //

paragraph and linegroup tags + else if (!strcmp(tag.getName(), "p") || !strcmp(tag.getName(), "lg")) { if ((!tag.isEndTag()) && (!tag.isEmpty())) { // non-empty start tag outText("{\\fi200\\par}", buf, u); } @@ -275,7 +275,7 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us userData->supressAdjacentWhitespace = true; } else { // empty paragraph break marker - outText("{\\pard\\par\\par}", buf, u); + outText("{\\pard\\par}", buf, u); userData->supressAdjacentWhitespace = true; } } @@ -373,7 +373,7 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us else if (!strcmp(tag.getName(), "hi")) { SWBuf type = tag.getAttribute("type"); if ((!tag.isEndTag()) && (!tag.isEmpty())) { - if (type == "b" || type == "x-b") + if (type == "bold" || type == "b" || type == "x-b") outText("{\\b1 ", buf, u); else // all other types outText("{\\i1 ", buf, u); diff --git a/src/modules/filters/teirtf.cpp b/src/modules/filters/teirtf.cpp index 8560f5c..8e135b5 100644 --- a/src/modules/filters/teirtf.cpp +++ b/src/modules/filters/teirtf.cpp @@ -159,7 +159,7 @@ bool TEIRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *use SWBuf type = tag.getAttribute("type"); SWBuf footnoteNumber = tag.getAttribute("swordFootnote"); - VerseKey *vkey; + VerseKey *vkey = 0; // see if we have a VerseKey * or descendant SWTRY { vkey = SWDYNAMIC_CAST(VerseKey, u->key); diff --git a/src/modules/filters/utf8transliterator.cpp b/src/modules/filters/utf8transliterator.cpp index 552ec3e..d6aafe2 100644 --- a/src/modules/filters/utf8transliterator.cpp +++ b/src/modules/filters/utf8transliterator.cpp @@ -83,6 +83,7 @@ const char UTF8Transliterator::optionstring[NUMTARGETSCRIPTS][16] = { // "Ogham", // "Thaana", // "Glagolitic", + // "Cherokee", }; const char UTF8Transliterator::optName[] = "Transliteration"; @@ -403,6 +404,7 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu case UBLOCK_OGHAM: scripts[SE_OGHAM] = true; break; case UBLOCK_THAANA: scripts[SE_THAANA] = true; break; case UBLOCK_GLAGOLITIC: scripts[SE_GLAGOLITIC] = true; break; + case UBLOCK_CHEROKEE: scripts[SE_CHEROKEE] = true; break; // case UBLOCK_TENGWAR: scripts[SE_TENGWAR] = true; break; // case UBLOCK_CIRTH: scripts[SE_CIRTH] = true; break; case UBLOCK_CJK_RADICALS_SUPPLEMENT: @@ -637,6 +639,10 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu scripts[SE_LATIN] = true; } } + if (scripts[SE_CHEROKEE]) { + addTrans("Cherokee-Latin", &ID); + scripts[SE_LATIN] = true; + } if (scripts[SE_THAI]) { addTrans("Thai-Latin", &ID); scripts[SE_LATIN] = true; @@ -869,6 +875,9 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu case SE_GLAGOLITIC: addTrans("Latin-Glagolitic", &ID); break; + case SE_CHEROKEE: + addTrans("Latin-Cherokee", &ID); + break; // case SE_TENGWAR: // addTrans("Latin-Tengwar", &ID); // break; -- cgit v1.2.3