Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Update highlightjs to include at least 9.3.0, which contained
some changes which were incorporated in lowlight’s core.

The new `skip` option (highlightjs/highlight.js@517d2da) is not yet
included.

Closes GH-1.
  • Loading branch information
chibicode authored and wooorm committed Apr 23, 2016
1 parent eca00b6 commit 04e66f4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 51 deletions.
9 changes: 7 additions & 2 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function compileLanguage(language) {
mode.keywords = compiledKeywords;
}

mode.lexemesRe = langRe(mode.lexemes || /\b\w+\b/, true);
mode.lexemesRe = langRe(mode.lexemes || /\w+/, true);

if (parent) {
if (mode.beginKeywords) {
Expand Down Expand Up @@ -355,6 +355,7 @@ function coreHighlight(name, value, ignore, prefix, continuation) {
* @private
*/
function pop() {
/* istanbul ignore next - removed in hljs 9.3 */
currentChildren = stack.pop() || children;
}

Expand Down Expand Up @@ -617,9 +618,13 @@ function coreHighlight(name, value, ignore, prefix, continuation) {
* @return {string} - The processed buffer.
*/
function processBuffer() {
return top.subLanguage !== undefined ?
var result = top.subLanguage !== undefined ?
processSubLanguage() :
processKeywords();

modeBuffer = EMPTY;

return result;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"bugs": "https://github.com/wooorm/lowlight/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"dependencies": {
"highlight.js": "^9.1.0"
"highlight.js": "^9.3.0"
},
"devDependencies": {
"browserify": "^13.0.0",
Expand Down
3 changes: 1 addition & 2 deletions test/fixture/http-default/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
<span class="hljs-attribute">Content-Type</span>: application/json; charset=utf-8
<span class="hljs-attribute">Content-Length</span>: 19

<span class="json">{"<span class="hljs-attr">status</span>": <span class="hljs-string">"ok"</span>, "<span class="hljs-attr">extended</span>": <span class="hljs-literal">true</span>}
</span>
<span class="json">{<span class="hljs-attr">"status"</span>: <span class="hljs-string">"ok"</span>, <span class="hljs-attr">"extended"</span>: <span class="hljs-literal">true</span>}</span>
27 changes: 6 additions & 21 deletions test/fixture/js-jsx/input.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
var X = React.createClass({
render: function() {
var c = this.map(c => <Comment comment={c} key={c.id} />);
return (
<div className='comments'>
{c}
</div>
);
},
foo: function() {}
});

var Comment = React.createClass({
render: function() {
var comment = this.props.comment;
return (
<li>{comment}</li>
);
}
foo: function() {}
});
var jsx = <node/>;
var jsx = <node><child/></node>;
var jsx = <node>...<child>...</child></node>;
var jsx = <div><br /></div>;
var x = 5;
return (<node attr="value"></node>);
27 changes: 6 additions & 21 deletions test/fixture/js-jsx/output.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
<span class="hljs-keyword">var</span> X = React.createClass({
render: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">var</span> c = <span class="hljs-keyword">this</span>.map(c =&gt; <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Comment</span> <span class="hljs-attr">comment</span>=<span class="hljs-string">{c}</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{c.id}</span> /&gt;</span>)</span>;
<span class="hljs-keyword">return</span> (
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">'comments'</span>&gt;</span>
{c}
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
)</span>;
},
foo: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{}
});

<span class="hljs-keyword">var</span> Comment = React.createClass({
render: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">var</span> comment = <span class="hljs-keyword">this</span>.props.comment;
<span class="hljs-keyword">return</span> (
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>{comment}<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
)</span>;
}
foo: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{}
});
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span>/&gt;</span></span>;
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span>&gt;</span></span>&lt;child/&gt;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">node</span>&gt;</span></span>;
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span>&gt;</span>...</span>&lt;child&gt;...&lt;/child&gt;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">node</span>&gt;</span></span>;
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span></span>&lt;br /&gt;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>;
<span class="hljs-keyword">var</span> x = <span class="hljs-number">5</span>;
<span class="hljs-keyword">return</span> (<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span> <span class="hljs-attr">attr</span>=<span class="hljs-string">&quot;value&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">node</span>&gt;</span></span>);
2 changes: 1 addition & 1 deletion test/fixture/xml-large/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<span class="hljs-meta">&lt;?xml version="1.0"?&gt;</span>
<span class="php"><span class="hljs-meta">&lt;?</span>xml version=<span class="hljs-string">"1.0"</span><span class="hljs-meta">?&gt;</span></span>
<span class="hljs-tag">&lt;<span class="hljs-name">response</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"ok"</span> <span class="hljs-attr">xml:lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">text</span>&gt;</span>Ok<span class="hljs-tag">&lt;/<span class="hljs-name">text</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">comment</span> <span class="hljs-attr">html_allowed</span>=<span class="hljs-string">"true"</span>/&gt;</span>
Expand Down
6 changes: 3 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ test('lowlight(value[, options])', function (t) {

st.equal(
result.secondBest.language,
'hsp',
'mipsasm',
'should return a `secondBest` `language`'
);

Expand Down Expand Up @@ -424,8 +424,8 @@ test('fixtures', function (t) {
* @param {string} directory - File path to directory.
*/
function subtest(language, name, directory) {
var input = read(join(FIXTURES, directory, INPUT), 'utf8');
var output = read(join(FIXTURES, directory, OUTPUT), 'utf8');
var input = read(join(FIXTURES, directory, INPUT), 'utf8').trim();
var output = read(join(FIXTURES, directory, OUTPUT), 'utf8').trim();

input = low.highlight(language, input);
output = hast.parse(output);
Expand Down

0 comments on commit 04e66f4

Please sign in to comment.