From 1770c0fb1e57e6e003d095b04ee3a5a10fdc6d7f Mon Sep 17 00:00:00 2001 From: jyamihud Date: Thu, 7 Apr 2022 20:22:31 +0300 Subject: [PATCH] Polished Render ( added feature matches ) / Added more data eplanations --- apps/emacs.json | 5 ++++- data/generic/IDE.html | 1 + data/generic/Religion.html | 1 + data/interface/Electron.html | 1 + data/networks/ActivityPub.html | 4 ++++ modules/render.py | 37 +++++++++++++++++++++++++++++----- modules/search.py | 5 +++++ 7 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 data/generic/IDE.html create mode 100644 data/generic/Religion.html create mode 100644 data/interface/Electron.html create mode 100644 data/networks/ActivityPub.html diff --git a/apps/emacs.json b/apps/emacs.json index 9785ff8..2997020 100644 --- a/apps/emacs.json +++ b/apps/emacs.json @@ -21,4 +21,7 @@ "networks_write":[], "formats_read":["ascii","utf-8","utf-16"], "formats_write":["ascii","utf-8","utf-16"], - "generic_name":["Text Editor", "Operating System", "Productivity Tool"]} + "generic_name":["Text Editor", "IDE", "Snake Game", + "Tetris Game", + "Browser", + "Operating System", "Productivity Tool", "Religion"]} diff --git a/data/generic/IDE.html b/data/generic/IDE.html new file mode 100644 index 0000000..08ce342 --- /dev/null +++ b/data/generic/IDE.html @@ -0,0 +1 @@ +Integrated Development Environments are special types of Text Editors specifically designed for editing code. Usually used for programming, but could be used for editing text based file-formats. IDE's functions may include things like: Syntax Highlighting, Auto-Formatting ( Automatically adds tabs and spaces to indent the code ) and other useful features. diff --git a/data/generic/Religion.html b/data/generic/Religion.html new file mode 100644 index 0000000..ccaca5a --- /dev/null +++ b/data/generic/Religion.html @@ -0,0 +1 @@ +Some software grew to form whole Religions around them. diff --git a/data/interface/Electron.html b/data/interface/Electron.html new file mode 100644 index 0000000..5390b30 --- /dev/null +++ b/data/interface/Electron.html @@ -0,0 +1 @@ +Electron is a stripped down Chromium web-browser used as a component in an unfortunate amount of modern software. Since it's a tiny web-browser, it gives the developers the ability to deploy their websites as pieces of software installable locally. Hopefully locally. Since it's a small browser, you can't know for sure what parts are local. Electron apps are something in between web-sites and real software. But they feel like real software to the user. One more problem with Electron is that most of the times developing a native application using a native way of rendering it will result in much, much more optimized experience. Electron apps usually eat a lot of resources. diff --git a/data/networks/ActivityPub.html b/data/networks/ActivityPub.html new file mode 100644 index 0000000..249caec --- /dev/null +++ b/data/networks/ActivityPub.html @@ -0,0 +1,4 @@ +ActivityPub is a social media protocol allowing federation. Which is an idea of linking two different social medias together. Think: liking and commenting on Facebook a post from Twitter. Of course neither Facebook nor Twitter are on the ActivityPub protocol. ActivityPub's social networks include things like: Mastodon, PixelFed and PeerTube. +
+
+More about ActivityPub you can find on WIKIPEDIA. diff --git a/modules/render.py b/modules/render.py index bcb450e..da5a7d9 100644 --- a/modules/render.py +++ b/modules/render.py @@ -107,13 +107,40 @@ def html(page, json): l = json.get(c, []) if not l: continue - + + # I want to look whether this category has a list of files + alldata = list(os.listdir("data")) + allfiles = [] + for folder in alldata: + if c.startswith(folder): + try: + allfiles = list(os.listdir("data/"+folder)) + break + except: + pass + # Count matches + matches = 0 + for i in l: + if i.startswith("*"): + matches += 1 + if matches: + matchtext = "( "+str(matches)+" )" + else: + matchtext = "" page = page + "
" - page = page +""+categories[c]+":" + page = page +""+categories[c]+": "+matchtext+"" for i in l: - page = page + "  "+i+"
" - page = page + "
" + matchtext = "" + if i.startswith("*"): + i = i[1:] + matchtext = "    ( match ) " + if i+".html" in allfiles: + datapage = open("data/"+folder+"/"+i+".html") + page = page + "
    "+matchtext+i+"

"+datapage.read()+"

" + else: + page = page + "    "+matchtext+i+"
" + page = page + "
" return page @@ -141,7 +168,7 @@ def suggestions(page, json): except: frac = 0 - if frac < 40 and not more: # Below 40% features match + if frac < 20 and not more: # Below 40% features match page = page + """

Problematic Competitors:

""" more = True diff --git a/modules/search.py b/modules/search.py index c94fa97..3beec51 100644 --- a/modules/search.py +++ b/modules/search.py @@ -88,6 +88,11 @@ def suggest(json_data): for b in json_data.get(c, []): if b in i.get(c, []): score += 1 + # Pass the found datapoint into the renderer + try: + i[c][i[c].index(b)] = "*"+b + except Exception as e: + print(e) # If software has issues of any kind we move it down. if "issues" in i and score: