model_formatting 0.2.3.12 → 0.2.3.13
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/model_formatting.rb +0 -5
- data/test/model_formatting_test.rb +2 -2
- metadata +4 -4
data/Rakefile
CHANGED
data/lib/model_formatting.rb
CHANGED
@@ -178,11 +178,6 @@ module ModelFormatting
|
|
178
178
|
|
179
179
|
def self.gfm(text)
|
180
180
|
extract_tag(text, :pre) do |txt|
|
181
|
-
# prevent foo_bar_baz from ending up with an italic word in the middle
|
182
|
-
text.gsub!(/(^(?! {4}|\t)\w+_\w+_\w[\w_]*)/) do |x|
|
183
|
-
x.gsub('_', '\_') if x.split('').sort.to_s[0..1] == '__'
|
184
|
-
end
|
185
|
-
|
186
181
|
# in very clear cases, let newlines become <br /> tags
|
187
182
|
#text.gsub!(/(\A|^$\n)(^\w[^\n]*\n)(^\w[^\n]*$)+/m) do |x|
|
188
183
|
# x.gsub(/^(.+)$/, "\\1 ")
|
@@ -105,8 +105,8 @@ class ModelFormattingTest < Test::Unit::TestCase
|
|
105
105
|
assert_equal "<pre>\nfoo_bar_baz\n</pre>", ModelFormatting.gfm("<pre>\nfoo_bar_baz\n</pre>")
|
106
106
|
end
|
107
107
|
|
108
|
-
it "
|
109
|
-
assert_equal "
|
108
|
+
it "does not touch underscores inside words" do
|
109
|
+
assert_equal "foo_bar_baz", ModelFormatting.gfm("foo_bar_baz")
|
110
110
|
end
|
111
111
|
|
112
112
|
it "turns newlines into br tags in simple cases" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_formatting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 73
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 3
|
10
|
-
-
|
11
|
-
version: 0.2.3.
|
10
|
+
- 13
|
11
|
+
version: 0.2.3.13
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- ENTP
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-01-
|
19
|
+
date: 2013-01-23 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: redcarpet
|