bbcode-rails 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bbcode-rails/version.rb +1 -1
- data/lib/bbcode-rails.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aa8fab0bb526ca10fe4155bf805ad7d67ee8979
|
4
|
+
data.tar.gz: ce9c6146c7510e85d14b5402889f18fa559faf3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4854f8e1b3263f11005ad609b5ac34d4e0ee67ee4f1d30753b33e4c2f0fb7f32852d99f5e4117b018fbb242815f9cc0093e65508aa60f6577d343c304581a2aa
|
7
|
+
data.tar.gz: e84cda55cccbbe6deb557c5110f49d001821e1f107f998d8e49a5e6d3c45c5457d6ee20b0d4e523770b69db472b7271bdef801a6a280955837a73669d9b0f123
|
data/lib/bbcode-rails/version.rb
CHANGED
data/lib/bbcode-rails.rb
CHANGED
@@ -160,7 +160,9 @@ module BBCode
|
|
160
160
|
start_tag = '<p>'
|
161
161
|
result_str.gsub!(/\r\n?/, "\n") # \r\n and \r => \n
|
162
162
|
result_str.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline => paragraph
|
163
|
-
result_str.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br>')
|
163
|
+
result_str.gsub!(/([^\n>]\n)(?=[^\n<])/, '\1<br>')# 1 newline => br
|
164
|
+
result_str.gsub!(/(>)\n+/, '\1') # 1 newline around tags => nothing
|
165
|
+
result_str.gsub!(/\n+(<)/, '\1') # 1 newline around tags => nothing
|
164
166
|
result_str.insert 0, start_tag
|
165
167
|
result_str << '</p>'
|
166
168
|
rescue BBCode::ParseError => e
|