Ejemplo n.º 1
0
 def test_phrase_in_md_as_reference(self):
     md = content_to_md([{
         "type": "phrase",
         "destination": "jnAnI",
         "content": "people who know"
     }], "normal").strip()
     self.assertEqual(md, '[people who know](jnAnI)')
Ejemplo n.º 2
0
 def test_applnote_in_md_as_backquote_anchor(self):
     md = content_to_md([{
         "type": "text",
         "content": "note to apply"
     }], "applnotes").strip()
     self.assertTrue(md.startswith("<a name='applnote"))
     self.assertIn('\n>', md)
Ejemplo n.º 3
0
 def test_extref_in_md_translitted(self):
     md = content_to_md([{
         "type": "extref",
         "content": "[buddhiyOga]"
     }], "normal").strip()
     self.assertIn('`[buddhiyoga]`', md)
     self.assertIn('`बुद्धियोग`', md)
Ejemplo n.º 4
0
 def test_translit_is_in_harwardkyoto(self):
     md = content_to_md(
         [{
             "type": "text",
             "content": "[kr`payAviShTam] who was overcome with pity"
         }], "explnofshloka").strip()
     self.assertEqual(
         md, '`कृपयाविष्टम्` `[kRpayAviSTam]` who was overcome with pity')
Ejemplo n.º 5
0
 def test_anchor_is_placed_in_md(self):
     md = content_to_md([{
         "type": "anchor",
         "name": "_50",
         "content": "abc"
     }], "normal").strip()
     self.assertTrue(md.startswith("<a name='_50'"))
     self.assertTrue(md.endswith("</a>"))
     self.assertIn('abc', md)
Ejemplo n.º 6
0
 def test_unknown_type_not_in_md(self):
     md = content_to_md([{
         "type": "not-text",
         "content": "donotinclude"
     }, {
         "type": "text",
         "content": "Chapter 2"
     }], "heading1")
     self.assertNotIn('donotinclude', md)
     self.assertIn('Chapter 2', md)
Ejemplo n.º 7
0
 def test_explnofshloka_puts_translations(self):
     md = content_to_md([{
         "type": "text",
         "content": "[aham] I [asmi] am"
     }], "explnofshloka").strip()
     self.assertEqual(md, '`अहम्` `[aham]` I `अस्मि` `[asmi]` am')
Ejemplo n.º 8
0
 def test_doesnt_crash_on_unknown_style(self):
     content_to_md([{"type": "text", "content": "any"}], 'unknown-style')
Ejemplo n.º 9
0
 def test_normal_is_unchanged(self):
     md = content_to_md([{
         "type": "text",
         "content": "Just some text"
     }], "normal").strip()
     self.assertEqual(md, "Just some text")
Ejemplo n.º 10
0
 def test_heading2_is_second_level(self):
     md = content_to_md([{
         "type": "text",
         "content": "2-1 to 2-3"
     }], "heading2").strip()
     self.assertEqual(md, '## 2-1 to 2-3')
Ejemplo n.º 11
0
 def test_heading1_is_first_level(self):
     md = content_to_md([{
         "type": "text",
         "content": "Chapter 2"
     }], "heading1").strip()
     self.assertEqual(md, "# Chapter 2")
Ejemplo n.º 12
0
 def test_devanagari_goes_in_md(self):
     md = content_to_md([{
         "type": "text",
         "content": "nArAyaNAya"
     }], "shloka").strip()
     self.assertIn("नारायणाय", md)