Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
test:
name: test (${{ matrix.os }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12"]

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install WebVac with test dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run the unit test suite
run: python -m pytest tests -q

- name: Install Patchright Chromium
run: python -m patchright install chromium

- name: Smoke-check the CLI (doctor preflight)
run: python -m webvac --doctor
23 changes: 21 additions & 2 deletions webvac/data/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,25 @@ def _save_html(
og_rows = "".join(f"<tr><td>{self._esc(k)}</td><td>{self._esc(str(v))}</td></tr>" for k,v in og.items() if v)
tc_rows = "".join(f"<tr><td>{self._esc(k)}</td><td>{self._esc(str(v))}</td></tr>" for k,v in tc.items() if v)

# Tab buttons are built outside the f-string: Python 3.11 cannot
# parse a backslash inside an f-string expression (PEP 701 is 3.12+).
forms_tab_btn = ""
if forms:
forms_tab_btn = (
"<button class='tab-btn' onclick=\"switchTab(this, 'forms-"
+ str(i)
+ "')\">Forms ("
+ str(len(forms))
+ ")</button>"
)
contact_tab_btn = ""
if emails or phones or social:
contact_tab_btn = (
"<button class='tab-btn' onclick=\"switchTab(this, 'contact-"
+ str(i)
+ "')\">Contact</button>"
)

page_cards += f"""
<div class="page-card" id="page-{i}" style="display:none">
{og_img_html}
Expand Down Expand Up @@ -583,9 +602,9 @@ def _save_html(
<button class="tab-btn active" onclick="switchTab(this, 'content-{i}')">Content</button>
<button class="tab-btn" onclick="switchTab(this, 'links-{i}')">Links ({len(links)})</button>
<button class="tab-btn" onclick="switchTab(this, 'images-{i}')">Images ({len(images)})</button>
{"<button class='tab-btn' onclick=\"switchTab(this, 'forms-" + str(i) + "')\">Forms (" + str(len(forms)) + ")</button>" if forms else ""}
{forms_tab_btn}
<button class="tab-btn" onclick="switchTab(this, 'meta-{i}')">Meta / SEO</button>
{"<button class='tab-btn' onclick=\"switchTab(this, 'contact-{i}')\">Contact</button>" if (emails or phones or social) else ""}
{contact_tab_btn}
</div>

<div class="tab-panel" id="content-{i}">
Expand Down
Loading