View Single Post
Old 06-17-2021, 11:59 PM   #7
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by DaveLessnau View Post
Thanks. I'd seen your author plugboard earlier and copied it into my own plugboard for any format/any device. I've now used a bulk metadata edit to change my titles where I'd put the article at the end so that they are back at the start. To see titles on my Forma with the articles back at the end, would I just add a line to the above plugboard listing {title_sort} as the Source Template and title as the Destination Field?

EDIT: the {title_sort} -> {title} plugboard line seems to work fine.
Yes, that should work. If you want to check how it looks, turn off the automatic updating of metadata in the driver, and use my Kobo Utilities plugin to update a few books. There is a metadata update option to do this.
Quote:
Also, it's probably not the most elegant solution in the world, but if someone's looking for a way to put the definite/indefinite articles back at the front of their titles after having manually moved them to the back over the years, I went to Edit Metadata > Edit Metadata in bulk, and:

- switched the Search Mode at the right side to Regular Expression
- set the Search Field field to Title
- set the Search For field to ^(.+),\s(the|The) (the ^ starts the search at the start of the field, the (.+) matches any characters, and the ,\s(the|The) matches a comma followed by one blank and either "the" or "The")
- set the Replace With field to The \1

That replaces all of any matched titles with the word "The " followed by the first field of the match (i.e., everything up to the ", The" or ", the"). I probably could have just switched the search over to being case-insensitive and avoided the "the|The" business. Also, it's possible that there might be an embedded substring of ", the" somewhere in the middle of the title. But, a search in the main library window for title:"~(.+),\sthe" showed that I didn't run into that situation. However, with the indefinite articles "a" and "an", I did have that issue. So, I just did a search for title:"~(.+),\sa" in the main library window and manually edited the very small number of valid instances from there.
That looks right. But, I would have used:

Code:
^(.+),\s(the|The)$
That should anchor the query properly. And I'd probably use:

Code:
^(.+),\s(the|a|an)$
With case sensitivity off. Then the replace is:

Code:
\2 \1
And then use "Title case" in the "Apply function after replace" option. Though I might just do the replace and look at how many were wrong to fix.

Also, I would take a copy of the database for the library. I know I'd mess up somewhere and want to restore it.
davidfor is offline   Reply With Quote