Support for CQL transformations involving wildcard patterns, which
were previously passed through untouched. We now make an effort to
emit the most primitive (i.e. Bath-friendly) truncation attributes we
can, based on what's in the configuration file, falling back on
Z59.58-like wildcarding when necessary.
The logic turns out to be non-trival (sigh ... so unlike an OpenURL
resolver.) Although the code, once I'd finally arrived at it, turned
out to be gratifying short and clear:
If a term begins and ends with * and has no other WC
characters in it AND we have a truncation.both element in the
configuration file, strip the *s and use truncation.both.
Otherwise, if it begins with * and has no other WC characters
in it AND truncation.left is configured, use that.
Otherwise, if it ends with * and has no other WC characters
in it AND truncation.right is configured, use that.
Otherwise, if it has any WCs anywhere in the string,
transliterate * to ? and ? to # and use truncation.z3958,
generating error 28 "Masking character not supported" if it's
not configured.
Otherwise it must be the case that it has no WCs. Use
truncation.none, generating error 30 "Too many masking
characters in term" if it's not configured.
This arrangement allows some flexibility in the configuration file,
e.g. you can omit the special-case left-, right- and both-truncation
elements if you always want Z39.58-style truncation.
I also fixed a small and harmless bug of Adam's, which I am pretty
sure could _never_ have any effect, but which offended me anyway.
This change is far too trivial to be worth mentioning in the CVS log,
but I'm expecting Adam to read this, and probably go and see what the
bug was :-)