mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Ember Upgrade: 1.0
This commit is contained in:
parent
01075c5e7a
commit
be0ce08cc2
110 changed files with 19597 additions and 8477 deletions
49
vendor/assets/javascripts/Markdown.Converter.js
vendored
Normal file
49
vendor/assets/javascripts/Markdown.Converter.js
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
var Markdown;
|
||||
|
||||
if (typeof exports === "object" && typeof require === "function") // we're in a CommonJS (e.g. Node.js) module
|
||||
Markdown = exports;
|
||||
else
|
||||
Markdown = {};
|
||||
|
||||
/**
|
||||
This is only included so we have an interface that Pagedown can use.
|
||||
**/
|
||||
(function () {
|
||||
|
||||
function identity(x) { return x; }
|
||||
function returnFalse(x) { return false; }
|
||||
|
||||
function HookCollection() { }
|
||||
|
||||
HookCollection.prototype = {
|
||||
|
||||
chain: function (hookname, func) {
|
||||
var original = this[hookname];
|
||||
if (!original)
|
||||
throw new Error("unknown hook " + hookname);
|
||||
|
||||
if (original === identity)
|
||||
this[hookname] = func;
|
||||
else
|
||||
this[hookname] = function (text) {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
args[0] = original.apply(null, args);
|
||||
return func.apply(null, args);
|
||||
};
|
||||
},
|
||||
set: function (hookname, func) {
|
||||
if (!this[hookname])
|
||||
throw new Error("unknown hook " + hookname);
|
||||
this[hookname] = func;
|
||||
},
|
||||
addNoop: function (hookname) {
|
||||
this[hookname] = identity;
|
||||
},
|
||||
addFalse: function (hookname) {
|
||||
this[hookname] = returnFalse;
|
||||
}
|
||||
};
|
||||
|
||||
Markdown.HookCollection = HookCollection;
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue