Skip to content

Commit

Permalink
[webui] Highlight 'PreReq' in spec files and fix comment highlighting
Browse files Browse the repository at this point in the history
(fate#313205)
  • Loading branch information
saschpe committed Apr 19, 2012
1 parent e17f6ec commit c4d6f4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/webui/public/javascripts/cm2/mode/spec.js
Expand Up @@ -3,7 +3,7 @@
CodeMirror.defineMode("spec", function(config, modeConfig) {
var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;

var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildEnhances|BuildRequires|BuildSuggests|BuildSupplements|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|Enhances|ExclusiveArch|NoSource|Suggests|Supplements|DistTag|CvsId|SvnId):/i;
var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildEnhances|BuildRequires|BuildSuggests|BuildSupplements|BuildRoot|AutoReqProv|Provides|PreReq|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|Enhances|ExclusiveArch|NoSource|Suggests|Supplements|DistTag|CvsId|SvnId):/i;
var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preun|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/;
var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
Expand All @@ -19,9 +19,8 @@ CodeMirror.defineMode("spec", function(config, modeConfig) {
},
token: function (stream, state) {
var ch = stream.peek();
if (ch == "#") { stream.skipToEnd(); return "comment"; }

if (stream.sol()) {
if (ch == "#") { stream.skipToEnd(); return "comment"; }
if (stream.match(preamble)) { return "preamble"; }
if (stream.match(section)) { return "section"; }
}
Expand Down

0 comments on commit c4d6f4f

Please sign in to comment.