Skip to content

Commit

Permalink
Allow outputting to stdout for consistency with markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
amyreese committed May 28, 2010
1 parent ed6b8d2 commit 8cf94a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions markdown-pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
import MarkdownPP

if len(sys.argv) > 2:
infile = sys.argv[1]
outfile = sys.argv[2]
mdpp = open(sys.argv[1], "r")
md = open(sys.argv[2], "w")

elif len(sys.argv) > 1:
mdpp = open(sys.argv[1], "r")
md = sys.stdout

else:
sys.exit(1)

mdpp = open(infile, "r")
md = open(outfile, "w")

MarkdownPP.MarkdownPP(input=mdpp, output=md, modules=MarkdownPP.modules.keys())

mdpp.close()
md.close()
2 changes: 1 addition & 1 deletion readme.mdpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ to the module, `markdown-pp.py`.
Assuming you have a file named `foo.mdpp`, you can generate the preprocessed
file `foo.md` by running the following command:

$ path/to/markdown-pp.py foo.mdpp foo.md
$ path/to/markdown-pp.py foo.mdpp > foo.md

Because the current CLI script is very simple, it just automatically selects
all available modules for the preprocessor to use. I will eventually get to
Expand Down

0 comments on commit 8cf94a6

Please sign in to comment.