pettanr_simple_format 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module PettanrSimpleFormat
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
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.7
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-09 00:00:00.000000000 Z
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/speech_renderer.js.coffee
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
@@ -1,7 +0,0 @@
1
- $ ->
2
- escapeHTML = (t) ->
3
- $("<div/>").text(t).html()
4
-
5
- pettanr_simple_format_function = (content) ->
6
- escapeHTML(content).replace(/\n/g, "<br>\n")
7
- writing_format_functions['pettanr_simple_format'] = pettanr_simple_format_function