Skip to content

Instantly share code, notes, and snippets.

@tpanum
Last active August 29, 2015 14:07
Show Gist options
  • Save tpanum/f1bcd76cfdc6d3f3b28a to your computer and use it in GitHub Desktop.
Save tpanum/f1bcd76cfdc6d3f3b28a to your computer and use it in GitHub Desktop.

Revisions

  1. tpanum revised this gist Oct 14, 2014. 1 changed file with 20 additions and 18 deletions.
    38 changes: 20 additions & 18 deletions jekyll.el
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,25 @@
    (defun tpanum/create-jekyll-post (title)
    (defun tpanum/create-jekyll-post
    (title)
    "Creates a new buffer and file for a blog post"
    (interactive "sTitle of blog post: ")
    (let ((filename (concat
    (format-time-string "%Y-%m-%d-")
    (replace-regexp-in-string " " "-" (downcase (replace-regexp-in-string "[^0-9a-zA-Z ]" "" title))))
    ))
    (switch-to-buffer (generate-new-buffer filename))
    (let
    ((filename
    (concat
    (format-time-string "%Y-%m-%d-")
    (replace-regexp-in-string " " "-"
    (downcase
    (replace-regexp-in-string "[^0-9a-zA-Z ]" "" title))))))
    (switch-to-buffer
    (generate-new-buffer filename))
    (insert
    (concat
    (mapconcat 'identity '("---" "layout: post") "\n")
    "\n"
    "title: '"
    title
    "'\n"
    "date: '"
    (mapconcat 'identity
    '("---" "layout: post")
    "\n")
    "\n" "title: '" title "'\n" "date: '"
    (format-time-string "%Y-%m-%d %H:%M:%S %z")
    "'\n"
    "---\n"
    )
    )
    (if (boundp 'blog-home) (write-file (concat blog-home "/_posts/" filename ".markdown")))
    ))
    "'\n" "---\n"))
    (if
    (boundp 'blog-home)
    (write-file
    (concat blog-home "/_posts/" filename ".markdown")))))
  2. tpanum renamed this gist Oct 14, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. tpanum created this gist Oct 14, 2014.
    23 changes: 23 additions & 0 deletions gistfile1.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    (defun tpanum/create-jekyll-post (title)
    "Creates a new buffer and file for a blog post"
    (interactive "sTitle of blog post: ")
    (let ((filename (concat
    (format-time-string "%Y-%m-%d-")
    (replace-regexp-in-string " " "-" (downcase (replace-regexp-in-string "[^0-9a-zA-Z ]" "" title))))
    ))
    (switch-to-buffer (generate-new-buffer filename))
    (insert
    (concat
    (mapconcat 'identity '("---" "layout: post") "\n")
    "\n"
    "title: '"
    title
    "'\n"
    "date: '"
    (format-time-string "%Y-%m-%d %H:%M:%S %z")
    "'\n"
    "---\n"
    )
    )
    (if (boundp 'blog-home) (write-file (concat blog-home "/_posts/" filename ".markdown")))
    ))