Skip to content

Commit

Permalink
json updater added
Browse files Browse the repository at this point in the history
  • Loading branch information
mursalatul committed Jan 23, 2024
1 parent 9707cad commit 6935273
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
12 changes: 6 additions & 6 deletions ADMIN/MAINTAIN/DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ This documentation provides a front view of the content presented in the reposit

## Content
- [hello_diu](/hello_diu)
- [hello_diu.c](/hello_diu.c)
- [hello_diu.c](hello_diu/hello_diu.c)
- [palindrom](/palindrom)
- [is_palindrom_number.c](/is_palindrom_number.c)
- [is_palindrom_number.c](palindrom/is_palindrom_number.c)
- [prime](/prime)
- [is_prime.cpp](/is_prime.cpp)
- [is_prime.cpp](prime/is_prime.cpp)
- [search](/search)
- [binary_search.cpp](/binary_search.cpp)
- [linear_search.cpp](/linear_search.cpp)
- [binary_search.cpp](search/binary_search.cpp)
- [linear_search.cpp](search/linear_search.cpp)
- [selection_sort](/selection_sort)
- [selection_sort_cpp.cpp](/selection_sort_cpp.cpp)
- [selection_sort_cpp.cpp](selection_sort/selection_sort_cpp.cpp)
4 changes: 4 additions & 0 deletions ADMIN/MAINTAIN/UPDATE_DOC.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ def main():
doc = CreateDocumentation()
doc.writedoc(data) # documentation will be written in the repo home

# updating the json file
mjson = HandleJson()
mjson.write_json(data)

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion ADMIN/MAINTAIN/classes/Documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def writedoc(self, folder_file: dict):
#file.sort()
# adding the file names
for files in file:
doc.write(f" - [{files}](/{files})\n")
doc.write(f" - [{files}]({folder}/{files})\n")
29 changes: 27 additions & 2 deletions ADMIN/MAINTAIN/classes/handle_json.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
import json, os

class HandleJson:
def write_json(self, json_file, data):
pass
# reformat data as actual json format
def add_link(self):
self.dic = {
"folder_number" : f"{len(self.data)}",
# "folder1" : {
# "folder1_url" : "",
# "file_number" : "",
# "file1" : "file1 url",
# "file2" : "file2 url"
# },
}

for folder, file in self.data.items():
inner_dic = dict()
inner_dic["folder_url"] = "https://github.com/mursalatul/code-park/tree/master/" + folder
inner_dic["file_number"] = f"{len(file)}"
file.sort()
for f in file:
inner_dic[f] = inner_dic["folder_url"] + f"/{f}"
self.dic[folder] = inner_dic


def write_json(self, data):
self.data = data
self.add_link()
with open("DOC_DATA.json", "w") as outfile:
json.dump(self.dic, outfile)

0 comments on commit 6935273

Please sign in to comment.