Skip to content

Commit

Permalink
check for existence of md source when makig html; properly handle fil…
Browse files Browse the repository at this point in the history
…ename command line option
  • Loading branch information
bkidwell committed Dec 4, 2011
1 parent 716099f commit 5f6b9dc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mdepub/__init__.py
Expand Up @@ -38,6 +38,9 @@ def new_id():

arguments = ArgumentParser().parse_args()

if arguments.filename:
options['filename'] = arguments.filename

def require_opts_file():
if options_loaded: return
log.fatal("No options.yaml file found for this project.")
Expand Down
9 changes: 8 additions & 1 deletion mdepub/actions/html.py
Expand Up @@ -2,10 +2,12 @@
import mdepub
from mdepub import shell
import os
import os.path
from mdepub import options
from mdepub import project_path
from BeautifulSoup import BeautifulSoup
from mdepub.filename import getFN
import sys

log = logging.getLogger('html')

Expand All @@ -31,11 +33,16 @@ def run():

args = ["pandoc", "--standalone", "--email-obfuscation=none"]

src = getFN("md")
if not os.path.exists(src):
log.fatal("\"%s\" not found.", src)
sys.exit(1)

if os.path.exists(css_file):
args.extend(["-c", css_file])
if options['smart quotes']:
args.append("--smart")
args.append(getFN("md"))
args.append(src)

html = shell.pipe(args, None)

Expand Down
1 change: 1 addition & 0 deletions mdepub/filename.py
@@ -1,6 +1,7 @@
import unicodedata
import string
import mdepub
import os.path

validFilenameChars = "'-_.() {}{}".format(string.ascii_letters, string.digits)

Expand Down

0 comments on commit 5f6b9dc

Please sign in to comment.