Skip to content

Commit 157e31d

Browse files
authored
Fixing Bug
1 parent 48e76bd commit 157e31d

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

.github/scripts/convert_to_html_tables.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,6 @@ def update_table_of_content(self, condition):
215215
sub_value.sort()
216216
table_of_content[key] = OrderedDict(sorted(value.items()))
217217

218-
# Table of content header
219-
table_of_content_header = ['<ul>\n']
220-
table_of_content_footer = ['</ul>\n']
221-
222218
# Updating lines based on the extracted data
223219
for core, data in table_of_content.items():
224220

@@ -228,44 +224,40 @@ def update_table_of_content(self, condition):
228224

229225
# Setting Main Heading (Only for Root)
230226
if condition is None:
231-
updated_lines.append(f'\t<li><a href="{core}" href="goto {core}"><b>{core}</b></a></li>\n')
227+
updated_lines.append(f'- [__{core}__]({core} "goto {core}")\n')
232228

233229
# Adding all headings
234230
for heading, sub_heading_list in data.items():
235231
if condition is None:
236-
updated_lines.append(f'\t\t<ul>\n')
237-
updated_lines.append(f'\t\t\t<li><a href="{core}/{heading}" title="goto {heading}">{heading}</a></li>\n')
232+
updated_lines.append(f'\t- [{heading}]({core}/{heading} "goto {heading}")\n')
238233
else:
239-
updated_lines.append(f'\t<li><a href="{heading}" title="goto {heading}">{heading}</a></li>\n')
234+
updated_lines.append(f'- [__{heading}__]({heading} "goto {heading}")\n')
240235
if sub_heading_list is not None:
241236
for sub_heading in sub_heading_list:
242237
if condition is None:
243-
updated_lines.append(f'\t\t\t<ul>\n')
244-
updated_lines.append(f'\t\t\t\t<li><a href="{core}/{heading}/{sub_heading}" title="goto {sub_heading}">{sub_heading}</a></li>\n')
245-
updated_lines.append(f'\t\t\t</ul>\n')
238+
updated_lines.append(f'\t\t- [{sub_heading}]({core}/{heading}/{sub_heading} "goto {sub_heading}")\n')
246239
else:
247-
updated_lines.append(f'\t<ul>\n')
248-
updated_lines.append(f'\t\t<li><a href="{heading}/{sub_heading}" title="goto {sub_heading}">{sub_heading}</a></li>\n')
249-
updated_lines.append(f'\t</ul>\n')
250-
if condition is None:
251-
updated_lines.append(f'\t\t</ul>\n')
240+
updated_lines.append(f'\t- [{sub_heading}]({heading}/{sub_heading} "goto {sub_heading}")\n')
252241

253242
# Updating the lines with updated data
254-
self.lines[table_of_content_start+1:table_of_content_end] = table_of_content_header + updated_lines + table_of_content_footer
243+
self.lines[table_of_content_start+1:table_of_content_end] = updated_lines
255244

256245
# Printing Success Message
257246
print('Successfully updated the table of content !!!...')
258247

259248

249+
260250
def main():
261251

262252
# Retrieving Environmental variables
263253
REPO_NAME = os.environ.get('REPO_NAME')
264254

265255
# Setting path for the log JSON file
266256
ROOT_INDEX_FILE_PATH = 'index.md'
267-
THEORY_INDEX_FILE_PATH = 'Theory/README.md'
268-
SOLVED_PROBLEM_INDEX_FILE_PATH = 'Solved-Problems/README.md'
257+
THEORY_INDEX_FILE_PATH = 'Theory/index.md'
258+
THEORY_README_FILE_PATH = 'Theory/README.md'
259+
SOLVED_PROBLEM_INDEX_FILE_PATH = 'Solved-Problems/index.md'
260+
SOLVED_PROBLEM_README_FILE_PATH = 'Solved-Problems/README.md'
269261
CONTRIBUTORS_LOG = '.github/data/contributors-log.json'
270262

271263
# Retrieving data from log file
@@ -279,7 +271,10 @@ def main():
279271
# Updating All required files
280272
UpdateFileContent(ROOT_INDEX_FILE_PATH)
281273
UpdateFileContent(THEORY_INDEX_FILE_PATH, lambda core: core == 'Theory')
274+
UpdateFileContent(THEORY_README_FILE_PATH, lambda core: core == 'Theory')
282275
UpdateFileContent(SOLVED_PROBLEM_INDEX_FILE_PATH, lambda core: core == 'Solved-Problems')
276+
UpdateFileContent(SOLVED_PROBLEM_README_FILE_PATH, lambda core: core == 'Solved-Problems')
277+
283278

284279
if __name__ == '__main__':
285280
main()

0 commit comments

Comments
 (0)