changes.js 636 B

12345678910111213141516171819
  1. CodeMirror.defineMode("changes", function() {
  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. return {
  6. token: function(stream) {
  7. if (stream.sol()) {
  8. if (stream.match(headerSeperator)) { return 'tag'; }
  9. if (stream.match(headerLine)) { return 'tag'; }
  10. }
  11. if (stream.match(simpleEmail)) { return 'string'; }
  12. stream.next();
  13. return null;
  14. }
  15. };
  16. });
  17. CodeMirror.defineMIME("text/x-rpm-changes", "changes");