From 3a754133dbc138390503341fd2e9beba3e43aa4b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 27 Jan 2012 12:05:17 -0800 Subject: Merged old FileIO --- imports/codemirror/mode/rpm/changes/changes.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 imports/codemirror/mode/rpm/changes/changes.js (limited to 'imports/codemirror/mode/rpm/changes/changes.js') diff --git a/imports/codemirror/mode/rpm/changes/changes.js b/imports/codemirror/mode/rpm/changes/changes.js new file mode 100755 index 00000000..cb45f9e5 --- /dev/null +++ b/imports/codemirror/mode/rpm/changes/changes.js @@ -0,0 +1,19 @@ +CodeMirror.defineMode("changes", function(config, modeConfig) { + var headerSeperator = /^-+$/; + var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; + var simpleEmail = /^[\w+.-]+@[\w.-]+/; + + return { + token: function(stream) { + if (stream.sol()) { + if (stream.match(headerSeperator)) { return 'tag'; } + if (stream.match(headerLine)) { return 'tag'; } + } + if (stream.match(simpleEmail)) { return 'string'; } + stream.next(); + return null; + } + }; +}); + +CodeMirror.defineMIME("text/x-rpm-changes", "changes"); -- cgit v1.2.3