예제 #1
0
 def test_break_url(self):
     """ Format URLs spanning across a line break
     """
     cross_inl = self.inl.replace('http:', 'http:\n')
     cross_ref = self.ref.replace('http:', 'http:')
     f = ForMd(cross_inl)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(cross_ref, ref_conv)
예제 #2
0
파일: tests.py 프로젝트: TingoL/dotfiles
 def test_break_url(self):
     """ Format URLs spanning across a line break
     """
     cross_inl = self.inl.replace('http:', 'http:\n')
     cross_ref = self.ref.replace('http:', 'http:')
     f = ForMd(cross_inl)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(cross_ref, ref_conv)
예제 #3
0
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()]
예제 #4
0
파일: tests.py 프로젝트: TingoL/dotfiles
 def test_space_ref(self):
     """ Format links embedded in markdown lists
     """
     f = ForMd(self.space_ref)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(self.ref, ref_conv)
예제 #5
0
파일: tests.py 프로젝트: TingoL/dotfiles
 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)
예제 #6
0
파일: tests.py 프로젝트: TingoL/dotfiles
 def test_flip(self):
     f = ForMd(self.ref)
     inline_conv = list(f.inline_md())[0]
     self.assertEqual(self.inl, inline_conv)
예제 #7
0
파일: tests.py 프로젝트: TingoL/dotfiles
 def test_ref(self):
     f = ForMd(self.inl)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(self.ref, ref_conv)
예제 #8
0
파일: tests.py 프로젝트: TingoL/dotfiles
 def test_none(self):
     f = ForMd(self.no_md)
     flip_conv = f.flip()
     f = ForMd(flip_conv)
     flip_conv = f.flip()
     self.assertEqual(self.no_md, flip_conv)
예제 #9
0
 def test_space_ref(self):
     """ Format links embedded in markdown lists
     """
     f = ForMd(self.space_ref)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(self.ref, ref_conv)
예제 #10
0
 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)
예제 #11
0
 def test_flip(self):
     f = ForMd(self.ref)
     inline_conv = list(f.inline_md())[0]
     self.assertEqual(self.inl, inline_conv)
예제 #12
0
 def test_ref(self):
     f = ForMd(self.inl)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(self.ref, ref_conv)
예제 #13
0
 def test_none(self):
     f = ForMd(self.no_md)
     flip_conv = f.flip()
     f = ForMd(flip_conv)
     flip_conv = f.flip()
     self.assertEqual(self.no_md, flip_conv)