Class: DatoDast::Nodes::Code

Inherits:
Base
  • Object
show all
Defined in:
lib/dato_dast/nodes/code.rb

Constant Summary

Constants inherited from Base

Base::EMPTY, Base::NEWLINE

Instance Method Summary collapse

Methods inherited from Base

#children, #config, #css_class, #initialize, #meta, #node_config, #render_children, #tag, #tag_info, #type, type, #wrappers

Constructor Details

This class inherits a constructor from DatoDast::Nodes::Base

Instance Method Details

#codeObject



8
9
10
# File 'lib/dato_dast/nodes/code.rb', line 8

def code
  @node["code"]
end

#languageObject



4
5
6
# File 'lib/dato_dast/nodes/code.rb', line 4

def language
  @node["language"]
end

#renderObject



12
13
14
15
16
17
18
# File 'lib/dato_dast/nodes/code.rb', line 12

def render
  if highlighter?
    highlight
  else
    super
  end
end

#render_valueObject



20
21
22
# File 'lib/dato_dast/nodes/code.rb', line 20

def render_value
  code.gsub(/\n/, "<br/>")
end