def get_short_readme(self, data): version = filter(lambda t: t.tag == 'latest', data.tags)[0] readme_short_markdown = text_to_markdown(version.readme or '') readme_short = ''.join(BeautifulSoup(readme_short_markdown).findAll(text=True)) \ .split('\n\n')[0].replace(' \n', '') \ .replace('\n', ' ').replace('/^ /', '') return readme_short
def test_blockquotes_working(self): self.assertEqual( text_to_markdown("> this is a blockquote"), '<blockquote>\n<p>this is a blockquote</p>\n</blockquote>')
def test_allowed_attr_working(self): self.assertEqual( text_to_markdown("<a href='https://example.com'>test</a>"), '<p><a href="https://example.com">test</a></p>')
def test_disallowed_tags(self): self.assertEqual(text_to_markdown("<script>test</script>"), "<script>test</script>")
def test_allowed_tags_working(self): self.assertEqual(text_to_markdown("<h1>test</h1>"), "<h1>test</h1>")
def get_short_readme(self, data): readme_short_markdown = text_to_markdown(data.readme or '') readme_short = ''.join(BeautifulSoup(readme_short_markdown).findAll(text=True)) \ .split('\n\n')[0].replace(' \n', '') \ .replace('\n', ' ').replace('/^ /', '') return readme_short
def get_readme(self, data): readme_variables_replaced = dp_in_readme(data.readme or '', data.descriptor) readme = text_to_markdown(readme_variables_replaced) return readme
def get_readme(self, data): version = filter(lambda t: t.tag == 'latest', data.tags)[0] readme_variables_replaced = dp_in_readme(version.readme or '', version.descriptor) readme = text_to_markdown(readme_variables_replaced) return readme