Class: JayFillColumns

Inherits:
HTML::Pipeline::TextFilter
  • Object
show all
Defined in:
lib/jay_flavored_markdown/markdown_converter.rb

Overview

Fill columns with MAX_COLUMN characters in one line

(1) One sheep, two sheep, three sheep, four sheep, five sheep.
  (A) Six sheep, seven sheep, eight sheep, nine sheep, ten sheep.

is converted to:

(1) One sheep, two sheep, three sheep, four
    sheep, five sheep.
  (A) Six sheep, seven sheep, eight sheep,
      nine sheep, ten sheep.

Constant Summary collapse

MAX_COLUMN =
70

Instance Method Summary collapse

Instance Method Details

#callObject



810
811
812
813
814
815
816
# File 'lib/jay_flavored_markdown/markdown_converter.rb', line 810

def call
  lines = @text.split("\n")
  @text = lines.map do |line|
    pos = paragraph_position(line)
    fill_column(line, MAX_COLUMN, pos, ' ')
  end.join("\n")
end