Trying to use an editor (emacs) via subprocess-module to edit new draft.

This commit is contained in:
Homer 2015-02-07 00:56:44 +01:00 committed by Homer S
parent ec60f10c40
commit 3b161c257c
1 changed files with 42 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3
import os,re
import os,re,subprocess
from string import Template
from argparse import ArgumentParser
@ -105,7 +105,7 @@ except:
tplDir = os.path.join(blog_dir,"templates")
def update_blog():
def update_blog(subsection):
tplIndex = os.path.join(tplDir,"index.htm")
blogIndex = os.path.join(blog_dir,"index.html")
@ -137,41 +137,77 @@ def update_blog():
print(tmpIndex, file=f)
# blog functions
if vars(args)['target'] == 'blog':
## update subsections or whole blog
if vars(args)['action'] == 'update':
print("Updating your block.")
update_blog()
update_blog(vars(args)['subsection'])
## add a new blog at -d blog-directory
if vars(args)['action'] == 'add':
pass
# draft functions
if vars(args)['target'] == 'draft':
## add new draft
if vars(args)['action'] == 'add':
pass
subprocess.call(["emacs",os.path.join(blog_dir,"templates/article.txt")])
## list drafts
if vars(args)['action'] == 'list':
pass
## edit draft
if vars(args)['action'] == 'edit':
pass
## remove draft
if vars(args)['action'] == 'remove':
pass
# article functions
if vars(args)['target'] == 'article':
## add new article
if vars(args)['action'] == 'add':
pass
## list articles
if vars(args)['action'] == 'list':
pass
## edit article
if vars(args)['action'] == 'edit':
pass
if vars(args)['action'] == 'remove':
## remove article
if vars(args)['action'] == 'remove':
pass