 
       @positionDropDown()
 
-      @addDropDown result for result in results
+      @addDropDownItem result for result in results
       @dropDownContainer.show()
 
       @numDropDownItems = results.length
       @initEventListeners()
 
-   addDropDown: (result)->
-      if result[0] == '<'
-         result = result.slice(1, -1)
-
+   addDropDownItem: (result)->
       html = @currentStrategy.template(result)
 
       container = $('<li/>')

      parentRange = $('trix-editor').offset()
      domRange = @editor.getClientRectAtPosition(@editor.getPosition() - 1)

      return unless domRange?

      topVal = domRange.top + domRange.height
      leftVal = domRange.left + domRange.width

      @dropDown.css({top: topVal, left: leftVal, position: 'fixed', 'z-index':100})

   populateDropDown: (results)=>
      return unless results?
      return unless @autoCompleteOn
      @numDropDownItems = 0

      @dropDownContainer.empty()

{handleEvent} = Trix

class Trix.AutoComplete
   constructor: (@editor, @dropDownContainer, @strategies)->
      @autoCompleteOn = false
      @documentString = @editor.getDocument().toString()
      @startingPosition = 0
      @endingPosition = 0
      @numDropDownItems = 0
      @currentStrategy

   autoCompleteHandler: ->
      @documentString = @editor.getDocument().toString()
      position = @editor.getPosition()

      @dropDownContainer.hide()

      return if position == 0

      @checkAutoComplete(@documentString[position - 1], position - 1)

   checkAutoComplete: (currentString, position) ->
      @autoCompleteOn = false
      searchForSymbol = true
      results = []

      @endingPosition = position

      self = this

      while searchForSymbol
         if currentString[0] == ' '
            searchForSymbol = false
            break
         else if position < 0
            searchForSymbol = false
            break

         for strategy in self.strategies
            if strategy.trigger.test(currentString)
               searchForSymbol = false
               @autoCompleteOn = true
               @startingPosition = position
               @currentStrategy = strategy
               @searchTerm = currentString
               break

         position--
         currentString = @documentString[position] + currentString

      if @autoCompleteOn
         if @currentStrategy.index
            @searchTerm = @searchTerm.slice(@currentStrategy.index)

         @currentStrategy.search(@searchTerm, @populateDropDown)


   autoCompleteEnd: ->
      @autoCompleteOn = false
