Skip to content

Instantly share code, notes, and snippets.

@diasjorge
Created February 20, 2009 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diasjorge/67440 to your computer and use it in GitHub Desktop.
Save diasjorge/67440 to your computer and use it in GitHub Desktop.
(defun haml-convert-rhtml-file (rhtmlFile hamlFile)
"Convierte un fichero rhtml en un haml y abre un nuevo buffer"
(interactive "fSelect rhtml file: \nFSelect output (haml) file: ")
(let ((comando (concat "/usr/bin/html2haml -r "
rhtmlFile
" "
hamlFile)))
(shell-command comando)
(find-file hamlFile)))
(defun haml-convert-region (beg end)
"Convierte la región seleccionada a código haml"
(interactive "r")
(let ((comando "/usr/bin/html2haml -r -s"))
(shell-command-on-region beg end comando (buffer-name) t)))
(defun haml-to-html-region (beg end)
"Convierte la región seleccionada a código html"
(interactive "r")
(let ((comando "/usr/bin/haml -s -c"))
(shell-command-on-region beg end comando (buffer-name) t)))
(defun haml-convert-buffer ()
"Convierte el buffer seleccionado a código haml"
(interactive)
(let ((nuevoarchivo
(replace-regexp-in-string "r?html\\(.erb\\)?$" "haml"
(buffer-file-name))))
(haml-convert-region (point-min) (point-max))
(write-file nuevoarchivo)))
(defun sass-convert-region (beg end)
"Convierte la región seleccionada a código sass"
(interactive "r")
(let ((comando "/usr/bin/css2sass -s"))
(shell-command-on-region beg end comando (buffer-name) t)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment