Sha256: f357bb8d8bd9844d593c11c04cf5ea043c03d43d53e19171595af19a3b6697b1

Contents?: true

Size: 794 Bytes

Versions: 21

Compression:

Stored size: 794 Bytes

Contents

# @Opulent
module Opulent
  # @Compiler
  class Compiler
    # Generate the code for a standard text node
    #
    # @param node [Array] Node code generation data
    # @param indent [Fixnum] Size of the indentation to be added
    #
    def plain(node, indent)
      value = node[@options][:value]

      # Leading whitespace
      buffer_freeze ' ' if node[@options][:leading_whitespace]

      # Evaluate text node if it's marked as such and print nodes in the
      # current context
      if node[@value] == :text
        buffer_split_by_interpolation value, node[@options][:escaped]
      else
        node[@options][:escaped] ? buffer_escape(value) : buffer(value)
      end

      # Trailing whitespace
      buffer_freeze ' ' if node[@options][:trailing_whitespace]
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
opulent-1.7.11 lib/opulent/compiler/text.rb
opulent-1.7.10 lib/opulent/compiler/text.rb
opulent-1.7.9 lib/opulent/compiler/text.rb
opulent-1.7.8 lib/opulent/compiler/text.rb
opulent-1.7.7 lib/opulent/compiler/text.rb
opulent-1.7.6 lib/opulent/compiler/text.rb
opulent-1.7.5 lib/opulent/compiler/text.rb
opulent-1.7.4 lib/opulent/compiler/text.rb
opulent-1.7.3 lib/opulent/compiler/text.rb
opulent-1.7.2 lib/opulent/compiler/text.rb
opulent-1.7.1 lib/opulent/compiler/text.rb
opulent-1.7.0 lib/opulent/compiler/text.rb
opulent-1.6.9 lib/opulent/compiler/text.rb
opulent-1.6.8 lib/opulent/compiler/text.rb
opulent-1.6.7 lib/opulent/compiler/text.rb
opulent-1.6.6 lib/opulent/compiler/text.rb
opulent-1.6.5 lib/opulent/compiler/text.rb
opulent-1.6.3 lib/opulent/compiler/text.rb
opulent-1.6.2 lib/opulent/compiler/text.rb
opulent-1.6.1 lib/opulent/compiler/text.rb