                        ruby-font-lock-syntactic-keywords))
 
 (defun haml-handle-filter (filter-name limit fn)
-  "Call `fn' with `beg' and `end' params if a :filter-name block is found."
+  "If a FILTER-NAME filter is found within LIMIT, run FN on that filter.
+
+FN is passed a pair of points representing the beginning and end
+of the filtered text."
   (when (re-search-forward (haml-nested-regexp (concat ":" filter-name)) limit t)
     (funcall fn (+ 2 (match-beginning 2)) (match-end 2))))
 
 (defun haml-fontify-filter-region (filter-name limit &rest fontify-region-args)
-  "Find a filter block of type `filter-name' and call `haml-fontify-region'
-with the provided args."
+  "If a FILTER-NAME filter is found within LIMIT, fontify it.
+
+The fontification is done by passing FONTIFY-REGION-ARGS to
+`haml-fontify-region'."
   (haml-handle-filter filter-name limit
                       (lambda (beg end)
                         (apply 'haml-fontify-region

                                  nil)))

(defun haml-highlight-textile-filter-block (limit)
  "Highlight Textile inside ':textile' filter block.

Note that the results are not perfect, since textile-mode expects
certain constructs such as 'h1.' to be at the beginning of a line,
and indented haml filter blocks always have leading whitespace.

For this to work, 'textile-mode.el' must be available."
  (if (boundp 'textile-font-lock-keywords)
      (haml-fontify-filter-region "textile" limit textile-font-lock-keywords nil nil)))

(defun haml-highlight-markdown-filter-block (limit)
  "Highlight Markdown inside ':markdown' filter block.

For this to work, 'markdown-mode.el' must be available."
  (if (boundp 'markdown-mode-font-lock-keywords)
      (haml-fontify-filter-region "markdown" limit
                                  markdown-mode-font-lock-keywords

(defconst haml-comment-re "^ *\\(?:-\\#\\|/\\)")

(defun haml-fontify-region (beg end keywords syntax-table syntactic-keywords)
  "Fontify a region between BEG and END using another mode's fontification.

KEYWORDS, SYNTAX-TABLE, and SYNTACTIC-KEYWORDS are the values of that mode's
`font-lock-keywords', `font-lock-syntax-table',
and `font-lock-syntactic-keywords', respectively."
  (save-excursion
    (save-match-data
      (let ((font-lock-keywords keywords)
