pettanr_simple_format 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2445f046853cdb055e3d8e7bd039a4e83163bc2
|
4
|
+
data.tar.gz: eff8257750f8863c7e0926d789369061ecec4770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be609c5246932d09204605111cd17cdf8ffbe41b3e726b98a7cc4f60886e47f9c57d95023f794dd38f2d70c280237ecef9f00b7b24b42d8f88f89e509c9cf7da
|
7
|
+
data.tar.gz: 54eed4e7d836870c4a7c001cda61019293dd5cfa34ae975b622ab71b4d011e88fc695dcd514272c4d72c670027b65a57444591005fc3882b73e8cdc0cc60927a
|
@@ -1,19 +1,4 @@
|
|
1
1
|
module PettanrSimpleFormat
|
2
2
|
class Renderer
|
3
|
-
def self.render content
|
4
|
-
self.simple_format(content)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.simple_format text
|
8
|
-
#text = Sanitize.clean(text.to_s, Sanitize::Config::RESTRICTED)
|
9
|
-
text = ERB::Util.html_escape(text.to_s)
|
10
|
-
start_tag = '<p>'
|
11
|
-
text.gsub!(/\r\n?/, "\n")
|
12
|
-
text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
|
13
|
-
text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
|
14
|
-
text.insert 0, start_tag
|
15
|
-
text.concat("</p>")
|
16
|
-
text
|
17
|
-
end
|
18
3
|
end
|
19
4
|
end
|
@@ -7,7 +7,8 @@ module PettanrSimpleFormat
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def render_simple_format text
|
10
|
-
text = Sanitize.clean(text.to_s, Sanitize::Config::RESTRICTED)
|
10
|
+
#text = Sanitize.clean(text.to_s, Sanitize::Config::RESTRICTED)
|
11
|
+
text = ERB::Util.html_escape(text.to_s)
|
11
12
|
start_tag = '<p>'
|
12
13
|
text.gsub!(/\r\n?/, "\n")
|
13
14
|
text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yasushiito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This software is a WritingFormat plugin for PettanR
|
14
14
|
email:
|
@@ -38,7 +38,8 @@ files:
|
|
38
38
|
- lib/tasks/pettanr_simple_format.rake
|
39
39
|
- lib/tasks/pettanr_simple_format_tasks.rake
|
40
40
|
homepage: https://github.com/yasushiito/pettanr_simple_format/wiki
|
41
|
-
licenses:
|
41
|
+
licenses:
|
42
|
+
- BSD-3-Clause
|
42
43
|
metadata: {}
|
43
44
|
post_install_message:
|
44
45
|
rdoc_options: []
|