Commits

Frank Bennett committed 5980062

Fix evaluation result collector function for @variable, and split and evaluate elements of argument string to @locator, controlling for the possibility of atomic "sub verbo"

Comments (0)

Files changed (1)

src/attributes.js

 						for (key in myitem[variable]) {
 							if (myitem[variable].hasOwnProperty(key)) {
 								x = true;
-								break;
+							} else {
+								x = false;
 							}
 						}
 					}
 
 CSL.Attributes["@locator"] = function (state, arg) {
 	var func;
+	var trylabels = arg.replace("sub verbo", "sub-verbo");
+	trylabels = arg.split(/\s+/);
+	if (trylabels.indexOf("sub-verbo") > -1) {
+		trylabels.push("sub verbo");
+	}
 	if (["if",  "else-if"].indexOf(this.name) > -1) {
 		// check for variable value
 		func = function (state, Item, item) {
-			var label;
+			var ret = [];
 			if ("undefined" === typeof item || !item.label) {
 				label = "page";
 			} else {
 				label = item.label;
 			}
-			if (arg === label) {
-				return true;
+			for (var i = 0, ilen = trylabels.length; i < ilen; i += 1) {
+				if (trylabels[i] === label) {
+					ret.push(true);
+				} else {
+					ret.push(false);
+				}
 			}
-			return false;
+			return ret;
 		};
 		this.tests.push(func);
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.