Skip to content

Commit

Permalink
Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed Feb 10, 2016
1 parent 6d5d755 commit 1d45f76
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
1 change: 0 additions & 1 deletion lib/plugins/helper/feed_tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function feedTagHelper(path, options) {
options = options || {};

var title = options.title || this.config.title;
var type = options.type || 'atom';

return '<link rel="alternate" href="' + this.url_for(path) + '" title="' + title + '">';
}
Expand Down
16 changes: 9 additions & 7 deletions lib/plugins/helper/open_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ function openGraphHelper(options) {

result += meta('description', description);
if (keywords && Array.isArray(keywords)) {
result += meta('keywords', keywords.map(function (tag) {
return tag.name;
}).filter(function (keyword) {
return !!keyword;
}).join());
result += meta('keywords', keywords.map(function(tag) {
return tag.name;
}).filter(function(keyword) {
return !!keyword;
}).join());
}

result += og('og:type', type);
result += og('og:title', title);
result += og('og:url', url);
Expand All @@ -85,6 +86,7 @@ function openGraphHelper(options) {

return path;
});

images.forEach(function(path) {
result += og('og:image', path);
});
Expand All @@ -99,8 +101,8 @@ function openGraphHelper(options) {
result += meta('twitter:title', title);
result += meta('twitter:description', description);

if(images.length) {
result += meta('twitter:image', images[0]);
if (images.length) {
result += meta('twitter:image', images[0]);
}

if (options.twitter_id) {
Expand Down
17 changes: 8 additions & 9 deletions test/scripts/helpers/open_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ describe('open_graph', function() {

it('default', function() {
var result = openGraph.call({
page: {
tags: [{
name: 'optimize'
}, {
name: 'web'
}]
},
config: hexo.config,
is_post: isPost
page: {
tags: [
{ name: 'optimize' },
{ name: 'web' }
]
},
config: hexo.config,
is_post: isPost
});

result.should.eql([
Expand Down
20 changes: 12 additions & 8 deletions test/scripts/helpers/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
var should = require('chai').should(); // eslint-disable-line
var _ = require('lodash');

function ifTrue(cond, yes, no) {
return cond ? yes : no;
}

describe('toc', function() {
var toc = require('../../../lib/plugins/helper/toc');

Expand Down Expand Up @@ -30,39 +34,39 @@ describe('toc', function() {
'<ol class="' + className + '">',
'<li class="' + className + '-item ' + className + '-level-1">',
'<a class="' + className + '-link" href="#title_1">',
(listNumber ? '<span class="' + className + '-number">1.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">1.</span> ', ''),
'<span class="' + className + '-text">Title 1</span>',
'</a>',
'<ol class="' + className + '-child">',
'<li class="' + className + '-item ' + className + '-level-2">',
'<a class="' + className + '-link" href="#title_1_1">',
(listNumber ? '<span class="' + className + '-number">1.1.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">1.1.</span> ', ''),
'<span class="' + className + '-text">Title 1.1</span>',
'</a>',
'<ol class="' + className + '-child">',
'<li class="' + className + '-item ' + className + '-level-3">',
'<a class="' + className + '-link" href="#title_1_1_1">',
(listNumber ? '<span class="' + className + '-number">1.1.1.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">1.1.1.</span> ', ''),
'<span class="' + className + '-text">Title 1.1.1</span>',
'</a>',
'</li>',
'</ol>',
'</li>',
'<li class="' + className + '-item ' + className + '-level-2">',
'<a class="' + className + '-link" href="#title_1_2">',
(listNumber ? '<span class="' + className + '-number">1.2.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">1.2.</span> ', ''),
'<span class="' + className + '-text">Title 1.2</span>',
'</a>',
'</li>',
'<li class="' + className + '-item ' + className + '-level-2">',
'<a class="' + className + '-link" href="#title_1_3">',
(listNumber ? '<span class="' + className + '-number">1.3.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">1.3.</span> ', ''),
'<span class="' + className + '-text">Title 1.3</span>',
'</a>',
'<ol class="' + className + '-child">',
'<li class="' + className + '-item ' + className + '-level-3">',
'<a class="' + className + '-link" href="#title_1_3_1">',
(listNumber ? '<span class="' + className + '-number">1.3.1.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">1.3.1.</span> ', ''),
'<span class="' + className + '-text">Title 1.3.1</span>',
'</a>',
'</li>',
Expand All @@ -72,13 +76,13 @@ describe('toc', function() {
'</li>',
'<li class="' + className + '-item ' + className + '-level-1">',
'<a class="' + className + '-link" href="#title_2">',
(listNumber ? '<span class="' + className + '-number">2.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">2.</span> ', ''),
'<span class="' + className + '-text">Title 2</span>',
'</a>',
'<ol class="' + className + '-child">',
'<li class="' + className + '-item ' + className + '-level-2">',
'<a class="' + className + '-link" href="#title_2_1">',
(listNumber ? '<span class="' + className + '-number">2.1.</span> ' : ''),
ifTrue(listNumber, '<span class="' + className + '-number">2.1.</span> ', ''),
'<span class="' + className + '-text">Title 2.1</span>',
'</a>',
'</li>',
Expand Down

0 comments on commit 1d45f76

Please sign in to comment.