Now, please excuse my ignorance but how exactly would I embed this
script to ignore initial articles into a FET macro call like the
following one?
<tab B>
<<forEachTiddler
where
'tiddler.title.startsWith("B") && tiddler.tags.contains("book")'
</tab>
The example provided in my initial post was from a different context
that I do not need to replicate. It was some Javascript that I thought
might illustrate in a general way what I was trying to do.
Thanks again for your assistance.
Your fluency inspires me to dive deeper into these mysteries.
mck
On Jan 9, 10:12 pm, Eric Shulman <elsdes...@gmail.com> wrote:
> Now, please excuse my ignorance but how exactly would I embed this
> script to ignore initial articles into a FET macro call like the
> following one?
OK... try this:
<tab B>
<<forEachTiddler
where
'tiddler.title.replace(/^(A|An|The) /,"").startsWith("B") &&
tiddler.tags.contains("book")'>>
</tab>
but the following titles get dropped where the second word contains a
lowercase b:
The butcher, the baker, the candlestick maker
The broken chalice
Also, all the titles beginning with ( The ) are currently displaying
at the end of the list rather than within proper alphabetic sequence.
For instance, they now sort like this:
# Creativity and its role in healing
# Crucial work
# Curia anima
# The Cartesian ghost in transference and projective identification
# The Cassandra complex
# The Celtic landscape
rather than:
# The Cartesian ghost in transference and projective identification
# The Cassandra complex
# The Celtic landscape
# Creativity and its role in healing
# Crucial work
# Curia anima
It's 3 am so perhaps if I sleep on this one ....
Thanks again!
Mark
On Jan 10, 1:55 am, Eric Shulman <elsdes...@gmail.com> wrote:
> > Now, please excuse my ignorance but how exactly would I embed this
> > script to ignore initial articles into a FET macro call like the
> > following one?
> It now works for: The Book of Job (upper case)
> but the following titles get dropped where the second word contains a
> lowercase b:
The startsWith() function (defined by ForEachTiddlerPlugin) does a
case-sensitive comparison... Thus,
tiddler.title.replace(/^(A|An|The) /,"").startsWith("B")
only checks for *upper case* B
For case-insensitive single-letter comparisons, you should skip this
function and use:
tiddler.title.replace(/^(A|An|
The) /,"").substr(0,1).toUpperCase()=="B"
> Also, all the titles beginning with ( The ) are currently displaying
> at the end of the list rather than within proper alphabetic sequence.
The "where" clause filters the title (to remove the A/An/The prefix)
for comparison purposes ONLY. It does not actually alter the titles
in the resulting list, and doesn't change the *sort order* of the
list. You will need to add a custom "sortBy" clause to your
<<ForEachTiddler>> usage so that it also filters out the prefix (if
any) for sorting purposes (without altering the actual titles in the
list)
> > It now works for: The Book of Job (upper case)
> > but the following titles get dropped where the second word contains a
> > lowercase b:
> The startsWith() function (defined by ForEachTiddlerPlugin) does a
> case-sensitive comparison... Thus,
> tiddler.title.replace(/^(A|An|The) /,"").startsWith("B")
> only checks for *upper case* B
> For case-insensitive single-letter comparisons, you should skip this
> function and use:
> tiddler.title.replace(/^(A|An|
> The) /,"").substr(0,1).toUpperCase()=="B"
> > Also, all the titles beginning with ( The ) are currently displaying
> > at the end of the list rather than within proper alphabetic sequence.
> The "where" clause filters the title (to remove the A/An/The prefix)
> for comparison purposes ONLY. It does not actually alter the titles
> in the resulting list, and doesn't change the *sort order* of the
> list. You will need to add a custom "sortBy" clause to your
> <<ForEachTiddler>> usage so that it also filters out the prefix (if
> any) for sorting purposes (without altering the actual titles in the
> list)
It works well where the second word is upper case:
* Caring for the vulnerable child in the critical hours
* The Cartesian ghost in transference and projective identification
* The Cassandra complex
* Cat's eye
but then at the end of the list appear all the instances where the
second word is lower case.
* Creativity its role in healing
* Curia anima
* The case of the murdered ox: the Athenian Bouphonia: a contribution
to ecopsychology
* A chance to say goodbye
* The consulting room as a theater for the Greek tragedy play
What do I need to add to the sort clause so that the case of the first
word after the initial articles (A, An, The) makes no difference to
the alphabetic sort order?
Thus, in the end, the titles should sort as follows:
* Caring for the vulnerable child in the critical hours
* The Cartesian ghost in transference and projective identification
* The Cassandra complex
* Cat's eye
* A chance to say goodbye
* The consulting room as a theater for the Greek tragedy play
* Creativity its role in healing
* Curia anima
I'm sure what would take me days is actually a very quick and simple
fix.
Thanks in advance!
Mark
On Jan 10, 9:47 am, Mark <mckel...@gmail.com> wrote:
> For a 1200 item bibliography, this little bit of Javascript will save
> me hours of work and results and a much more professional display.
> Thanks, Eric!
> Mark
> On Jan 10, 5:49 am, Eric Shulman <elsdes...@gmail.com> wrote:
> > > It now works for: The Book of Job (upper case)
> > > but the following titles get dropped where the second word contains a
> > > lowercase b:
> > The startsWith() function (defined by ForEachTiddlerPlugin) does a
> > case-sensitive comparison... Thus,
> > tiddler.title.replace(/^(A|An|The) /,"").startsWith("B")
> > only checks for *upper case* B
> > For case-insensitive single-letter comparisons, you should skip this
> > function and use:
> > tiddler.title.replace(/^(A|An|
> > The) /,"").substr(0,1).toUpperCase()=="B"
> > > Also, all the titles beginning with ( The ) are currently displaying
> > > at the end of the list rather than within proper alphabetic sequence.
> > The "where" clause filters the title (to remove the A/An/The prefix)
> > for comparison purposes ONLY. It does not actually alter the titles
> > in the resulting list, and doesn't change the *sort order* of the
> > list. You will need to add a custom "sortBy" clause to your
> > <<ForEachTiddler>> usage so that it also filters out the prefix (if
> > any) for sorting purposes (without altering the actual titles in the
> > list)
> The sortBy clause is not quite right.
> It works well where the second word is upper case:
> but then at the end of the list appear all the instances where the
> second word is lower case.
> What do I need to add to the sort clause so that the case of the first
> word after the initial articles (A, An, The) makes no difference to
> the alphabetic sort order?
add ".toUpperCase()" to the sortBy expression, like this:
> > The sortBy clause is not quite right.
> > It works well where the second word is upper case:
> > but then at the end of the list appear all the instances where the
> > second word is lower case.
> > What do I need to add to the sort clause so that the case of the first
> > word after the initial articles (A, An, The) makes no difference to
> > the alphabetic sort order?
> add ".toUpperCase()" to the sortBy expression, like this: