-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
574 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!-- Last updated: 2024-06-06 --> | ||
|
||
<!-- Profile Picture --> | ||
- profile-picture: https://avatars.githubusercontent.com/u/42101257?v=4 | ||
|
||
<!-- Name --> | ||
# rooyca | ||
|
||
<!-- Short Bio --> | ||
| Pronouns: he/him | ||
| Occupation: Studend | ||
| Location: Colombia | ||
|
||
--- Bio --- | ||
<!-- MAX 300 characters --> | ||
|
||
Crazy? I Was Crazy Once. They Locked Me In A Room. A Rubber Room. A Rubber Room With Rats. And Rats Make Me Crazy. | ||
|
||
--- Profile Items --- | ||
<!-- Available profile items: Twitter, Facebook, Instagram, Unsplash, Dribbble, YouTube, Dev.to, Linkedin, Github, Buy Me a Coffee --> | ||
|
||
- [Twitter](https://twitter.com/rooycaa) | ||
- [Dev.to](https://dev.to/rooyca) | ||
- [Linkedin](https://linkedin.com/rooyca) | ||
- [Github](https://github.com/rooyca) | ||
- [Buy Me a Coffee](https://buymeacoffee.com/rooyca) | ||
|
||
|
||
<!-- Don't change anything after this line --> | ||
--- END --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
def parse_markdown(data: str): | ||
""" | ||
Parse markdown data and return a dictionary | ||
""" | ||
data = data.split("\n") | ||
user_data_final = {} | ||
for line in data: | ||
if line.startswith("<!--"): | ||
continue | ||
if line.startswith("#"): | ||
key = line.replace("#", "").strip().lower() | ||
user_data_final["username"] = key | ||
if line.startswith("- profile-picture:"): | ||
user_data_final["profile_picture"] = line.replace("- profile-picture:", "").strip() | ||
if line.startswith("|"): | ||
key, value = line.replace("|", "").split(":") | ||
user_data_final[key.strip()] = value.strip() | ||
if line == "--- Bio ---": | ||
user_data_final["bio"] = "" | ||
for line in data[data.index("--- Bio ---") + 1:]: | ||
if line.startswith("<!--"): | ||
continue | ||
if line.startswith("--- "): | ||
break | ||
user_data_final["bio"] += line | ||
# check if bio is larger than 300 characters | ||
if len(user_data_final["bio"]) > 300: | ||
user_data_final["bio"] = user_data_final["bio"][:300] + "..." | ||
break | ||
if line == "--- Profile Items ---": | ||
user_data_final["profile_items"] = [] | ||
for line in data[data.index("--- Profile Items ---") + 1:]: | ||
if line.startswith("--- "): | ||
break | ||
if line == "": | ||
continue | ||
if line.startswith("<!--"): | ||
continue | ||
line_parsed = line.split("](") | ||
desc = line_parsed[0].replace("- [", "").replace("* [", "").strip() | ||
url = line_parsed[1].replace(")", "").strip() | ||
user_data_final["profile_items"].append({"desc": desc, "url": url}) | ||
if line == data[-1]: | ||
break | ||
|
||
return user_data_final |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.