mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
minor tweak for name splitter (split on number)
This commit is contained in:
parent
6b82f1047a
commit
87f7bd921b
2 changed files with 2 additions and 1 deletions
|
@ -13,7 +13,7 @@ Discourse.Formatter = (function(){
|
||||||
|
|
||||||
var firstPart = string.substr(0, maxLength);
|
var firstPart = string.substr(0, maxLength);
|
||||||
|
|
||||||
var betterSplit = firstPart.substr(1).search(/[A-Z_]/);
|
var betterSplit = firstPart.substr(1).search(/[^a-z]/);
|
||||||
if (betterSplit >= 0) {
|
if (betterSplit >= 0) {
|
||||||
var offset = 1;
|
var offset = 1;
|
||||||
if(string[betterSplit+1] === "_") {
|
if(string[betterSplit+1] === "_") {
|
||||||
|
|
|
@ -131,5 +131,6 @@ test("breakUp", function(){
|
||||||
equal(b("helloworld"), "hello world");
|
equal(b("helloworld"), "hello world");
|
||||||
equal(b("HeMans"), "He Mans");
|
equal(b("HeMans"), "He Mans");
|
||||||
equal(b("he_man"), "he_ man");
|
equal(b("he_man"), "he_ man");
|
||||||
|
equal(b("he11111"), "he 11111");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue