1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +00:00

Accept single quotes for attributes in TW files

This commit is contained in:
Jermolene 2014-05-01 17:58:49 +01:00
parent f5848c395a
commit bced7124e4

View File

@ -51,13 +51,13 @@ var parseTiddlerDiv = function(text /* [,fields] */) {
// Extract the text // Extract the text
result.text = text.substring(match.index + match[0].length,endMatch.index); result.text = text.substring(match.index + match[0].length,endMatch.index);
// Process the attributes // Process the attributes
var attrRegExp = /\s*([^=\s]+)\s*=\s*"([^"]*)"/gi, var attrRegExp = /\s*([^=\s]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi,
attrMatch; attrMatch;
do { do {
attrMatch = attrRegExp.exec(match[1]); attrMatch = attrRegExp.exec(match[1]);
if(attrMatch) { if(attrMatch) {
var name = attrMatch[1]; var name = attrMatch[1];
var value = attrMatch[2]; var value = attrMatch[2] || attrMatch[3];
result[name] = value; result[name] = value;
} }
} while(attrMatch); } while(attrMatch);