26 lines
602 B
Ruby
26 lines
602 B
Ruby
|
# :stopdoc:
|
||
|
module Haml
|
||
|
# This module contains functionality that's shared across Haml and Sass.
|
||
|
module Shared
|
||
|
def self.human_indentation(indentation, was = false)
|
||
|
if !indentation.include?(?\t)
|
||
|
noun = 'space'
|
||
|
elsif !indentation.include?(?\s)
|
||
|
noun = 'tab'
|
||
|
else
|
||
|
return indentation.inspect + (was ? ' was' : '')
|
||
|
end
|
||
|
|
||
|
singular = indentation.length == 1
|
||
|
if was
|
||
|
was = singular ? ' was' : ' were'
|
||
|
else
|
||
|
was = ''
|
||
|
end
|
||
|
|
||
|
"#{indentation.length} #{noun}#{'s' unless singular}#{was}"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
# :startdoc:
|