Quote:
Originally Posted by ACGAuthor
If you ever do figure out a more streamlined way to add a specific tag based on the array of various tags each different book might have, (like one overall tag for SFF/UF/PNR when the tags the books might come with are scifi, sci-fi, science fiction, fantasy, urban, urban fantasy, vampires, werewolves, magic, paranormal, etc etc etc) I would be very interested in that. It won't help categorize books that come with no tags or only very vague and general ones, but it would help.
|
Well, I'm back!!
Would you like to try this now?
If I remember correctly, you want to generate a #collections field, which will be used by Kindle Collections to create collections, right?
So what you will want is something along the lines of
Code:
{tags:switch(Sci-Fi,SFF/UF/PNR,(Urban )?Fantasy,SFF/UF/PNR,none)}
but with switch(pattern,value,pattern,value,......,value_if _empty) sets where pattern is (the regex of) any possible tag, and value is what the column should equal if so. value_if_empty is returned if no tags match, we can leave that blank.
So we can expand that to match all your tags, and add any other stuff you need into the collection naming.
Problem from before:
Quote:
Originally Posted by eschwartz
Issue #2: use this instead for your third column to fix the space after ampersand:
Code:
Name: #initials. Template: {#stripped_series:re(([\s])?([^\s])[^\s]+(\s|$),\1)}
Edit all the series' that use "and" to use "&".
|
Stupid me, I know what the problem is here. I created a new capture group at the beginning to remove leading spaces, but left the replace code replacing the nonexistent capture group. Properly, it should've been this (fix in red):
Code:
Name: #initials. Template: {#stripped_series:re(([\s])?([^\s])[^\s]+(\s|$),\2)}
Or really this:
Code:
Name: #initials. Template: {#stripped_series:re([\s]?([^\s])[^\s]+(\s|$),\1)}
since I can't think why I created a capture group in the first place -- it does nothing.
And without the formatting error, it seems to work perfectly. Try this again?
EDIT: @chaley, perhaps this should be updated in the first post? This is derived from what Kovid used in his general program mode guide. I used [^\s] instead of [\w], following your lead, but added the inverse at the beginning, like Kovid's example.
EDIT by chaley: done.