~ubuntu-branches/ubuntu/utopic/codemirror-js/utopic

« back to all changes in this revision

Viewing changes to mode/rpm/changes/changes.js

  • Committer: Package Import Robot
  • Author(s): David Paleino
  • Date: 2012-04-12 12:25:28 UTC
  • Revision ID: package-import@ubuntu.com-20120412122528-8xp5a8frj4h1d3ee
Tags: upstream-2.23
ImportĀ upstreamĀ versionĀ 2.23

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
CodeMirror.defineMode("changes", function(config, modeConfig) {
 
2
  var headerSeperator = /^-+$/;
 
3
  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} - /;
 
4
  var simpleEmail = /^[\w+.-]+@[\w.-]+/;
 
5
 
 
6
  return {
 
7
    token: function(stream) {
 
8
      if (stream.sol()) {
 
9
        if (stream.match(headerSeperator)) { return 'tag'; }
 
10
        if (stream.match(headerLine)) { return 'tag'; }
 
11
      }
 
12
      if (stream.match(simpleEmail)) { return 'string'; }
 
13
      stream.next();
 
14
      return null;
 
15
    }
 
16
  };
 
17
});
 
18
 
 
19
CodeMirror.defineMIME("text/x-rpm-changes", "changes");