Skip to content

Commit

Permalink
Relevance fixes for highlightjs#436:
Browse files Browse the repository at this point in the history
- reset relevance of %-comments in Erlang
- added relevance booster for dots at the end of line in Erlang
- reset high relevance for %-strings in Ruby (it's rare anyway)
- specialized the simple `{..}` variant of MatLab cells to have zero relevance
  • Loading branch information
isagalaev committed Mar 10, 2014
1 parent 1277d93 commit 3e73c48
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
6 changes: 3 additions & 3 deletions src/languages/erlang.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ function(hljs) {

var COMMENT = {
className: 'comment',
begin: '%', end: '$',
relevance: 0
begin: '%', end: '$'
};
var NUMBER = {
className: 'number',
Expand Down Expand Up @@ -154,7 +153,8 @@ function(hljs) {
hljs.QUOTE_STRING_MODE,
RECORD_ACCESS,
VAR1, VAR2,
TUPLE
TUPLE,
{begin: /\.$/} // relevance booster
]
};
}
8 changes: 6 additions & 2 deletions src/languages/matlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ function(hljs) {
},
{
className: 'cell',
begin: '\\{', end: '\\}\'*[\\.\']*',
begin: '\\{',
contains: COMMON_CONTAINS,
illegal: /:/
illegal: /:/,
variants: [
{end: /\}'[\.']*/},
{end: /\}/, relevance: 0}
]
},
{
className: 'comment',
Expand Down
25 changes: 5 additions & 20 deletions src/languages/ruby.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,11 @@ function(hljs) {
{begin: '%[qw]?\\(', end: '\\)'},
{begin: '%[qw]?\\[', end: '\\]'},
{begin: '%[qw]?{', end: '}'},
{
begin: '%[qw]?<', end: '>',
relevance: 10
},
{
begin: '%[qw]?/', end: '/',
relevance: 10
},
{
begin: '%[qw]?%', end: '%',
relevance: 10
},
{
begin: '%[qw]?-', end: '-',
relevance: 10
},
{
begin: '%[qw]?\\|', end: '\\|',
relevance: 10
},
{begin: '%[qw]?<', end: '>'},
{begin: '%[qw]?/', end: '/'},
{begin: '%[qw]?%', end: '%'},
{begin: '%[qw]?-', end: '-'},
{begin: '%[qw]?\\|', end: '\\|'},
{
// \B in the beginning suppresses recognition of ?-sequences where ?
// is the last character of a preceding identifier, as in: `func?4`
Expand Down

0 comments on commit 3e73c48

Please sign in to comment.