OSDN Git Service

fix profiler
[pettanr/pettanr.git] / app / assets / javascripts / addons / pettanr_simple_format / init.js.coffee
1 class Pettanr.PettanrSimpleFormat\r
2   \r
3 class Pettanr.PettanrSimpleFormat.RendererModule\r
4 \r
5   @escapeHTML = (t) ->\r
6     $("<div/>").text(t).html()\r
7 \r
8   @render = (content) -> \r
9     text = PettanrSimpleFormat.escapeHTML(content)\r
10     start_tag = '<p>'\r
11     text = text.replace(/\r\n?/g, "\n")\r
12     text = text.replace(/\n\n+/g, "</p><p>")\r
13     text = text.replace(/\n/g, '\n<br />')\r
14     text = text.replace(/\<\/p\>\<p\>/g, "</p>\n\n<p>")\r
15     text = start_tag + text + "</p>"\r
16     return text\r
17   \r