Skip to content

Instantly share code, notes, and snippets.

@mrmt
Created Dec 26, 2011
Embed
What would you like to do?
convert wiki notation from wiliki to souceforge.jp
;; -*-emacs-lisp-*-
;; converting wiki notation from wiliki to souceforge.jp
(defun sf ()
"converting wiki notation from wiliki to souceforge.jp"
(interactive)
(save-excursion
;; heading
(goto-char (point-min))
(replace-regexp "^\* " "= ")
(goto-char (point-min))
(replace-regexp "^\*\* " "== ")
(goto-char (point-min))
(replace-regexp "^\*\*\* " "=== ")
;; itemize
(goto-char (point-min))
(replace-regexp "^- " " * ")
(goto-char (point-min))
(replace-regexp "^-- " " * ")
(goto-char (point-min))
(replace-regexp "^--- " " * ")
(goto-char (point-min))
(replace-regexp "^---- " " * ")
;; link
(goto-char (point-min))
(replace-string "[[" "[")
(goto-char (point-min))
(replace-string "]]" "]")
(goto-char (point-min))
;; table
(replace-string "|" "||")
(goto-char (point-min))
;; line break
(replace-string "~%" "[[BR]]")
(goto-char (point-min))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment