also parse if only strings are allowed
This commit is contained in:
parent
a171fbebea
commit
d9695f8540
1 changed files with 7 additions and 1 deletions
|
@ -607,12 +607,18 @@ Ox.URL = function(options) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasOnlyStringType(spanTypes) {
|
||||||
|
var types = Ox.unique(Ox.values(spanTypes));
|
||||||
|
return types.length == 1 && types[0] == 'string';
|
||||||
|
}
|
||||||
|
|
||||||
function isNumericalSpan(str) {
|
function isNumericalSpan(str) {
|
||||||
return str.split(',').every(function(str) {
|
return str.split(',').every(function(str) {
|
||||||
return /^[0-9-\.:]+$/.test(str);
|
return /^[0-9-\.:]+$/.test(str);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getSpanType(str, types) {
|
function getSpanType(str, types) {
|
||||||
Ox.Log('Core', 'getSpanType', str, types)
|
Ox.Log('Core', 'getSpanType', str, types)
|
||||||
var canBeDate = types.indexOf('date') > -1,
|
var canBeDate = types.indexOf('date') > -1,
|
||||||
|
@ -922,7 +928,7 @@ Ox.URL = function(options) {
|
||||||
spanTypes = self.options.spanType[state.type][
|
spanTypes = self.options.spanType[state.type][
|
||||||
!state.item ? 'list' : 'item'
|
!state.item ? 'list' : 'item'
|
||||||
];
|
];
|
||||||
if (isNumericalSpan(parts[0])) {
|
if (isNumericalSpan(parts[0]) || hasOnlyStringType(spanTypes)) {
|
||||||
// test for numerical span
|
// test for numerical span
|
||||||
// if no view is given then parse the span anyway,
|
// if no view is given then parse the span anyway,
|
||||||
// but make sure the span type could match a view
|
// but make sure the span type could match a view
|
||||||
|
|
Loading…
Reference in a new issue