MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / MarkdownFile

Class MarkdownFile

PythonAPI/docs/bp_doc_gen.py:66–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65
66class MarkdownFile:
67 def __init__(self):
68 self._data = ""
69 self._list_depth = 0
70 self.endl = ' \n'
71
72 def data(self):
73 return self._data
74
75 def list_push(self, buf=''):
76 if buf:
77 self.text(join([
78 ' ' * self._list_depth if self._list_depth != 0 else '', '- ', buf]))
79 self._list_depth = (self._list_depth + 1)
80
81 def list_pushn(self, buf):
82 self.list_push(join([buf, self.endl]))
83
84 def list_pop(self):
85 self._list_depth = max(self._list_depth - 1, 0)
86
87 def list_popn(self):
88 self.list_pop()
89 self._data = join([self._data, '\n'])
90
91 def list_depth(self):
92 if self._data.strip()[-1:] != '\n' or self._list_depth == 0:
93 return ''
94 return join([' ' * self._list_depth])
95
96 def text(self, buf):
97 self._data = join([self._data, buf])
98
99 def textn(self, buf):
100 self._data = join([self._data, self.list_depth(), buf, self.endl])
101
102 def not_title(self, buf):
103 self._data = join([
104 self._data, '\n', self.list_depth(), '#', buf, '\n'])
105
106 def title(self, strongness, buf):
107 self._data = join([
108 self._data, '\n', self.list_depth(), '#' * strongness, ' ', buf, '\n'])
109
110 def new_line(self):
111 self._data = join([self._data, self.endl])
112
113 def code_block(self, buf, language=''):
114 return join(['```', language, '\n', self.list_depth(), buf, '\n', self.list_depth(), '```\n'])
115
116
117def generate_pb_docs():

Callers 1

generate_pb_docsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected