Thank a lot Bill,
it works now as it should !
I followed you advice and defined a new parameter in hash of the config
file
# Example swish.cgi configuration script.
return {
title =3D> 'My swish-e search model x ',
max_query_length =3D> 300,
...
...
# 2004-05-06 list properties that should be presented as html-links
# these are full "<A href=3D .. </a>" html-links.
props_not2escape =3D> 'LinkToAleph LinkToDocText',
}
Then modified swish.cgi
Original:
# not highlighted, so escape
html_escape( $props->{$prop} ); # standard swish.cgi code
suppresses html links in properties :-(
New:
# vbe; 2004-04-06 mod. code, excludes "<a href html" properties =
from
# html-escaping thus providing html-linking out from the =
property
field.
# List the properties in the string props_not2escape in the
.swishcgi.conf
#
html_escape( $props->{$prop} )
unless index( $self->{config}{props_not2escape},$prop) > =
-1;
# 2004-04-06 mod. END
V. Babitchev
The Austrian Library Network
----- Original Message -----
From: "Bill Moseley" <moseley@hank.org>
To: "Multiple recipients of list" <swish-e@sunsite.berkeley.edu>
Sent: Thursday, May 06, 2004 16:46
Subject: [SWISH-E] Re: URL display in property
> On Thu, May 06, 2004 at 06:03:56AM -0700, Victor Babitchev wrote:
> > Hi,
> >
> > I defined one property ("LinkToAleph") that should be displayed as =
link,
=3D
> > instead the URL is displayed as a plain text.
> >
> > 1 Good test title ... -- rank: 1000
> >
> > Year: 2002
> > swishdocsize: 31324
> > LinkToAleph: <A =3D
> > HREF=3D<a =
"http://magnum.bibvb.ac.at/ALEPH/-/ext-find?base=3DACC01&find=3DID
> > N=3DAC00000000" target=3D"_blank">AC00000000</A>
> >
> >
> > Can one give me a tip where should I look at? (I could not not find =
it =3D
> > in the discussion list).
>
> There's not way to do that swish the default swish.cgi program.
>
> Is LinkToAleph just a URL or a bit of HTML that includes the <a> tag?
>
> The basic problem is swish.cgi assumes all "display_props" are text
> properties and will HTML-escape them. That's done in swish.cgi =
itself.
>
> # HTML escape all properties that were not highlighted
> for my $prop (keys %$props) {
> next if $highlighted->{$prop};
>
> # not highlighted, so escape
> html_escape( $props->{$prop} );
>
> So, if the property is a full link then you would need to change
swish.cgi.
> so the HTML is not escaped for that property.
>
> html_escape( $props->{$prop} )
> unless $prop eq 'LinkToAleph';
>
> (You would probably want to add a hash to the config file that has the
> names of the properties to not escape and check the hash instead of
> hard-coding the property names in swish.cgi.)
>
> If LinkToAleph is just a URL then you would want to adjust the =
template
> (or template module) code to modify the way the property is written.
>
> The other example program, search.cgi, is better for customizing the
> output. In that case, search.cgi provides raw data to the template
> module and then how things are displayed are defined in the template =
--
> where they should be.
>
> For example, in the template for search.cgi the title link is created
> like:
>
> <a href=3D"[% item.Property('swishdocpath') | uri | html %]">
> [% item.Property('swishtitle') || =
item.Property('swishdocpath') |
html %]</a>
>
> So the href is filtered by the "uri" and "html" filters, and the link
> text is filtered just by the "html" filter.
>
>
> > In the previous ver. of swish-e (2002) the same construct worked.
>
> With swish.cgi and the HTML markup stored in the property? That would
> have been a bug to allow non-escaped HTML into the output.
>
> --
> Bill Moseley
> moseley@hank.org
>
>
*********************************************************************
Due to deletion of content types excluded from this list by policy,
this multipart message was reduced to a single part, and from there
to a plain text message.
*********************************************************************
Received on Thu May 6 13:47:26 2004