code2gist 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code2gist (0.0.3)
4
+ code2gist (0.0.4)
5
5
 
6
6
  GEM
7
7
  specs:
data/code2gist.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "code2gist"
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Gonçalo Silva"]
8
8
  s.email = ["goncalossilva@gmail.com"]
data/lib/code2gist.rb CHANGED
@@ -5,7 +5,7 @@ require "json"
5
5
  module Code2Gist
6
6
  extend self
7
7
 
8
- CODE_REGEX = /```(\w+\.\w+)?[^\n]*\n(.*?)```/m
8
+ CODE_REGEX = /```((?:\s*)\w+\.\w+)?[^\n]*\n(.*?)```/m
9
9
 
10
10
  module Config
11
11
  def self.github_login
@@ -52,7 +52,7 @@ module Code2Gist
52
52
 
53
53
  def name_nameless_code_blocks(text)
54
54
  nameless_blocks = 0
55
- new_text = text.gsub(/```(\w+\.\w+)?/).with_index do |match, index|
55
+ new_text = text.gsub(/```((?:\s*)\w+\.\w+)?/).with_index do |match, index|
56
56
  if index%2 == 0 && match.size == 3
57
57
  nameless_blocks += 1;
58
58
  "```untitled_#{nameless_blocks}.txt"
@@ -21,6 +21,11 @@ class Code2GistTest < Test::Unit::TestCase
21
21
  Not sure what this is
22
22
  ```
23
23
 
24
+ Spaces are allowed, too:
25
+ ``` itworks.tx
26
+ It works!
27
+ ```
28
+
24
29
  The end
25
30
  eoc
26
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code2gist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.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: 2011-08-19 00:00:00.000000000Z
12
+ date: 2011-08-23 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Parse text files (markdown/textile/whatever) for code blocks and gist
15
15
  them
@@ -42,7 +42,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
42
42
  version: '0'
43
43
  segments:
44
44
  - 0
45
- hash: 3355642002282232388
45
+ hash: -3615808291212224038
46
46
  required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  none: false
48
48
  requirements: