Beispiel #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)
Beispiel #2
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)
Beispiel #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()]
Beispiel #4
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)
Beispiel #5
0
 def test_ref(self):
     f = ForMd(self.inl)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(self.ref, ref_conv)
Beispiel #6
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)
Beispiel #7
0
 def test_ref(self):
     f = ForMd(self.inl)
     ref_conv = list(f.ref_md())[0]
     self.assertEqual(self.ref, ref_conv)