@whitewall Actually, my position on the matter is Tags - Lower Case Only? - #30 by thebodzio . Plus, I don't care much about tags being case-sensitive in the sense of case-sensitiveness being their distinguishing factor (e.g. I consider „html” and „HTML” to be the same for processing purposes, but not for the presentational ones).
Of course, it will make things more complicated, but I don't think it will be “extra” . What I mean is Joplin tag system is already ID-based (which I applaud, as an intelligent design decision), so almost all tag processing is done using IDs not tag names (or “tag titles” as they are called in the source). Of course, tag title editing has to deal with “names”, but that's seemingly the only place where potential changes are necessary.
There is something to it, but on the other hand, why not to give yourself a little bit of extra validation? It doesn't seem like a big deal to retain. Want to have consistently lower-case only tags? Fine! We'll make sure you won't accidentally break that convention. Want to use both lower- and upper-case letters? No problem! We won't check/convert the case for you.
All in all, whenever we search for a tag title, we won't consider letter case. In other words: let Joplin remain case-insensitive in all tag related areas beside tag presentation.
Actually, when I look at the code, all required elements appear to be already in place. I mean: loadByField(fieldName: string, fieldValue: any, options: any = null)
already looks for tag title ignoring the case (COLLATE NOCASE
). This doesn't have to change at all. One place that appears to have to be changed is in lib/models/Tag.ts, namely at tagTitles[i].trim().toLowerCase();
and save(o: TagEntity, options: any = null)
(line 193, same file). Based on the option either convert given tag titles to lower case or don't. That seems to be the only place where they are converted. Let's just call an option to do such conversion or not, “Force lower-case” and… job done? Really, that's all I can see in the code and the two mentioned methods are the only places where toLowerCase()
is used in the entire Tag
class definition. If I'm mistaken, please, do correct me.
I'm not arguing for anything else . Perhaps the two types of “case-sensitiveness” make things confusing.
Enough chit-chat! Let's codé
Looks like another thread being born .