diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c8432b8..758622b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,8 +14,8 @@ jobs: pull-requests: read outputs: changes: ${{ steps.filter.outputs.changes }} - html: ${{ steps.filter.outputs.html }} markdown: ${{ steps.filter.outputs.markdown }} + markup: ${{ steps.filter.outputs.markup }} python: ${{ steps.filter.outputs.python }} yaml: ${{ steps.filter.outputs.yaml }} steps: @@ -26,10 +26,10 @@ jobs: id: filter with: filters: | - html: - - "**.html" markdown: - "**.md" + markup: + - "**.jinja" python: - "**.py" yaml: @@ -51,12 +51,12 @@ jobs: uses: ./.github/actions/virtualenv with: groups: --only lint,test - - name: Lint HTML - if: ${{ needs.filter.outputs.html == 'true' }} - run: poetry run djlint . --check --lint - name: Lint Markdown if: ${{ needs.filter.outputs.markdown == 'true' }} run: poetry run pymarkdown scan . + - name: Lint Markup + if: ${{ needs.filter.outputs.markup == 'true' }} + run: poetry run djlint . --check --lint - name: Lint YAML if: ${{ needs.filter.outputs.yaml == 'true' }} run: poetry run yamllint . diff --git a/poetry.lock b/poetry.lock index 1f564bc..8478bad 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2682,4 +2682,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "2.0" python-versions = ">=3.12.0,<3.13" -content-hash = "9845138b1e62d796ce89f6c44709dfc771cbb24d40884603e1eeae9e76c7e11a" +content-hash = "29fc79d0ac02d4848afda0a91f29a61469605165d5fb76dffd311e7e1cff18c8" diff --git a/pyproject.toml b/pyproject.toml index cb5b85f..ece20c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,8 +53,11 @@ data_file = "coverage/.coverage" omit = ["**/__init__.py", "**/__main__.py"] [tool.djlint] -use_gitignore = true +custom_html = "circle,defs,g,line,path,rect,svg,symbol,text,use" ignore = "H006" +extension = ".jinja" +profile = "jinja" +use_gitignore = true [tool.mypy] ignore_missing_imports = true @@ -118,6 +121,7 @@ html5lib = "^1.1" pandas = "^2.1.1" aiohttp = "^3.9.1" aiodns = "^3.1.1" +jinja2 = "^3.1.2" [tool.poetry.group.dev.dependencies] diff --git a/src/html_tracing/server.py b/src/html_tracing/server.py index 7cf7e4d..2e7354e 100644 --- a/src/html_tracing/server.py +++ b/src/html_tracing/server.py @@ -35,19 +35,22 @@ proxies.save_active(proxies=active_proxies)""" -app = Flask( - import_name=__name__, - static_folder="statics", - template_folder="templates", -) +app = Flask(import_name=__name__) logger.info_(msg="Server Listening...") @app.route("/") +@app.route("/home") def route_home() -> str: """Render route home.""" - return render_template("index.html") + return render_template("pages/home.jinja") + + +@app.route("/spider") +def route_spider() -> str: + """Render route spider.""" + return render_template("pages/spider.jinja") @app.route("/api/spider", methods=["POST"]) diff --git a/src/html_tracing/static/files/manifest.json b/src/html_tracing/static/files/manifest.json new file mode 100644 index 0000000..fd746ba --- /dev/null +++ b/src/html_tracing/static/files/manifest.json @@ -0,0 +1,16 @@ +{ + "id": "PythonPlayground", + "name": "PythonPlayground", + "short_name": "PythonPlayground", + "icons": [ + { + "src": "../images/favicon.ico", + "sizes": "32x32", + "type": "image/x-icon" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/src/html_tracing/statics/scripts/index.js b/src/html_tracing/static/scripts/index.js similarity index 100% rename from src/html_tracing/statics/scripts/index.js rename to src/html_tracing/static/scripts/index.js diff --git a/src/html_tracing/statics/styles/index.css b/src/html_tracing/static/styles/index.css similarity index 100% rename from src/html_tracing/statics/styles/index.css rename to src/html_tracing/static/styles/index.css diff --git a/src/html_tracing/templates/index.html b/src/html_tracing/templates/index.html deleted file mode 100644 index bdcdba7..0000000 --- a/src/html_tracing/templates/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - Python Playground - - - - -
- Python Playground -
-
-
- - -
-
-
-
- 5 - 45 -
-
-
-
-
- -
-
- - - diff --git a/src/html_tracing/templates/pages/base.jinja b/src/html_tracing/templates/pages/base.jinja new file mode 100644 index 0000000..eb387e2 --- /dev/null +++ b/src/html_tracing/templates/pages/base.jinja @@ -0,0 +1,34 @@ + + + + + + + + Python Playground + + + + {% block head %} + {% endblock head %} + + +
+ Python Playground +
+
+ {% block main %} + {% endblock main %} +
+ + {% block body %} + {% endblock body %} + + diff --git a/src/html_tracing/templates/pages/home.jinja b/src/html_tracing/templates/pages/home.jinja new file mode 100644 index 0000000..3d47c76 --- /dev/null +++ b/src/html_tracing/templates/pages/home.jinja @@ -0,0 +1,6 @@ +{% extends "pages/base.jinja" %} +{% block main %} +
+ HOME +
+{% endblock main %} diff --git a/src/html_tracing/templates/pages/spider.jinja b/src/html_tracing/templates/pages/spider.jinja new file mode 100644 index 0000000..75c5c60 --- /dev/null +++ b/src/html_tracing/templates/pages/spider.jinja @@ -0,0 +1,33 @@ +{% extends "pages/base.jinja" %} +{% block main %} +
+
+ + +
+
+
+
+ 5 + 45 +
+
+
+
+
+ +
+
+{% endblock main %}