topical media & game development

talk show tell print

mobile-query-three-www-vendor-CodeMirror2-mode-rpm-changes-changes.js / js



  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");
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.