pettanr_simple_format 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
|
|
1
|
+
class PettanrSimpleFormat
|
2
|
+
WritingFormat = window.PettanrWritingFormat
|
3
|
+
@engine_name = 'pettanr_simple_format'
|
4
|
+
|
5
|
+
@escapeHTML = (t) ->
|
6
|
+
$("<div/>").text(t).html()
|
7
|
+
|
8
|
+
@render = (content) ->
|
9
|
+
text = PettanrSimpleFormat.escapeHTML(content)
|
10
|
+
start_tag = '<p>'
|
11
|
+
text = text.replace(/\r\n?/g, "\n")
|
12
|
+
text = text.replace(/\n\n+/g, "</p>\n\n<p>")
|
13
|
+
text = text.replace(/([^\n]\n)(?=[^\n])/g, '\n<br />')
|
14
|
+
text = start_tag + text + "</p>"
|
15
|
+
return text
|
16
|
+
|
17
|
+
window.PettanrWritingFormat.renderers[PettanrSimpleFormat.engine_name] = PettanrSimpleFormat
|
18
|
+
@PettanrSimpleFormat = PettanrSimpleFormat
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pettanr_simple_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -67,7 +67,7 @@ extensions: []
|
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
69
|
- app/assets/javascripts/pettanr_simple_format/application.js
|
70
|
-
- app/assets/javascripts/pettanr_simple_format/
|
70
|
+
- app/assets/javascripts/pettanr_simple_format/pettanr_simple_format.js.coffee
|
71
71
|
- app/assets/stylesheets/pettanr_simple_format/application.css
|
72
72
|
- app/assets/stylesheets/pettanr_simple_format/writing_formats.css
|
73
73
|
- app/models/pettanr_simple_format/renderer.rb
|