markdown-link-style

switch between inline and footnote link style in markdown documents.
git clone git://git.ricketyspace.net/markdown-link-style.git
Log | Files | Refs

commit 626ff419f36a8fe7e310346296e61486357b3055
parent 45a601c1c9f922c55b36fb6541764659406cd11b
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun,  4 Jun 2017 23:21:31 +0000

mdl_style.py: Add _write_to.

* mdl_style.py (_write_to): New function.

Diffstat:
mdl_style.py | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/mdl_style.py b/mdl_style.py @@ -235,6 +235,18 @@ class LinkStyler(object): return md(text) +def _write_to(file_, content): + """Write `content` to `file_`. + + `file_` is expected to be a sub-class of `io.TextIOBase`. + """ + file_.truncate(0) + file_.seek(0) + file_.write(content) + file_.flush() + file_.close() + + def _mdl_stylize(args): ls = LinkStyler(args.link_style) print(ls(args.file), end='')