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

scripts功能 #37

Closed
pharaohnie opened this issue Jan 7, 2013 · 6 comments
Closed

scripts功能 #37

pharaohnie opened this issue Jan 7, 2013 · 6 comments
Labels
question Needs help in usage

Comments

@pharaohnie
Copy link

按照文档添加了自动打开newpost的功能,但是报错。

hexo new_post 'test'
Post created at /Users/pharaohnie/hexo/source/_posts/2013-01-07-test.md

/Users/pharaohnie/hexo/scripts/autoopen:4
    spawn('open', [target]);
                   ^
ReferenceError: target is not defined
    at EventEmitter.<anonymous> (/Users/pharaohnie/hexo/scripts/autoopen:4:20)
    at EventEmitter.emit (events.js:96:17)
    at /usr/local/share/npm/lib/node_modules/hexo/lib/cli/new.js:46:14
    at fs.close (/usr/local/share/npm/lib/node_modules/hexo/node_modules/graceful-fs/graceful-fs.js:90:5)
    at Object.oncomplete (fs.js:297:15)
@tommy351
Copy link
Member

tommy351 commented Jan 7, 2013

函數內有引入target變數嗎?

var spawn = require('child_process').spawn;

hexo.on('newPost', function(target){
  spawn('open', [target]);
});

@pharaohnie
Copy link
Author

这个就不太懂了,因为不是搞开发的。我的系统是mac os 10.8.2,想直接调用Mou编辑blog的话,这个script应该怎么写?在 2013-1-7,上午10:47,SkyArrow notifications@github.com 写道:函數內有引入target變數嗎?

var spawn = require('child_process').spawn;

hexo.on('newPost', function(target){
spawn('open', [target]);
});

          —
          Reply to this email directly or view it on GitHub.

@tommy351
Copy link
Member

tommy351 commented Jan 7, 2013

像那樣寫應該就會自動開啟對應的Markdown編輯器了

@pharaohnie
Copy link
Author

但是确实报错了hexo$ cat scripts/autoopen var spawn = require('child_process').spawn;hexo.on('newPost', function(){    spawn('open', [target]);});报错信息:hexo$ hexo new_post 'test'Post created at /Users/pharaohnie/hexo/source/_posts/2013-01-07-test.md/Users/pharaohnie/hexo/scripts/autoopen:4    spawn('open', [target]);                   ^ReferenceError: target is not defined    at EventEmitter.<anonymous> (/Users/pharaohnie/hexo/scripts/autoopen:4:20)    at EventEmitter.emit (events.js:96:17)    at /usr/local/share/npm/lib/node_modules/hexo/lib/cli/new.js:46:14    at fs.close (/usr/local/share/npm/lib/node_modules/hexo/node_modules/graceful-fs/graceful-fs.js:90:5)    at Object.oncomplete (fs.js:297:15)在 2013-1-7,上午10:53,SkyArrow notifications@github.com 写道:像那樣寫應該就會自動開啟對應的Markdown編輯器了

Reply to this email directly or view it on GitHub.

@tommy351
Copy link
Member

tommy351 commented Jan 7, 2013

hexo.on('newPost', function(){

改為

hexo.on('newPost', function(target){

@pharaohnie
Copy link
Author

这回ok了,感谢!在 2013-1-7,上午11:02,SkyArrow notifications@github.com 写道:hexo.on('newPost', function(){
改為

hexo.on('newPost', function(target){

          —
          Reply to this email directly or view it on GitHub.

@tommy351 tommy351 closed this as completed Jan 7, 2013
JLHwung pushed a commit to JLHwung/hexo that referenced this issue Jun 10, 2016
…_bar

Add pagination bar in archives page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Needs help in usage
Projects
None yet
Development

No branches or pull requests

2 participants