feed_yamlizer 0.1.2 → 0.1.4

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/lib/feed_yamlizer.rb CHANGED
@@ -17,12 +17,18 @@ require 'string_ext'
17
17
 
18
18
  class FeedYamlizer
19
19
  include FileUtils::Verbose
20
- def self.format(x, flags='')
21
- IO.popen("fmt #{flags}", "r+") do |pipe|
20
+
21
+ def self.format(x, indent=0)
22
+ res = IO.popen("fmt -w #{75 - indent}", "r+") do |pipe|
22
23
  pipe.puts x
23
24
  pipe.close_write
24
25
  pipe.read
25
26
  end
27
+ if indent
28
+ res.gsub(/^(?=\S)/, ' ' * indent)
29
+ else
30
+ res
31
+ end
26
32
  end
27
33
 
28
34
  def initialize(feed)
@@ -42,7 +42,7 @@ class FeedYamlizer
42
42
  elsif line == '[/blockquote]'
43
43
  inblock = false
44
44
  block = blockquote_buffer.join("\n")
45
- line_buffer << ( FeedYamlizer.format(block, '-c') )
45
+ line_buffer << (FeedYamlizer.format(block, 4))
46
46
  blockquote_buffer = []
47
47
  else
48
48
  if inblock
@@ -1,3 +1,3 @@
1
1
  class FeedYamlizer
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-22 00:00:00 -05:00
17
+ date: 2011-02-25 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency