-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurrent_fixture.py
42 lines (30 loc) · 1.03 KB
/
current_fixture.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""rst2gfm - restructured text to github flavored markdown"""
from docutils.core import publish_parts
from docutils.writers import Writer
class MarkdownTranslator:
"""Translates reStructuredText nodes to GitHub Flavored Markdown."""
# pylint: disable=unused-argument
# pylint: disable=missing-docstring disable=invalid-name
def __init__(self, document):
self.output = []
self.list_depth = 0
self.section_level = 0
class MarkdownWriter(Writer):
"""Writer for converting reStructuredText to GitHub Flavored Markdown."""
def __init__(self):
super().__init__()
self.translator_class = MarkdownTranslator
def translate(self):
visitor = self.translator_class(self.document)
return visitor
def convert_rst_to_md(rst_content: str):
"""Convert reStructuredText to GitHub Flavored Markdown."""
parts = publish_parts(
source=rst_content,
)
return parts
def main():
"""does main things"""
print(42)
if __name__ == "__main__":
main()