module Clayoven::Claytext::Util

Miscellanous utilities

Public Class Methods

slice_strip_fences!(paragraphs, index, length) click to toggle source

Slice a paragraph along index and length, strip out the first line of the first paragraph, the last line of the last paragraph, and finally return the join of the slices with two newlines, the “fenced paragraph”

# File lib/clayoven/util.rb, line 35
def self.slice_strip_fences!(paragraphs, index, length)
  slices = paragraphs[index, length]
  slices[0] = slices[0].split("\n")[1..].join("\n")
  slices[-1] = slices[-1].split("\n")[..-2].join("\n")
  slices.join("\n\n")
end