lib/octopress-ink/utils.rb in octopress-ink-1.0.0.rc.39 vs lib/octopress-ink/utils.rb in octopress-ink-1.0.0.rc.40
- old
+ new
@@ -7,15 +7,16 @@
def pretty_print_yaml(yaml)
# Use json pretty_print, but make it look like yaml
#
JSON.pretty_generate(yaml)
- .sub(/\A{\n/,'') # remove leading {
- .sub(/}\z/,'') # remove trailing }
- .gsub(/^/,' ') # indent
- .gsub(/"(.+?)":/,'\1:') # remove quotes around keys
- .gsub(/,$/,'') # remove commas from end of lines
- .gsub(/\w+: {\s+}\n/,'') # remove keys with empty hashes
+ .sub(/\A{\n/,'') # remove leading {
+ .sub(/}\z/,'') # remove trailing }
+ .gsub(/^/,' ') # indent
+ .gsub(/"(.+?)":/,'\1:') # remove quotes around keys
+ .gsub(/,$/,'') # remove commas from end of lines
+ .gsub(/{\n/,"\n") # remove keys with empty hashes
+ .gsub(/^\s+}\n/,'') # remove keys with empty hashes
end
end
end
end