Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add org2blog #5299

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions layers/+blog/org2blog/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#+TITLE: org2blog layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../css/readtheorg.css" />

* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Install][Install]]
- [[Key bindings][Key bindings]]

* Description
This layer provides org to wordpress blog integration. For standard
configurations one simply needs to configure the hostname of the wordpress blog
and enter the username and password in a ~.netrc~ or ~.authinfo.gpg~ file.

* Install
To use org2blog add it to your =~/.spacemacs= file

#+begin_src emacs-lisp
(setq-default dotspacemacs-configuration-layers
'((org2blog :variables org2blog-name "myblog.wordpress.com")))
#+end_src

Additionally add an entry for the blog in your ~.netrc~ or ~.authinfo~ file.

#+caption: example ~.authinfo.gpg~
#+begin_example
machine myblog.wordpress.com login myusername password mypassword
#+end_example

* Key bindings

| Key Binding | Description |
|---------------+------------------------------------------------|
| ~<SPC> o b~ | org2blog/wp-new-entry |
| ~<SPC> m B n~ | org2blog/wp-preview-buffer-post |
| ~<SPC> m B N~ | org2blog/wp-preview-subtree-post |
| ~<SPC> m B d~ | org2blog/wp-post-buffer |
| ~<SPC> m B p~ | org2blog/wp-post-buffer-as-page |
| ~<SPC> m B s~ | org2blog/wp-post-buffer-as-subtree |
| ~<SPC> m B B~ | org2blog/wp-post-buffer-and-publish |
| ~<SPC> m B P~ | org2blog/wp-post-buffer-as-page-and-publish |
| ~<SPC> m B S~ | org2blog/wp-post-buffer-as-subtree-and-publish |
|---------------+------------------------------------------------|
10 changes: 10 additions & 0 deletions layers/+blog/org2blog/config.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
;;
;; Author: Christian E. Hopps <chopps@gmail.com>
;;
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;

(defvar org2blog-name nil
"hostname of the wordpress blog (e.g., myserverblog.org or myname.wordpress.com)")
66 changes: 66 additions & 0 deletions layers/+blog/org2blog/packages.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
;;; packages.el --- org2blog layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Christian E. Hopps <chopps@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

;;; Commentary:

;; Org2blog layer.

;;; Code:

(defconst org2blog-packages
'((org2blog :location (recipe :fetcher github :repo "punchagan/org2blog"))
org
metaweblog
xml-rpc))

(defun org2blog/init-xml-rpc ()
(use-package xml-rpc))

(defun org2blog/init-metaweblog ()
(use-package metaweblog))

(defun org2blog/init-org2blog ()
(use-package org2blog
:commands (org2blog/wp-mode org2blog/wp-new-entry org2blog/wp-login)
:init
(spacemacs/set-leader-keys "ob" 'org2blog/wp-new-entry)
:config
(progn
;; Map emacs languages to HTML recognized ones.
(setq org2blog/wp-shortcode-langs-map '(("emacs-lisp" . "lisp") ("sh" . "bash")))

(if org2blog-name
(setq org2blog/wp-blog-alist
`((,org2blog-name
:url ,(concat "http://" org2blog-name "/xmlrpc.php")
:username ,(car (auth-source-user-and-password org2blog-name))
:password ,(cadr (auth-source-user-and-password org2blog-name)))))))))

(defun org2blog/post-init-org ()
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"Bx" 'org2blog/wp-delete-entry
"BX" 'org2blog/wp-delete-page
"Bl" 'org2blog/wp-login
;; preview ('n' unixy dry-run)
"Bn" 'org2blog/wp-preview-buffer-post
"BN" 'org2blog/wp-preview-subtree-post
;; post, capitalize for -and-publish
"Bb" 'org2blog/wp-post-buffer
"Bp" 'org2blog/wp-post-buffer-as-page
"Bs" 'org2blog/wp-post-subtree

"BB" 'org2blog/wp-post-buffer-and-publish ;; need prefix key
"BP" 'org2blog/wp-post-buffer-as-page-and-publish ;; need prefix key
"BS" 'org2blog/wp-post-subtree-as-page-and-publish
;; "bpS" 'org2blog/wp-post-subtree-as-page
)
)
;;; packages.el ends here