summaryrefslogtreecommitdiff
path: root/codemirror_ui/lib/CodeMirror-2.3/mode/rpm/changes/changes.js
diff options
context:
space:
mode:
Diffstat (limited to 'codemirror_ui/lib/CodeMirror-2.3/mode/rpm/changes/changes.js')
-rw-r--r--codemirror_ui/lib/CodeMirror-2.3/mode/rpm/changes/changes.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/codemirror_ui/lib/CodeMirror-2.3/mode/rpm/changes/changes.js b/codemirror_ui/lib/CodeMirror-2.3/mode/rpm/changes/changes.js
new file mode 100644
index 0000000..cb45f9e
--- /dev/null
+++ b/codemirror_ui/lib/CodeMirror-2.3/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");