writetheman 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,7 @@ module Writetheman
|
|
33
33
|
def init_content_from_header_body
|
34
34
|
raise 'no header to get content' if @header.nil? || @header.empty?
|
35
35
|
raise 'no body to get content' if @body.nil? || @body.empty?
|
36
|
+
format_body
|
36
37
|
@all_content = "---" + "\n" + @header + "\n" + "---" + "\n\n" + @body
|
37
38
|
end
|
38
39
|
|
@@ -100,6 +101,9 @@ module Writetheman
|
|
100
101
|
get_header_from_content.split("\n")
|
101
102
|
end
|
102
103
|
|
104
|
+
def format_body
|
105
|
+
@body = Utils::format_readable_html(@body)
|
106
|
+
end
|
103
107
|
end
|
104
108
|
end
|
105
109
|
end
|
@@ -26,12 +26,14 @@ module Writetheman
|
|
26
26
|
content = special_encoding(content.force_encoding('utf-8')).gsub("\r", "")
|
27
27
|
end
|
28
28
|
|
29
|
+
# @todo : move in the rails admin (format from the editor)
|
29
30
|
def self.format_readable_html(content)
|
30
31
|
content.gsub("<br><h2>", "<h2>").gsub("<div><br></div><h1>", "<h1>")
|
31
32
|
.gsub("><div>", "> \n<div>").gsub("</div><", "</div> \n<")
|
32
|
-
.gsub("><
|
33
|
+
.gsub("><p>", "> \n<p>").gsub("</p><", "</p> \n<")
|
34
|
+
.gsub("><br>", "> \n<br> \n").gsub(".<br>", ". \n<br> \n").gsub("<br >", "<br>")
|
33
35
|
.gsub("<br></h1>", "</h1>").gsub("<br></h2>", "</h2>")
|
34
|
-
.gsub(" ", "
|
36
|
+
.gsub(" ", " ").gsub("&amp;lt;", "<").gsub("<p> </p>", "<p> </p>")
|
35
37
|
end
|
36
38
|
|
37
39
|
def self.regex_body_from_content(content)
|
data/lib/writetheman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: writetheman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
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: 2014-04-
|
12
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|