Re: [greenstone-users] highlighting messes up macros [PROVISIONALLY SOLVED]

From jens wille
DateWed, 05 Oct 2005 01:03:22 +0200
Subject Re: [greenstone-users] highlighting messes up macros [PROVISIONALLY SOLVED]
In-Reply-To (4342E5A9-7040706-cs-waikato-ac-nz)
hi katherine!

on 04.10.2005 22:27, Katherine Don wrote:
> but maybe you could modify highlighttext so that it skips over
> macros and their arguments?
now i modified highlighttext to skip over macro arguments (only
arguments, not names - at least not yet) and this seems to have
solved my problems :-)

since my knowledge of c++ is utterly poor i just copied the "skip
over html tags" part and tried to add a check for the next character
- maybe anyone could tidy that up ;-)

here goes:

if (*here == '_') {
text_t::const_iterator next = here; // is this really necessary?
++next; // just want to check the
if (*next == '(') { // next character
// skip over macro arguments
while ((here != end) && (*here != ')')) {

(in both highlight_terms and highlight_phrases)

the drawback now is that text which occurs within macro arguments
(and is indeed intended to be highlighted) won't get highlighted.
so it might be best to do the highlighting _after_ the macros have
been expanded (this would also cricumvent the need to skip over
macro names) - are there any objections against that? if i can
figure out how to do it i might give it a try ;-)

thanks & best regards