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

Class MarkdownFile

PythonAPI/docs/doc_gen.py:31–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class MarkdownFile:
32 def __init__(self):
33 self._data = ""
34 self._list_depth = 0
35 self.endl = ' \n'
36
37 def data(self):
38 return self._data
39
40 def list_push(self, buf=''):
41 if buf:
42 self.text(join([
43 ' ' * self._list_depth if self._list_depth != 0 else '', '- ', buf]))
44 self._list_depth = (self._list_depth + 1)
45
46 def list_pushn(self, buf):
47 self.list_push(join([buf, self.endl]))
48
49 def list_pop(self):
50 self._list_depth = max(self._list_depth - 1, 0)
51
52 def list_popn(self):
53 self.list_pop()
54 self._data = join([self._data, '\n'])
55
56 def list_depth(self):
57 if self._data.strip()[-1:] != '\n' or self._list_depth == 0:
58 return ''
59 return join([' ' * self._list_depth])
60
61 def separator(self):
62 self._data = join([self._data, '\n---\n'])
63
64 def new_line(self):
65 self._data = join([self._data, self.endl])
66
67 def text(self, buf):
68 self._data = join([self._data, buf])
69
70 def textn(self, buf):
71 self._data = join([self._data, self.list_depth(), buf, self.endl])
72
73 def first_title(self):
74 self._data = join([
75 self._data, '#Python API reference'])
76
77 def title(self, strongness, buf):
78 self._data = join([
79 self._data, '\n', self.list_depth(), '#' * strongness, ' ', buf, '\n'])
80
81 def title_html(self, strongness, buf):
82 self._data = join([
83 self._data, '\n', self.list_depth(), '<h', str(strongness), '>', buf, '</h', str(strongness), '>\n'])
84
85 def inherit_join(self, inh):
86 self._data = join([
87 self._data,'<div style="padding-left:30px;margin-top:-20px"><small><b>Inherited from ',inh,'</b></small></div></p><p>'])
88

Callers 2

gen_overviewMethod · 0.70
gen_bodyMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected