     for pair in @_languageDetectionCache
       return pair[1] if baseName.match pair[0]
 
-  # Map a list of file paths to relative target paths by stripping prefixes off of them.
+  # Map a list of file paths to relative target paths by stripping prefixes.
   mapFiles: (resolveRoot, files, stripPrefixes) ->
-    # Ensure that we're dealing with absolute paths across the board
+    # Ensure that we're dealing with absolute paths across the board.
     files = files.map (f) -> path.resolve resolveRoot, f
-    # And that the strip prefixes all end with a /, to avoid a target path being absolute.
-    stripPrefixes = stripPrefixes.map (p) -> path.join( "#{path.resolve resolveRoot, p}#{CompatibilityHelpers.pathSep}" )
-
-    # Prefixes are stripped in order of most specific to least (# of directories deep)
+
+    # And that the strip prefixes all end with a /, avoids absolute target path.
+    stripPrefixes = stripPrefixes.map (p) ->
+      path.join "#{path.resolve resolveRoot, p}#{CompatibilityHelpers.pathSep}"
+
+    # Prefixes are stripped in the order of most specific to least
+    # (# of directories deep)
     prefixes = stripPrefixes.sort (a,b) => @pathDepth(b) - @pathDepth(a)
 
     result = {}



module.exports = Utils =
  # Escape regular expression characters in a string
  #
  # Code from http://zetafleet.com/ via http://simonwillison.net/2006/Jan/20/escape/
  regexpEscape: (string) ->
    string.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')

  # Detect and return the language that a given file is written in.
  #
  # The language is also annotated with a name property, matching the laguages key in LANGUAGES.
  getLanguage: (filePath, languageDefinitions = './languages') ->
    unless @_languageDetectionCache?
      @_languageDetectionCache = []

  splitSource: (data, language, options={}) ->
    lines = data.split /\r?\n/

    # Always strip shebangs - but don't shift it off the array to
    # avoid the perf hit of walking the array to update indices.
    lines[0] = '' if lines[0][0..1] is '#!'

    # Special case: If the language is comments-only, we can skip pygments
    return [new @Segment [], lines] if language.commentsOnly
