2014-12-06 06:24:55 -05:00
|
|
|
angular.module('code', [])
|
|
|
|
|
|
|
|
.directive('code', function() {
|
|
|
|
return {
|
|
|
|
restrict: 'E',
|
|
|
|
terminal: true,
|
|
|
|
compile: function(element) {
|
2015-03-17 10:56:08 -04:00
|
|
|
var linenums = element.hasClass('linenum');
|
2014-12-06 06:24:55 -05:00
|
|
|
var match = /lang-(\S+)/.exec(element[0].className);
|
|
|
|
var lang = match && match[1];
|
|
|
|
var html = element.html();
|
|
|
|
element.html(window.prettyPrintOne(html, lang, linenums));
|
|
|
|
}
|
|
|
|
};
|
2015-03-17 10:56:08 -04:00
|
|
|
});
|