GithubHelp home page GithubHelp logo

xcodebuild / blog-admin Goto Github PK

View Code? Open in Web Editor NEW
229.0 10.0 24.0 88 KB

Write blog in emacs with hexo/org-page/nikola

License: GNU General Public License v2.0

Emacs Lisp 99.89% Shell 0.11%
emacs blog

blog-admin's Introduction

https://travis-ci.org/CodeFalling/blog-admin.svg https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg

blog-admin

https://github.com/CodeFalling/blog-admin/issues Write blog in emacs with hexo, org-page or nikola.

Preview

https://cloud.githubusercontent.com/assets/5436704/12700452/1aa686ea-c81e-11e5-92c6-5cd5e810ba35.gif

Install

Melpa

Manual

  1. git clone https://github.com/CodeFalling/blog-admin /path/to/blog-admin -b master
  2. (add-to-load-path "/path/to/blog-admin")
  3. (require 'blog-admin)
  4. You may have to install s f ctable as depends

Spacemacs

If you use a private spacemacs layer, just add blog-admin in your package.el then add below code into your private-layer-name/init-blog-admin

If you use a standalone .spacemacs file, just add blog-admin in your dotspacemacs-additional-packages, then add below code into dotspacemacs/user-config()

If installing from github(not melpa)

(blog-admin :location (recipe
                       :fetcher github
                       :repo "codefalling/blog-admin"))

in your layer’s packages, then

(use-package blog-admin
:init
(progn
  ;; your config
  (setq blog-admin-backend-type 'hexo)
  (setq blog-admin-backend-path "~/codefalling.com")
  (setq blog-admin-backend-new-post-in-drafts t)
  (setq blog-admin-backend-new-post-with-same-name-dir t)
  ))

Usage

  • (require 'blog-admin) first
  • M-x blog-admin-start to start this.
  • d to delete current post
  • w to write new post
  • s to switch between draft and categories

Open post after create new post

(add-hook 'blog-admin-backend-after-new-post-hook 'find-file)

hexo

orgmode & markdown

Both orgmode or markdown works well.You can even use them at the same time.But this plugin do nothing about render.If you want to make orgmode work with hexo,you’d better use hexo-renderer-org.

configure

(setq blog-admin-backend-path "~/blog")
(setq blog-admin-backend-type 'hexo)
(setq blog-admin-backend-new-post-in-drafts t) ;; create new post in drafts by default
(setq blog-admin-backend-new-post-with-same-name-dir t) ;; create same-name directory with new post
(setq blog-admin-backend-hexo-config-file "my_config.yml") ;; default assumes _config.yml

org-page

org-page is pure emacs static blog generator.

configure

(setq blog-admin-backend-type 'org-page)
(setq blog-admin-backend-path "~/code/blog")
(setq blog-admin-backend-new-post-in-drafts t)
(setq blog-admin-backend-new-post-with-same-name-dir t)
(setq blog-admin-backend-org-page-drafts "_drafts") ;; directory to save draft
(setq blog-admin-backend-org-page-config-file "/path/to/org-page/config.el") ;; if nil init.el is used

nikola

Nikola is Python based static blog generator that supports org-mode posts with a bunch of other formats.

To be able to use blog-admin on your Nikola site, you will need to install the tags plugin and Nikola >= 7.7.9.

configure

(setq blog-admin-backend-type 'nikola)
(setq blog-admin-backend-path "~/code/blog")
(setq blog-admin-backend-new-post-in-drafts t)
(setq blog-admin-backend-nikola-executable "~/.venvs/nikola/bin/nikola") ;; path to nikola executable
(setq blog-admin-backend-nikola-config-file "my_conf.py") ;; conf.py is default

Thanks

  1. I stole idea that operating posts in table from org-octopress.
  2. The table build on a awesome library: emacs-ctable.
  3. Thanks for s and f who provide a modern API for emacs.

blog-admin's People

Contributors

cy20lin avatar driftcrow avatar mandarvaze avatar mephistommm avatar punchagan avatar syohex avatar xcodebuild avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blog-admin's Issues

multiple blogs

Hello!

I'm using Nikola under virtualenv (using virtual-fish) and have several sites configured under:

nikola/
├── adoc
│   ├── blog
│   ├── cache
│   ├── files
│   ├── galleries
│   ├── images
│   ├── listings
│   ├── output
│   ├── pages
│   ├── plugins
│   ├── __pycache__
│   ├── templates
│   └── themes
├── net
│   ├── blog
│   ├── cache
│   ├── files
│   ├── output
│   ├── plugins
│   ├── __pycache__
│   └── themes
└── org
    ├── blog
    ├── cache
    ├── files
    ├── galleries
    ├── images
    ├── listings
    ├── output
    ├── plugins
    ├── __pycache__
    ├── templates
    └── themes

so wonder if there could be some solution to support multiple sites at once?

More test

Now test is not complete.Fix them

  • org-page
    • new
    • publish/unpublish
    • delete
  • hexo
    • new
    • publsh/unpublish
    • delete

Improve error handling

At least the Nikola backend doesn't do much error handling, and this should be fixed.

Using Nikola

Can you provide any guidance or suggestions with the following error?

blog-admin-backend-nikola-build-site: Invalid function: blog-admin-backend-nikola--with-venv                            
cd ~/blog && ~/nikola/bin/nikola build: exited abnormally with code 3.

support for fish shell

Hello,

I'm using fish as my default shell and e.g. 'build' command fails due to:

(defun build-site ()
  "Build the site."
  (interactive)
  (let ((command (format
                  "cd %s && %s build &"
                  blog-admin-backend-path executable)))
    (-with-venv
(shell-command command))))

since fish shell needs:

cd %s; and build &

Any idea how blog-admin could be extended to cover fish shell?

Support for EGO (similar to org-page)

Hello! I just found blog-admin and I love this tool!

I've been using https://github.com/emacs-china/EGO which is based on org-page. I thought after looking at the code that there are only a few things that need addressed to support EGO.

What are your thoughts? I'd be happy to do this and submit a PR but I'd need some guidance with new post functionality, and the config ignore list is slightly different in EGO.

the variable 'blog-admin-dir' not found

When I load blog-admin emacs tell me that. "Error (use-package): blog-admin :init: Symbol’s value as variable is void: blog-admin-dir"

And then I put -- (defvar blog-admin-dir "") -- in the config.el of that layer. It seems work ordinary.

  • But * when I run the command “blog-admin-start”
    The message put below shown
    "Opening directory: No such file or directory, ./source/_drafts"

here is my config-file https://github.com/JamesChenFromChina/spacemacs.d/blob/master/layers/chenpeng-org/packages.el

and I'm ensure that I heve ran hexo init blog at my home directory

If you have any question please send email to [email protected]

Wrong type argument: stringp, nil

I installed this and it worked once.

This is my configuration:

#+BEGIN_SRC emacs-lisp
  (use-package org-page
    :config
    (setq op/repository-directory "~/src/projects/trevoke.github.io")
    (setq op/personal-github-link "https://github.com/trevoke")
    (setq op/site-domain "http://blog.trevoke.net/")
    (setq op/site-main-title "Seven Steps")
    (setq op/site-sub-title "Words... words, they're all we have to go on! — Rosencrantz and Guildenstern are dead"))

  (use-package blog-admin
    :config
    (setq blog-admin-backend-path "~/src/projects/trevoke.github.io")
    (setq blog-admin-backend-type 'org-page)
    (setq blog-admin-backend-new-post-in-drafts t)
    (setq blog-admin-backend-new-post-with-same-name-dir t)
    (setq blog-admin-backend-org-page-drafts "_drafts")) ;; directory to save draft

#+END_SRC

When I launch emacs and do M-x blog-admin-start, it opens the *Blog* buffer but I just get the error in the subject.

*Messages* shows s-trim-right: Wrong type argument: stringp, nil.

Cannot start blog-admin at all

Environment Info

Emacs version

"GNU Emacs 25.1.1 (x86_64-apple-darwin16.3.0, NS appkit-1504.76 Version 10.12.2 (Build 16C67))
of 2017-01-07"

Spacemacs version

[email protected] (spacemacs)

Configuration

(defun social/init-blog-admin ()
  "Initialize blog-admin"
  (use-package blog-admin
    :defer t
    :init
    ;; Keybinding
    (spacemacs/set-leader-keys "ab" 'blog-admin-start)
    :config
    (progn
      ;; Open post after create new post
      (add-hook 'blog-admin-backend-after-new-post-hook 'find-file)
      ;; Hexo
      (setq blog-admin-backend-path "~/blog")
      (setq blog-admin-backend-type 'hexo)
      ;; create new post in drafts by default
      (setq blog-admin-backend-new-post-in-drafts t)
      ;; create same-name directory with new post
      (setq blog-admin-backend-new-post-with-same-name-dir t)
      ;; default assumes _config.yml
      (setq blog-admin-backend-hexo-config-file "_config.yml"))
    )
  )

Detail

After I updated blog-admin, I cannot find blog-admin-start in M-x.
I tried to delete packages and recompile, but it didn't work.

Compile-log

Leaving directory ‘/Users/apple/.emacs.d/elpa/blog-admin-20170110.2351’

Compiling file /Users/apple/.emacs.d/elpa/blog-admin-20170110.2351/blog-admin-backend-hexo.el at Mon Jan 23 15:30:52 2017
Entering directory ‘/Users/apple/.emacs.d/elpa/blog-admin-20170110.2351/’

Compiling file /Users/apple/.emacs.d/elpa/blog-admin-20170110.2351/blog-admin-backend-nikola.el at Mon Jan 23 15:30:53 2017

Compiling file /Users/apple/.emacs.d/elpa/blog-admin-20170110.2351/blog-admin-backend-org-page.el at Mon Jan 23 15:30:53 2017

Compiling file /Users/apple/.emacs.d/elpa/blog-admin-20170110.2351/blog-admin-backend.el at Mon Jan 23 15:30:53 2017

Compiling file /Users/apple/.emacs.d/elpa/blog-admin-20170110.2351/blog-admin.el at Mon Jan 23 15:30:53 2017

Compiling no file at Mon Jan 23 15:30:53 2017
Warning (bytecomp): the following functions are not known to be defined:
    blog-admin--table-current-file, blog-admin-refresh
Warning (bytecomp): Unused lexical argument ‘file-attributes’
Warning (bytecomp): Unused lexical variable ‘output’
Warning (bytecomp): macro ‘blog-admin-backend-nikola--with-venv’ defined too late
Warning (bytecomp): the following functions are not known to be defined:
    blog-admin--table-current-file, blog-admin-refresh,
    org-next-visible-heading
Warning (bytecomp): reference to free variable ‘op/category-ignore-list’
Warning (bytecomp): assignment to free variable ‘op/category-ignore-list’
Warning (bytecomp): reference to free variable ‘op/category-ignore-list’
Warning (bytecomp): reference to free variable ‘op/site-preview-directory’
Warning (bytecomp): the following functions are not known to be defined:
    blog-admin--table-current-file, blog-admin-refresh, op/do-publication

How to install on Spacemacs?

I'm not quite understand your install instruction of Spacemacs in the project's README.
So could you please give us a more detailed version of install instruction?

nikola backend failed to scan files... w/Nikola v.7.7.8

I'm not quite sure about what is supposed to happen, but I do know that

nikola -Pd fails with Nikola v.7.7.8 since -P is not a valid option flag and so scan-posts needs to be changed in the following fashion (perhaps?) -- have no idea what -P used to do...

(defun -scan-posts ()
"Scan posts of nikola"
(when (-posts-dir-changed)
(message "Scanning posts...")
(let* ((resize-mini-windows nil) ;; Don't show output in mini-buffer
(command (format
"cd %s && %s status -d"
blog-admin-backend-path
blog-admin-backend-nikola-executable))
(output-buffer-name "blog-admin-backend-nikola-output")
(output (shell-command command output-buffer-name output-buffer-name))
draft-paths published-paths)

hook after new post

Some people will want to open file after create new post.Hook is a good idea.

_post directory recursive search

There are too many files in the _post, which are divided into several folders, but this time blog-admin will not find the files. So I hope to increase the function of recursive search.

Build site failed

emacs:25.2.1
spacemacs:0.200.9

My blog-admin-backend-path variable is set to ~ / Dropbox / Blog.Installation configuration blog-admin, in the blog-admin-start operation Build site suggested zsh: 1: command not found: hexo, log show cd ~ / Dropbox / Blog && hexo --config _config.yml generate: exited abnormally With code 127

nikola - posts in the future

Hi there,

I use the schedule for new posts much, but it seems that future postings are not integrated with blog-admin. How do you deal with that?

Martin

请教问题

你好,请教codefalling一个问题:我喜欢用单个大的org文件来管理所有的博文,将一级标题作为每篇文章的标题。这样的情况想使用blog-admin的话,

我能想到的一种方式是做一个自动拆分org文件的函数,另一种方式是修改blog-admin能够支持单个大的org文件读取。后一种是不是更靠谱一些,能否提供一些修改的建议?感谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.