added ohloh widget support to creole.js. it's just a quick hack
This commit is contained in:
parent
fd28d29786
commit
ff3f81b2e7
@ -298,6 +298,26 @@ var Url = {
|
||||
hr: { tag: 'hr', regex: /(^|\n)\s*----\s*(\n|$)/ },
|
||||
|
||||
br: { tag: 'br', regex: /\\\\/ },
|
||||
|
||||
// ugly hack to support the ohloh widget
|
||||
// it uses the image pattern with special prefix
|
||||
// {{__ohloh__!width|height|style|widget-url}}
|
||||
// {{__ohloh__!300px!100px!border: none!http://www.ohloh.net/p/140949/widgets/project_partner_badge.js}}
|
||||
ohlohWidget: { regex: '\\{\\{__ohloh__!(.+)!(.+)!(.+)!(.+)\\}\\}',
|
||||
build: function(node, r, options) {
|
||||
var d = document.createElement('iframe');
|
||||
d.setAttribute ("width", r[1]);
|
||||
d.setAttribute ("height", r[2]);
|
||||
d.setAttribute ("style", r[3]);
|
||||
node.appendChild (d);
|
||||
|
||||
var doc = d.contentWindow || d.contentDocument;
|
||||
if (doc.document) { doc = doc.document;}
|
||||
|
||||
doc.open ();
|
||||
doc.write ('<script type="text/javascript" src="' + r[4] + '"></script>');
|
||||
doc.close ();
|
||||
} },
|
||||
|
||||
preBlock: { tag: 'pre', capture: 2,
|
||||
attrs: { 'class': 'wiki' },
|
||||
@ -476,7 +496,7 @@ var Url = {
|
||||
|
||||
g.root = {
|
||||
children: [ g.h1, g.h2, g.h3, g.h4, g.h5, g.h6,
|
||||
g.hr, g.ulist, g.olist, g.preBlock, g.table ],
|
||||
g.hr, g.ulist, g.olist, g.preBlock, g.table, g.ohlohWidget ],
|
||||
fallback: { children: [ g.paragraph ] }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user