[greenstone-users] Classifier macros

From Katherine Don
DateWed Oct 21 12:28:12 2009
Subject [greenstone-users] Classifier macros
In-Reply-To (D6B530A1090A224EA17A37D3BFE35F5E39AF12C0AD-XVS2-CLUSTER-yu-yale-edu)
Hi Arthur

After a bit of fiddling, I came up with the following:

If you only have two levels, then you can use something like the
following in CLXVlist format statement:

close this section

If you have more than two, this will give

* section title
** close this section
*** book title
*** book title
*** book title

To get close this section for both the open bookshelves, use
close this section

sw == starts with

This doesn't distinguish between the first and second open bookshelves.
If you wanted to do that, probably using javascript to count the '.' in
CL3.8.10 (the current open classifier node) and [DocOID] - the oid of
the doc/bookshelf to link to, and compare them would work.

I hope this helps,
regards,
Katherine

Belanger, Arthur wrote:
> Katherine,
>
> Thanks for the response. I was afraid that was the case.
>
> Perhaps if I explain the end result of what I am trying to accomplish, you or someone else may be able to help.
>
> When using a browsing classifier, AZCompactList in my case, a format statement such as [link][Title][/link] ([numleafdocs]) produces something like the following:
>
> Apple (3)
> Arugula (5)
> Asparagus (1)
>
> Apple, Arugula and Asparagus are links which open a bookshelf (classifier node) containing the documents. When licking Apple, he same format statement produces something like:
>
> Apple (3)
> Apple Pie and Ice Cream ()
> How to make Apple Cider ()
> Varieties of Apples and Their Uses ()
>
> The last 3 lines are links to the actual documents. The empty parentheses indicate that there are no nodes below the document, that is [numleafdocs] does not exist.
>
> The Apple line is a link back to the list, closing the bookshelf. So, the Greenstone server "knows" when to generate the "close bookshelf" link. I would like to be able to detect this myself so I can change the [Title] to something like "Back to Subject list". An {if} statement in my format would look something like this:
>
> {If}{_test-for-closing-bookshelf_,[link]Back to Subject List[/link],[link][title][/link]
>
> Producing:
>
> Back to Subject List
> Apple Pie and Ice Cream
> How to make Apple Cider
> Varieties of Apples and Their Uses
>
> Is there such a test available via a macro or system generated piece of metadata (like [numleafdocs]) that I can use for the test?
>
> I hope this explanation is clearer than my original post.
>
> Thanks very much.
>
>