﻿id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release
13534,better separator handling and case-insensitive,clemens,,"Hello

I propose and provide some moderate improvements to the 
[source:trackeywordsplugin/trunk/trackeywords/htdocs/trac_keywords.js trac_keywords.js] 
file of the TracKeywordsPlugin.

= Summary
 1. allow arbitrary keyword separators 
 1. better handling for multiple spaces and separators
 1. keyword matching is case-insensitive
 1. avoid duplicate insertion of keyword section
 1. add some comments

= Patch

 - attachment:trac_keywords.js
 - attachment:trac_keywords_20190214.diff

= Separators

The idea is not only to allow separation of keywords by SPACE and coma as previously, 
but also semi-colon, dash etc.
I make use of the `\W` regex term to match all ""non-word"" characters as separators.

My changes also provide better handling in cases where multiple separators are used, for example `bla,,,,blo`.

= Case-insensitive

The previous version did not consider a keyword if the case did not match, i.e. it was case-sensitive.
One can discuss about it, but for me it is more useable and convenient if it behaves case-insensitive.
The keywords `BLA`, `bla`, `Bla` and `bLa` should be treated as the same.

I am aware that other people may not share my opinion and might like to have case-sensitive.
In this case it is easy to have a case-sensitive code variant. 
Look for my code comments about `case-insensitive` and `toLowerCase and remove the corresponding code.

= Avoid Duplicates

I added a simple check to avoid duplicate insertion of the keyword section.
This is because I came across a duplicate when I used the browser ""save""-feature. 
The saved HTML page ended up having with two keyword sections (one was static HTML, the other dynamic from JS).
My simple check avoids this.

= Test case

The following test case uses:
 - upper and lower case keywords
 - numbers and letters
 - different separators
 - multiple separators
 - trailing separators
 
{{{
power, Other A2, C3, double double more double, slave;radio,.+/:other     eol-----epa.....
}}}


Clemens",enhancement,new,normal,TracKeywordsPlugin,normal,,,,1.2
