model_formatting 0.2.3.1 → 0.2.3.2
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.
- data/Rakefile +1 -1
- data/lib/model_formatting.rb +1 -1
- data/test/formatting_test.rb +7 -0
- metadata +4 -4
data/Rakefile
CHANGED
data/lib/model_formatting.rb
CHANGED
|
@@ -169,7 +169,7 @@ module ModelFormatting
|
|
|
169
169
|
def self.gfm(text)
|
|
170
170
|
extract_tag(text, :pre) do |txt|
|
|
171
171
|
# prevent foo_bar_baz from ending up with an italic word in the middle
|
|
172
|
-
text.gsub!(/(^(?! {4}|\t)
|
|
172
|
+
text.gsub!(/(^(?! {4}|\t)[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]\w*)/) do |x|
|
|
173
173
|
x.gsub('_', '\_') if x.split('').sort.to_s[0..1] == '__'
|
|
174
174
|
end
|
|
175
175
|
|
data/test/formatting_test.rb
CHANGED
|
@@ -39,6 +39,13 @@ module ModelFormatting
|
|
|
39
39
|
record.formatted_body.should == %(<div><p>booya</p></div>)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
it "bolds the string 'Name'" do
|
|
43
|
+
record = Simple.new
|
|
44
|
+
record.body = "My name is\n__Name__"
|
|
45
|
+
record.save
|
|
46
|
+
record.formatted_body.should == %(<div><p>My name is<br />\n<strong>Name</strong></p></div>)
|
|
47
|
+
end
|
|
48
|
+
|
|
42
49
|
it "preserves leading spaces in code blocks" do
|
|
43
50
|
record = Simple.new
|
|
44
51
|
record.body = " code\n more code\n\nnot code\n\n"
|
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: 87
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
9
|
- 3
|
|
10
|
-
-
|
|
11
|
-
version: 0.2.3.
|
|
10
|
+
- 2
|
|
11
|
+
version: 0.2.3.2
|
|
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: 2011-04
|
|
19
|
+
date: 2011-11-04 00:00:00 -07:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|