This question about Using an extension: Answered
Is using text in parentheses to group the intended behaviour?
According to the documentation for the MAKEINDEX mode of this plugin:
"Like in FORMATLIST the format
parameter can make use of $1
, $2
, ... variables to match the groupings defined in the pattern
argument (like in pattern="(.*);(.*);(.*)"
) . The first matched grouping $1 will be used as the $item to sort the list."
When I tried this though, it seems that if the list item happens to have some text in parentheses - no matter if those parentheses occur after the first matched group - then it sorts/groups based on the text in parentheses. This seems to be intended since
, looking at http://foswiki.org/Extensions/FilterPlugin#MAKEINDEX_example_1:_creating_an_index_from_a_chunk_of_text the plugin is automatically taking text that is in parantheses in each item and using that to group the items. In my case though, this is undesirable behavior. My list items include names and phone numbers and some of those phone numbers have parentheses. I want to sort and group by name only, but there doesn't seem to be a way to do that.
For now I've disabled the "sort by text in parentheses" behavior by commenting out the part of the code that implements this.
--
LeilaPearson - 25 Mar 2014
Easier to have an explicit grouping in the
pattern
parameter to capture all of the string.
--
MichaelDaum - 25 Mar 2014
Thanks for the response. Not sure I understand the suggestion though. Here's an example:
%MAKEINDEX{
"John Smith; (111) 555-1234 # Jane Cook; (999) 555-3333"
split="#"
pattern="(.*);(.*)"
format="<strong>$1</strong> $2"
header="$anchors"
}%
Which renders as:
1
John Smith (111) 555-1234
9
Jane Cook (999) 555-3333
What I was expecting was for both John and Jane to appear under "J" - not under "1" and "9" respectively.
--
LeilaPearson - 27 Mar 2014
This is how I do this normally:
%MAKEINDEX{
"(John Smith; (111) 555-1234)#(Jane Cook; (999) 555-3333)"
split="#"
pattern="\((.*);(.*)\)"
format="<strong>$1</strong> $2"
header="$anchors"
}%
J
Jane Cook (999) 555-3333
John Smith (111) 555-1234
--
MichaelDaum - 27 Mar 2014
Thanks Michael. Works like a charm.
--
LeilaPearson - 29 Mar 2014