(defun haml-ify ()
  "run html2haml on current buffer"
  (setf filename buffer-file-name)
  (setf newfilename (concat
    (car (split-string filename "\\.")) ".html.haml"))
  (shell-command (concat
    "html2haml " filename " > " newfilename))
  (kill-buffer (current-buffer))
  (delete-file filename)
  (find-file newfilename))

haml-ify within emacs

  • snippet type: utility
  • keywords: html, erb, haml, convert, html2haml, rails, emacs
  • language: elisp

HAML (HTML Abstraction Markup Language) is a templating language by Hampton Caitlin, mostly used in context of Ruby On Rails. Put the given snippet in your .emacs file to be able to convert .html.erb files to .html.haml from within emacs by calling the function haml-ify “M-x haml-ify”.

all snippets