Class: DocumentGenerator::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/document_generator/output.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentObject

Returns the value of attribute content.



3
4
5
# File 'lib/document_generator/output.rb', line 3

def content
  @content
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/document_generator/output.rb', line 3

def description
  @description
end

Class Method Details

.no_really_escape(value) ⇒ Object

TODO: This is due to a bug in maruku. We should create an issue there–and possibly a PR to fix?



7
8
9
10
11
12
13
14
15
# File 'lib/document_generator/output.rb', line 7

def self.no_really_escape(value)
  value.split("\n").map do |line|
    if line.strip.size.zero?
      " "
    else
      line
    end
  end.join("\n")
end

Instance Method Details

#escaped_contentObject



17
18
19
20
21
22
23
24
25
# File 'lib/document_generator/output.rb', line 17

def escaped_content
  temp = []
  content.each do |line|
    temp << line
    temp << "\n"
  end

  Output.no_really_escape(CGI.escapeHTML(temp.join.rstrip))
end