Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/synchronizer.js

Issue 29873570: Issue 6923 - Only parse metadata from special comments at the top of the file (Closed)
Patch Set: Addressed comment about tests Created Sept. 10, 2018, 6:50 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/synchronizer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/synchronizer.js
===================================================================
--- a/lib/synchronizer.js
+++ b/lib/synchronizer.js
@@ -158,16 +158,18 @@
version: null,
expires: null
};
- for (let i = 0; i < lines.length; i++)
+ for (let i = 1; i < lines.length; i++)
{
- let match = /^\s*!\s*(\w+)\s*:\s*(.*)/.exec(lines[i]);
- if (match)
+ let match = /^\s*!\s*(?:(\w+)\s*:\s*(.*)|\S)/.exec(lines[i]);
+ if (!match)
+ break;
+
+ if (typeof match[1] != "undefined")
{
let keyword = match[1].toLowerCase();
- let value = match[2];
- if (keyword in params)
+ if (params.hasOwnProperty(keyword))
{
- params[keyword] = value;
+ params[keyword] = match[2];
lines.splice(i--, 1);
}
}
« no previous file with comments | « no previous file | test/synchronizer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld