File tree 1 file changed +7
-5
lines changed 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
-
3
2
BLOG_DIR = "."
4
- TARGET_DIR = "/data/workspace/haliblog- octopress/source/_posts "
3
+ TARGET_DIR = "/data/workspace/octopress/"
5
4
6
5
FORMAT = "" "
7
6
---
@@ -48,14 +47,17 @@ def move
48
47
cmd = %{cat "#{ title } .rst"| pandoc -f rst -t markdown}
49
48
text = `#{ cmd } `
50
49
# code
51
- text = text . strip . gsub ( /~~~~/ , "```" ) . gsub ( /~~~~ {.sourceCode .(\w +)}/ , '```\1' )
50
+ text = text . strip
51
+ . gsub ( /~~~~ {\. sourceCode .([^\} ]+)}/ , '```\1' )
52
+ . gsub ( /~~~~/ , "```" )
53
+ . gsub ( "```lisp" , "```" )
52
54
# first line image need a space
53
55
text . sub! ( /\n / , "\n \n " ) if text . start_with? "![image]"
54
56
55
57
header = FORMAT % { title : title , created : created }
56
- File . open ( "#{ TARGET_DIR } /#{ created . split [ 0 ] } -#{ MAPED_TITLE [ title ] } .markdown" , "w+" ) . write ( "#{ header } \n #{ text } " )
58
+ target = title . start_with? ( "_" ) ? "#{ TARGET_DIR } /t" : "#{ TARGET_DIR } /source/_posts"
59
+ File . open ( "#{ target } /#{ created . split [ 0 ] } -#{ MAPED_TITLE [ title ] } .markdown" , "w+" ) . write ( "#{ header } \n #{ text } " )
57
60
end
58
61
end
59
62
60
63
move ( )
61
-
You can’t perform that action at this time.
0 commit comments