Sha256: 1af06dff74e72a247ec691dbef027d7b27a13ce7226222e227d43506318dd72e
Contents?: true
Size: 546 Bytes
Versions: 8
Compression:
Stored size: 546 Bytes
Contents
module Playgroundbook class PageProcessor def strip_extraneous_newlines(page_contents) # Three cases we need to look for: # - Extraneous newlines before /*: # - Extraneous newlines after */ # - Extraneous newlines either before or after //: page_contents .gsub(/\n+\/\*:/, "\n/*:") .gsub(/\*\/\n+/, "*/\n") .split(/(\/\/:.*$)\n*/).join("\n") # Important to do this before the next line, because it adds newlines before //: comments. .gsub(/\n+\/\/:/, "\n//:") end end end
Version data entries
8 entries across 8 versions & 1 rubygems