1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-07 22:33:50 +00:00

add // comment till linebreak

This commit is contained in:
pmario 2024-05-15 14:55:10 +02:00
parent 0b475628de
commit 77fc25ccc1

View File

@ -70,7 +70,7 @@ function parseFilterOperation(operators,filterString,p) {
operator.operands = []; operator.operands = [];
var parseOperand = function(bracketType) { var parseOperand = function(bracketType) {
var operand = {}; var operand = {};
switch (bracketType) { switch(bracketType) {
case "{": // Curly brackets case "{": // Curly brackets
operand.indirect = true; operand.indirect = true;
nextBracketPos = filterString.indexOf("}",p); nextBracketPos = filterString.indexOf("}",p);
@ -144,7 +144,7 @@ exports.parseFilter = function(filterString) {
p = 0, // Current position in the filter string p = 0, // Current position in the filter string
match; match;
var whitespaceRegExp = /(\s+)/mg, var whitespaceRegExp = /(\s+)/mg,
operandRegExp = /((?:\+|\-|~|=|\:(\w+)(?:\:([\w\:, ]*))?)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg; operandRegExp = /((?:\+|\-|~|=|\:(\w+)(?:\:([\w\:, ]*))?)?)(?:\/\/(.*)|(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg;
while(p < filterString.length) { while(p < filterString.length) {
// Skip any whitespace // Skip any whitespace
whitespaceRegExp.lastIndex = p; whitespaceRegExp.lastIndex = p;
@ -182,14 +182,15 @@ exports.parseFilter = function(filterString) {
}); });
} }
} }
if(match[4]) { // Opening square bracket // if(match[4]) {} // Since v5.3.4 match[4] is a comment so it is ignored
if(match[5]) { // Opening square bracket
p = parseFilterOperation(operation.operators,filterString,p); p = parseFilterOperation(operation.operators,filterString,p);
} else { } else {
p = match.index + match[0].length; p = match.index + match[0].length;
} }
if(match[5] || match[6] || match[7]) { // Double quoted string, single quoted string or unquoted title if(match[6] || match[7] || match[8]) { // Double quoted string, single quoted string or unquoted title
operation.operators.push( operation.operators.push(
{operator: "title", operands: [{text: match[5] || match[6] || match[7]}]} {operator: "title", operands: [{text: match[6] || match[7] || match[8]}]}
); );
} }
results.push(operation); results.push(operation);