Method: CodeInclusion::Code#to_s

Defined in:
lib/polytexnic/code_inclusion.rb

#to_sObject

Returns the formatted code or an error message



161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/polytexnic/code_inclusion.rb', line 161

def to_s
  return unless filename

  result = []
  result << "%= lang:#{language}#{highlight}"
  result << '\begin{code}'
  result.concat(raw_code)
  result << '\end{code}'

  rescue CodeInclusionException => e
    code_error(e.message)
end