Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #22 from tkf/read-stdin
Browse files Browse the repository at this point in the history
Read stdin when no file is specified.
  • Loading branch information
FSX committed Jun 22, 2012
2 parents d056e1b + abf2e9a commit f5e2940
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions scripts/misaka
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ if __name__ == '__main__':
renderer = HtmlRenderer(flags)
to_html = Markdown(renderer, extensions).render

for fn in files:
fn = path.abspath(fn)
if not path.exists(fn):
print('Does not exist: %s' % fn)
else:
with open(fn, 'r') as fd:
source = fd.read()
print(to_html(source))
if files:
for fn in files:
fn = path.abspath(fn)
if not path.exists(fn):
print('Does not exist: %s' % fn)
else:
with open(fn, 'r') as fd:
source = fd.read()
print(to_html(source))
else:
print(to_html(sys.stdin.read()))

0 comments on commit f5e2940

Please sign in to comment.