Class: Undress::Textile

Inherits:
Grammar show all
Defined in:
lib/undress/textile.rb

Instance Attribute Summary

Attributes inherited from Grammar

#post_processing_rules, #pre_processing_rules, #whitelisted_attributes

Instance Method Summary collapse

Methods inherited from Grammar

#content_of, default, inherited, #initialize, #method_missing, post_processing, post_processing_rules, pre_processing, pre_processing_rules, #process, process!, #process!, rule_for, #surrounded_by_whitespace?, whitelist_attributes, whitelisted_attributes

Constructor Details

This class inherits a constructor from Undress::Grammar

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Undress::Grammar

Instance Method Details

#attributes(node) ⇒ Object

:nodoc:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/undress/textile.rb', line 86

def attributes(node) #:nodoc:
  filtered = super(node)

  if filtered.has_key?(:colspan)
    return "\\#{filtered[:colspan]}. "
  end

  if filtered.has_key?(:rowspan)
    return "/#{filtered[:rowspan]}. "
  end

  if filtered.has_key?(:lang)
    return "[#{filtered[:lang]}]"
  end

  if filtered.has_key?(:class) || filtered.has_key?(:id)
    klass = filtered.fetch(:class, "")
    id = filtered.fetch(:id, false) ? "#" + filtered[:id] : ""
    return "(#{klass}#{id})"
  end

  if filtered.has_key?(:style)
    return "{#{filtered[:style]}}"
  end

  ""
end