View Single Post
Old 07-13-2015, 11:28 AM   #393
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,043
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by saluli View Post
...
But I am curious about what would be the uses of the new SPLIT function, could you give an example? Maybe put it on the Wiki would be helpful for other people too.
It's not something that's going to useful all that often. The reason it was added was because of the tags-in-titles used on forums.spacebattles.com and forums.sufficientvelocity.com.

Examples:
Ready Player One (Worm/The Gamer)
Naval Supremacy [Worm/OC]
The Last Daughter [Worm AU/Crossover]

The defaults.ini makes a copy of the title in new metadata item tagsfromtitle, removes everything outside the parans/brackets and replaces / or 'x' with ','.

But when it's included in include_subject_tags, "Worm,The Gamer" is one string. The .SPLIT feature make them two strings "Worm","The Gamer" instead.

(Lengthy example 'paraphrased' from plugin-defaults.ini)
Spoiler:
Code:
[base_xenforoforum]
## Currently only forums.spacebattles.com and forums.sufficientvelocity.com

## Copy title to tagsfromtitle for parsing tags.
add_to_extra_valid_entries:,tagsfromtitle

## '.NOREPL' tells the system to *not* apply title's
## in/exclude/replace_metadata -- Only works on include_in_ lines.
include_in_tagsfromtitle:title.NOREPL

tagsfromtitle_label:Tags from Title

add_to_include_metadata_pre:
# only keep tagsfromtitle with ( or [ in.
 tagsfromtitle=~[\[\(]
 
add_to_replace_metadata:
# remove anything outside () or []
 tagsfromtitle=>^.*?([\(\[]([^\]\)]+)[\)\]]).*?$=>\1
# remove () []
 tagsfromtitle=>[\(\)\[\]]=>
# change (spaces)slash(spaces) to comma
 tagsfromtitle=> */ *=>,
 tagsfromtitle=> x =>,
 
# remove [] or () blocks and leading/trailing spaces
 title=> *[\(\[]([^\]\)]+)[\)\]] *=>
# remove 'Thread' and the next word, usually "Thread 2", "Thread
# four", "Thread iv", etc
 title=>[-: ]*[Tt]hread [^ ]+[-: ]*=>

add_to_extra_titlepage_entries:,tagsfromtitle

## '.SPLIT' tells the system to split by ','
add_to_include_subject_tags:,tagsfromtitle.SPLIT
JimmXinu is offline   Reply With Quote