Skip to content

Commit

Permalink
Moved tag plugins to seperate files
Browse files Browse the repository at this point in the history
  • Loading branch information
tanepiper committed Dec 18, 2012
1 parent cc144da commit cbdfc93
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
22 changes: 22 additions & 0 deletions lib/plugins/plugins/gist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

var parser = require('swig/lib/parser');
var helpers = require('swig/lib/helpers');

module.exports = (function() {

var gist = function() {
var id = parser.parseVariable(this.args[0]);
var output = [
'(function() {',
helpers.setVar('__id', id),
'_output += \'<script src="https://gist.github.com/\' + __id + \'.js"></script>\';',
'})();'
];
return output.join('');
};

gist.ends = false;

return gist;
}());
30 changes: 30 additions & 0 deletions lib/plugins/plugins/youtube.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

var parser = require('swig/lib/parser');
var helpers = require('swig/lib/helpers');

module.exports = (function() {

var youtube = function() {
var id = parser.parseVariable(this.args[0]);
//var width = (this.args[1]) ? parser.parseVariable(this.args[1]) : 560;
//var height = (this.args[2]) ? parser.parseVariable(this.args[2]) : 315;

var output = [
'(function() {',
helpers.setVar('__id', id),
//helpers.setVar('__width', width),
//helpers.setVar('__height', height),
'_output += \'<iframe width="560" height="315" \';',
'_output += \'src="http://www.youtube.com/embed/\' + __id + \'?rel=0" \';',
'_output += \'frameborder="0" allowfullscreen></iframe>\';',
'})();'
];
return output.join('');
};

youtube.ends = false;

return youtube;

}());
36 changes: 2 additions & 34 deletions lib/plugins/tags.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
'use strict';

var parser = require('swig/lib/parser');
var helpers = require('swig/lib/helpers');

exports.gist = function() {
var id = parser.parseVariable(this.args[0]);
var output = [
'(function() {',
helpers.setVar('__id', id),
'_output += \'<script src="https://gist.github.com/\' + __id + \'.js"></script>\';',
'})();'
];
return output.join('');
};
exports.gist.ends = false;

exports.youtube = function() {
var id = parser.parseVariable(this.args[0]);
//var width = (this.args[1]) ? parser.parseVariable(this.args[1]) : 560;
//var height = (this.args[2]) ? parser.parseVariable(this.args[2]) : 315;

var output = [
'(function() {',
helpers.setVar('__id', id),
//helpers.setVar('__width', width),
//helpers.setVar('__height', height),
'_output += \'<iframe width="560" height="315" \';',
'_output += \'src="http://www.youtube.com/embed/\' + __id + \'?rel=0" \';',
'_output += \'frameborder="0" allowfullscreen></iframe>\';',
'})();'
];
return output.join('');
};

exports.youtube.ends = false;
exports.gist = require(__dirname + '/plugins/gist');
exports.youtube = require(__dirname + '/plugins/youtube');

0 comments on commit cbdfc93

Please sign in to comment.