diff --git a/codepot/src/js/creole.js b/codepot/src/js/creole.js index 1313f05f..cbec0bb4 100644 --- a/codepot/src/js/creole.js +++ b/codepot/src/js/creole.js @@ -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 (''); + 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 ] } };