misc small mods to help with building kio_recoll

This commit is contained in:
dockes
2006-01-19 12:01:43 +00:00
parent 4bcdb17480
commit 6e0ec42dad
25 changed files with 504 additions and 238 deletions
+4 -20
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.6 2005-11-24 07:16:16 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.7 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
@@ -49,25 +49,6 @@ class myTextSplitCB : public TextSplitCB {
}
};
// Just strip/escape things that would look like markup
string stripMarkup(const string &in)
{
string out;
for (string::size_type pos = 0; pos < in.length(); pos++) {
switch(in.at(pos)) {
case '<':
out += "&lt;";
break;
case '&':
out += "&amp;";
break;
default:
out += in.at(pos);
}
}
return out;
}
// Fix result text for display inside the gui text window.
//
// To compute the term character positions in the output text, we have
@@ -83,6 +64,9 @@ string plaintorich(const string &in, const list<string>& terms,
termoffsets.erase(termoffsets.begin(), termoffsets.end());
// We first use the text splitter to break the text into words,
// and compare the words to the search terms, which yields the
// query terms positions inside the text
myTextSplitCB cb(terms);
TextSplit splitter(&cb, true);
// Note that splitter returns the term locations in byte, not
+6 -5
View File
@@ -1,20 +1,21 @@
#ifndef _PLAINTORICH_H_INCLUDED_
#define _PLAINTORICH_H_INCLUDED_
/* @(#$Id: plaintorich.h,v 1.2 2005-10-10 13:24:53 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: plaintorich.h,v 1.3 2006-01-19 12:01:43 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
/**
* Fix result text for display inside the gui text window.
* Transform plain text into qt rich text for the preview window.
*
* We mainly escape characters like < or &, and add qt rich text tags to
* colorize the query terms.
*
* @param in raw text out of internfile.
* @param terms list of query terms
* @param termoffsets character offsets where we find terms
* @param termoffsets output: character offsets where we find terms.
*/
extern string plaintorich(const string &in,
const list<string>& terms,
list<pair<int, int> >&termoffsets);
extern string stripMarkup(const string &in);
#endif /* _PLAINTORICH_H_INCLUDED_ */
+1 -1
View File
@@ -550,7 +550,7 @@ void RecollMain::showResultPage()
strftime(datebuf, 99,
"<i>Modified:</i>&nbsp;%Y-%m-%d&nbsp;%H:%M:%S", tm);
}
string abst = stripMarkup(doc.abstract);
string abst = escapeHtml(doc.abstract);
LOGDEB1(("Abstract: {%s}\n", abst.c_str()));
if (!img_name.empty()) {
result += "<img source=\"" + img_name + "\" align=\"left\">";