plaintorich: only setup beacons if needed

This commit is contained in:
dockes 2007-06-25 10:13:40 +00:00
parent e892ca4fa4
commit d58f028319
3 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.24 2007-06-12 13:31:38 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.25 2007-06-25 10:13:39 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -342,7 +342,7 @@ static string termBeacon(int i)
// editor's find() function to position on it
bool plaintorich(const string& in, string& out,
const HiliteData& hdata,
bool noHeader, bool)
bool noHeader, bool needBeacons)
{
Chrono chron;
out.erase();
@ -413,7 +413,8 @@ bool plaintorich(const string& in, string& out,
if (tPosIt != tboffsend) {
int ibyteidx = chariter.getBpos();
if (ibyteidx == tPosIt->first) {
out += termBeacon(anchoridx++);
if (needBeacons)
out += termBeacon(anchoridx++);
out += "<termtag>";
} else if (ibyteidx == tPosIt->second) {
// Output end tag, then skip all highlight areas that

View File

@ -16,7 +16,7 @@
*/
#ifndef _PLAINTORICH_H_INCLUDED_
#define _PLAINTORICH_H_INCLUDED_
/* @(#$Id: plaintorich.h,v 1.13 2007-05-23 09:19:48 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: plaintorich.h,v 1.14 2007-06-25 10:13:40 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
@ -39,12 +39,12 @@ struct HiliteData {
* @param hdata terms and groups to be highlighted. These are
* lowercase and unaccented.
* @param noHeader if true don't output header (<qt><title>...)
* @param fft If true mark the first term position in the text
* @param needBeacons Need to navigate highlighted terms, mark them.
*/
extern bool plaintorich(const string &in, string &out,
const HiliteData& hdata,
bool noHeader = false,
bool fft = false);
bool needBeacons = true);
extern string termAnchorName(int i);

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.27 2007-06-19 08:36:24 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.28 2007-06-25 10:13:40 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <time.h>
@ -473,7 +473,7 @@ void ResList::resultPageNext()
}
// No need to call escapeHtml(), plaintorich handles it
string richabst;
plaintorich(abstract, richabst, hdata, true);
plaintorich(abstract, richabst, hdata, true, false);
// Links;
string linksbuf;