From 7858d75f284c8035e2123535e8b7cbc547036266 Mon Sep 17 00:00:00 2001 From: rooyca Date: Thu, 6 Jun 2024 03:17:40 -0500 Subject: [PATCH] update(feat): profile page with md --- README.md | 4 + app/data/rooyca.md | 30 ++++ app/main.py | 2 +- app/parse.py | 47 ++++++ app/routes.py | 31 +++- app/static/css/main.css | 304 +++++++++++++++++++++++++++++++++---- app/templates/v2_user.html | 188 +++++++++++++++++++++++ data/data.json | 0 tests/test_main.py | 2 +- 9 files changed, 574 insertions(+), 34 deletions(-) create mode 100644 app/data/rooyca.md create mode 100644 app/parse.py create mode 100644 app/templates/v2_user.html delete mode 100644 data/data.json diff --git a/README.md b/README.md index 917c956..7499fc6 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,10 @@ fly deploy - [GitHub API](https://docs.github.com/en/rest) - [Font Awesome](https://fontawesome.com/) +## 📝 TODO + +- [ ] Add nix support + ## 📄 License [MIT](LICENSE) \ No newline at end of file diff --git a/app/data/rooyca.md b/app/data/rooyca.md new file mode 100644 index 0000000..8013157 --- /dev/null +++ b/app/data/rooyca.md @@ -0,0 +1,30 @@ + + + +- profile-picture: https://avatars.githubusercontent.com/u/42101257?v=4 + + +# rooyca + + +| Pronouns: he/him +| Occupation: Studend +| Location: Colombia + +--- Bio --- + + +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 --- + + +- [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) + + + +--- END --- \ No newline at end of file diff --git a/app/main.py b/app/main.py index a92db2a..8e95f6e 100644 --- a/app/main.py +++ b/app/main.py @@ -64,4 +64,4 @@ async def add_process_time_header(request: Request, call_next): if __name__ == "__main__": import uvicorn - uvicorn.run(app, host="127.0.0.1", port=8000) + uvicorn.run(app, host="0.0.0.0", port=8000) diff --git a/app/parse.py b/app/parse.py new file mode 100644 index 0000000..63d4e21 --- /dev/null +++ b/app/parse.py @@ -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(" +
+ + +
+ +
+ +

{{ username }} {{ pronouns }}

+
+

+ + + {{ occupation }} +

+

+ + + {{ location }} +

+

{{ bio }}

+ +
+ {% for item in profile_items %} + {% if item.desc == "Facebook" %} + + + Facebook + + + + {% elif item.desc == "Twitter" %} + + + Twitter + + + + {% elif item.desc == "Github" %} + + + Github + + + + {% elif item.desc == "Unsplash" %} + + + Unsplash + + + + {% elif item.desc == "Dribbble" %} + + + Dribbble + + + + {% elif item.desc == "Instagram" %} + + + Instagram + + + + {% elif item.desc == "YouTube" %} + + + YouTube + + + + {% elif item.desc == "Buy Me a Coffee" %} + + + Buy Me a Coffee + + + + {% elif item.desc == "Linkedin" %} + + + LinkedIn + + + + {% elif item.desc == "Dev.to" %} + + + Dev.to + + + + {% endif %} + {% endfor %} +
+ + + +
+ +
+ + +
+ + + + +
+ + + +
+ +
+ + + + + + + + +{% endblock %} \ No newline at end of file diff --git a/data/data.json b/data/data.json deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_main.py b/tests/test_main.py index e6d914c..27a4f90 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -2,4 +2,4 @@ def test_read_main(client): response = client.get("/") assert response.status_code == 200 - assert "

Hello World!

" in response.text + #assert "

Hello World!

" in response.text