|
@@ -47,8 +47,9 @@ import markdown2
|
|
import argparse
|
|
import argparse
|
|
import sys
|
|
import sys
|
|
from distutils import dir_util
|
|
from distutils import dir_util
|
|
-
|
|
|
|
|
|
+import shutil
|
|
import pdb
|
|
import pdb
|
|
|
|
+
|
|
CONFIG = {
|
|
CONFIG = {
|
|
'content_root': 'content', # where the markdown files are
|
|
'content_root': 'content', # where the markdown files are
|
|
'output_to': 'oz123.github.com',
|
|
'output_to': 'oz123.github.com',
|
|
@@ -428,14 +429,21 @@ def preview(PREVIEW_ADDR = '127.0.1.1',PREVIEW_PORT = 11000):
|
|
def publish(GITDIRECTORY="oz123.github.com"):
|
|
def publish(GITDIRECTORY="oz123.github.com"):
|
|
pass
|
|
pass
|
|
|
|
|
|
-
|
|
|
|
|
|
+def clean(GITDIRECTORY="oz123.github.com"):
|
|
|
|
+ directoriestoclean=["writings", "notes", "links", "tags", "archive"]
|
|
|
|
+ os.chdir(GITDIRECTORY)
|
|
|
|
+ for directory in directoriestoclean:
|
|
|
|
+ shutil.rmtree(directory)
|
|
|
|
+
|
|
|
|
+
|
|
if __name__== '__main__':
|
|
if __name__== '__main__':
|
|
parser = argparse.ArgumentParser(description='blogit - a tool blog on github.')
|
|
parser = argparse.ArgumentParser(description='blogit - a tool blog on github.')
|
|
parser.add_argument('-b','--build', action="store_true",
|
|
parser.add_argument('-b','--build', action="store_true",
|
|
help='convert the markdown files to HTML')
|
|
help='convert the markdown files to HTML')
|
|
parser.add_argument('-p','--preview', action="store_true",
|
|
parser.add_argument('-p','--preview', action="store_true",
|
|
help='Launch HTTP server to preview the website')
|
|
help='Launch HTTP server to preview the website')
|
|
-
|
|
|
|
|
|
+ parser.add_argument('-c','--clean', action="store_true",
|
|
|
|
+ help='cleanoutputfiles')
|
|
|
|
|
|
args = parser.parse_args()
|
|
args = parser.parse_args()
|
|
|
|
|
|
@@ -443,6 +451,8 @@ if __name__== '__main__':
|
|
parser.print_help()
|
|
parser.print_help()
|
|
sys.exit()
|
|
sys.exit()
|
|
#import pdb; pdb.set_trace()
|
|
#import pdb; pdb.set_trace()
|
|
|
|
+ if args.clean:
|
|
|
|
+ clean()
|
|
if args.build:
|
|
if args.build:
|
|
#pdb.set_trace()
|
|
#pdb.set_trace()
|
|
build()
|
|
build()
|