Gilles Detillieux wrote:
> 
> According to Geoff Hutchison:
> > On Tue, 17 Apr 2001, Berthold Cogel wrote:
> > >[snip]
> > > (description of strange results with user-defined variables)
> > > Is this a bug or a feature?
> >
> > I would classify it as a bug. What version of ht://Dig are you using?
> 
> The problem is in ParsedString::get(), and probably affects all versions.
> It uses isalpha() instead of isalnum().  If you change it, you will be
> able to reference attribute names that contain digits, such as ${name1}.
> 
> --
> Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
> Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
> Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
> Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
> 
> _______________________________________________
> htdig-general mailing list <[EMAIL PROTECTED]>
> To unsubscribe, send a message to <[EMAIL PROTECTED]> with 
>a subject of unsubscribe
> FAQ: http://htdig.sourceforge.net/FAQ.html

OK! But changing isalpha() to isalnum() in ParsedString::get() in
htlib/ParsedString.cc did only the first part of the job.

I've defined an attribute 'use_template' (and patched into htsearch.cc),
which I use to select includes with different 'template_map'
definitions. Now my users are able to use different named combinations
of templates in 'template_map', without using any real path or file
names. This is something my administrator requested (Even 'common_dir'
is created out of an attribute 'template_dir' and the document root of
our server).
All a user can do, is to select a predefined template map and to define
the template descriptions shown in his form. Therefore he has to use
some attributes user1, user2 ... . And of course he can create his own
templates 'user1.html' and 'user2.html' ..., which he can put in his
'template_dir'.
 
I defined an attribute user1 in my form and tried to forward the
attribute in my templates for a refined search: 

def.:    <input type="hidden" name="user1" value="template1">

forward: <input type="hidden" name="user1" value="$&(USER1)">

htsearch shows the selected template in his output. But when I take a
closer look at the page source, I see this:

<input type="hidden" name="user1" value=")">

So the first request worked and produced the desired output, but I'm
unable to do a refined search because the forward of the attribute is
broken.

I had to change isalpha() to isalnum() in Display::expandVariables() in
htsearch/Display.cc to get the forwarding to work. See the diffs down
below.

Oh, and I'm using htdig 3.1.5.


Berthold Cogel

-- 
Dr. rer. nat. Berthold Cogel                   University of Cologne
E-Mail: [EMAIL PROTECTED]                 ZAIK-US (RRZK)
Tel.:   +49(0)221/478-7020                     Robert-Koch-Str. 10
FAX:    +49(0)221/478-5568                     D-50931 Cologne - Germany

----------:<--------------------:<--------------------:<----------

*** htlib/ParsedString.cc.orig  Fri Feb 25 03:29:11 2000
--- htlib/ParsedString.cc       Thu Jun  7 14:21:55 2001
***************
*** 100,106 ****
              if (need_delim)
                  str++;
              variable = 0;
!             while (isalpha(*str) || *str == '_' || *str == '-')
              {
                  variable << *str++;
              }
--- 100,106 ----
              if (need_delim)
                  str++;
              variable = 0;
!             while (isalnum(*str) || *str == '_' || *str == '-')
              {
                  variable << *str++;
              }


*** htsearch/Display.cc.orig    Fri Feb 25 03:29:11 2000
--- htsearch/Display.cc Thu Jun  7 14:19:03 2001
***************
*** 915,921 ****
                }
                else if (*str == '(' || *str == '{')
                    state = StVarClose;
!               else if (isalpha(*str) || *str == '_')
                {
                    var << *str;
                    state = StVarPlain;
--- 915,921 ----
                }
                else if (*str == '(' || *str == '{')
                    state = StVarClose;
!               else if (isalnum(*str) || *str == '_')
                {
                    var << *str;
                    state = StVarPlain;
***************
*** 926,938 ****
            case StVarClose:
                if (*str == ')' || *str == '}')
                    state = StGotVar;
!               else if (isalpha(*str) || *str == '_')
                    var << *str;
                else
                    state = StStart;
                break;
            case StVarPlain:
!               if (isalpha(*str) || *str == '_')
                    var << *str;
                else
                {
--- 926,938 ----
            case StVarClose:
                if (*str == ')' || *str == '}')
                    state = StGotVar;
!               else if (isalnum(*str) || *str == '_')
                    var << *str;
                else
                    state = StStart;
                break;
            case StVarPlain:
!               if (isalnum(*str) || *str == '_')
                    var << *str;
                else
                {
$

_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a 
subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to