def main(): description = 'formd: A (for)matting (M)ark(d)own tool.' p = argparse.ArgumentParser(description=description) p.add_argument('-r', '--ref', help="convert text to referenced Markdown", action='store_true', default=False) p.add_argument('-i', '--inline', help="convert text to inline Markdown", action='store_true', default=False) p.add_argument('-f', '--flip', help="convert to opposite style Markdown", action='store_true', default=True) args = p.parse_args() md = stdin.read() text = ForMd(md) if (args.inline): [stdout.write(t) for t in text.inline_md()] elif (args.ref): [stdout.write(t) for t in text.ref_md()] elif (args.flip): [stdout.write(t) for t in text.flip()]
def test_flip_lst_link(self): """ Format links embedded in markdown lists """ f = ForMd(self.lref) inline_conv = list(f.inline_md())[0] self.assertEqual(self.linl, inline_conv)
def test_flip(self): f = ForMd(self.ref) inline_conv = list(f.inline_md())[0] self.assertEqual(self.inl, inline_conv)