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

Read stdin when no file is specified #22

Merged
merged 1 commit into from
Jun 22, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()))