Permalink
Browse files

check for existence of md source when makig html; properly handle fil…

…ename command line option
  • Loading branch information...
1 parent 716099f commit 5f6b9dc91117e6e44f1f4fb1853e9d32ca29f132 @bkidwell committed Dec 4, 2011
Showing with 12 additions and 1 deletion.
  1. +3 −0 mdepub/__init__.py
  2. +8 −1 mdepub/actions/html.py
  3. +1 −0 mdepub/filename.py
View
3 mdepub/__init__.py
@@ -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.")
View
9 mdepub/actions/html.py
@@ -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')
@@ -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)
View
1 mdepub/filename.py
@@ -1,6 +1,7 @@
import unicodedata
import string
import mdepub
+import os.path
validFilenameChars = "'-_.() {}{}".format(string.ascii_letters, string.digits)

0 comments on commit 5f6b9dc

Please sign in to comment.