From e8f498168e2f80aebe04818bd6fe071f7f77004a Mon Sep 17 00:00:00 2001 From: Manuel Da Pena <65864237+mdapena@users.noreply.github.com> Date: Sun, 7 Jun 2026 19:43:08 +0200 Subject: [PATCH 1/4] Add Analytics, Cookie Consent, and UI Improvements --- docs/.overrides/404.html | 48 ++++++++++++++++++++ docs/stylesheets/consent.css | 49 +++++++++++++++++++++ docs/stylesheets/header.css | 20 +++++++++ docs/stylesheets/search-bar.css | 30 +++++++++++++ docs/stylesheets/tabs.css | 25 +++++++++++ docs/stylesheets/task-list-indicator.css | 11 +++++ mkdocs.yml | 56 ++++++++++++++++++++---- 7 files changed, 230 insertions(+), 9 deletions(-) create mode 100644 docs/.overrides/404.html create mode 100644 docs/stylesheets/consent.css create mode 100644 docs/stylesheets/header.css create mode 100644 docs/stylesheets/search-bar.css create mode 100644 docs/stylesheets/tabs.css create mode 100644 docs/stylesheets/task-list-indicator.css diff --git a/docs/.overrides/404.html b/docs/.overrides/404.html new file mode 100644 index 0000000..7ad930f --- /dev/null +++ b/docs/.overrides/404.html @@ -0,0 +1,48 @@ +{% extends "main.html" %} + + +{% block content %} + + + + +

404 - Page Not Found

+ +

+ The requested URL was not found in this documentation. +

+ +

+ Try searching or go to PyORlib's home page. +

+ + + Gray Clouds Background + + + +{% endblock %} \ No newline at end of file diff --git a/docs/stylesheets/consent.css b/docs/stylesheets/consent.css new file mode 100644 index 0000000..3ff53de --- /dev/null +++ b/docs/stylesheets/consent.css @@ -0,0 +1,49 @@ +.md-consent__overlay { + pointer-events: none; + background-color: inherit; + -webkit-backdrop-filter: none; + backdrop-filter: none; +} + +.md-consent__inner { + background-color: color-mix(in srgb, var(--md-default-bg-color) 75%, transparent); + -webkit-backdrop-filter: blur(0.7rem); + backdrop-filter: blur(0.7rem); + border-radius: 0; + + h4 { + display: flex; + align-items: center; + } + + img { + width: 1.5rem; + height: 1.5rem; + margin-right: 0.5rem; + } + + .md-button { + border-radius: 1rem; + } + + &::before { + content: ""; + position: absolute; + pointer-events: none; + background-color: color-mix(in srgb, var(--md-primary-fg-color) 7%, transparent); + z-index: 0; + inset: 0; + } +} + +.md-consent__controls { + .md-button { + border-color: var(--md-primary-fg-color--dark); + color: var(--md-primary-fg-color--dark); + } + + .md-button--primary { + background-color: var(--md-primary-fg-color--dark); + color: var(--md-primary-bg-color); + } +} \ No newline at end of file diff --git a/docs/stylesheets/header.css b/docs/stylesheets/header.css new file mode 100644 index 0000000..a567821 --- /dev/null +++ b/docs/stylesheets/header.css @@ -0,0 +1,20 @@ +.md-header { + font-weight: bold; + background-color: color-mix(in srgb, var(--md-primary-fg-color) 53%, transparent); + -webkit-backdrop-filter: blur(0.5rem); + backdrop-filter: blur(0.5rem); + border-radius: 0; + + &::before { + content: ""; + position: absolute; + pointer-events: none; + background-color: color-mix(in srgb, var(--md-primary-fg-color--dark) 57%, transparent); + z-index: 0; + inset: 0; + } +} + +.md-header__source { + z-index: 0; +} \ No newline at end of file diff --git a/docs/stylesheets/search-bar.css b/docs/stylesheets/search-bar.css new file mode 100644 index 0000000..6025267 --- /dev/null +++ b/docs/stylesheets/search-bar.css @@ -0,0 +1,30 @@ +.md-search__input { + font-weight: bold; +} + +.md-search__form { + border-radius: 1rem; + border-top-right-radius: 1rem !important; + border-top-left-radius: 1rem !important; + + &:hover { + background-color: var(--md-default-fg-color--lighter); + } +} + +.md-search__output { + border-bottom-left-radius: 1rem !important; + border-bottom-right-radius: 1rem !important; +} + +@media screen and (max-width: 59.9844em) { + .md-search__form { + border-top-right-radius: inherit !important; + border-top-left-radius: inherit !important; + } + + .md-search__output { + border-bottom-left-radius: inherit !important; + border-bottom-right-radius: inherit !important; + } +} \ No newline at end of file diff --git a/docs/stylesheets/tabs.css b/docs/stylesheets/tabs.css new file mode 100644 index 0000000..a2d025b --- /dev/null +++ b/docs/stylesheets/tabs.css @@ -0,0 +1,25 @@ +.md-tabs { + font-weight: bold; + box-shadow: 0 0 .1rem #0000001a, 0 .1rem .2rem #0003; + background-color: color-mix(in srgb, var(--md-primary-fg-color) 53%, transparent); + -webkit-backdrop-filter: blur(0.5rem); + backdrop-filter: blur(0.5rem); + border-radius: 0; + + &::before { + content: ""; + position: absolute; + pointer-events: none; + background-color: color-mix(in srgb, var(--md-primary-fg-color--dark) 57%, transparent); + z-index: 0; + inset: 0; + } +} + +.md-tabs__item--active { + text-decoration: underline; + text-decoration-color: color-mix(in srgb, var(--md-primary-bg-color) 70%, transparent); + text-decoration-thickness: 0.25rem; + text-decoration-skip-ink: auto; + text-underline-offset: 0.375rem; +} \ No newline at end of file diff --git a/docs/stylesheets/task-list-indicator.css b/docs/stylesheets/task-list-indicator.css new file mode 100644 index 0000000..dc680c0 --- /dev/null +++ b/docs/stylesheets/task-list-indicator.css @@ -0,0 +1,11 @@ +.md-typeset .task-list-indicator::before { + background-color: var(--md-default-fg-color--lighter); +} + +.md-typeset [type="checkbox"]:checked+.task-list-indicator::before { + background-color: var(--md-primary-fg-color--dark); +} + +.md-typeset .task-list-item { + padding-left: 0.25rem; +} \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index ab055f9..e3d147d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -3,8 +3,7 @@ site_name: PyORlib site_url: https://dapensoft.github.io/pyorlib/ site_author: Isaac Da Pena & Manuel Da Pena site_description: >- - A powerful Python library for operations research. Define, solve, and interact with - mathematical models in a standardized manner across different optimization packages. + A powerful Python library for operations research and optimization. # Repository repo_name: dapensoft/pyorlib @@ -12,16 +11,24 @@ repo_url: https://github.com/dapensoft/pyorlib # Copyright copyright: | - Copyright © 2024 Isaac Da Pena, - Manuel Da Pena + Copyright © 2024-2026 Isaac Da Pena, + Manuel Da Pena – + Change Cookie Settings # Configuration theme: name: material language: en + custom_dir: docs/.overrides logo: images/logo/pyorlib-logo-white.svg favicon: images/favicon/pyorlib-logo.ico palette: + # Palette toggle for automatic mode + - media: "(prefers-color-scheme)" + toggle: + icon: material/weather-sunny + name: Switch to light mode + # Palette toggle for light mode - media: '(prefers-color-scheme: light)' scheme: default primary: pink @@ -29,13 +36,14 @@ theme: toggle: icon: material/weather-night name: Switch to dark mode + # Palette toggle for dark mode - media: '(prefers-color-scheme: dark)' scheme: slate primary: pink accent: amber toggle: - icon: material/weather-sunny - name: Switch to light mode + icon: material/brightness-auto + name: Switch to system preference features: - navigation.tabs - navigation.indexes @@ -56,11 +64,35 @@ extra: social: - icon: fontawesome/brands/github link: https://github.com/dapensoft + analytics: + provider: google + property: !ENV GOOGLE_ANALYTICS_KEY + feedback: + title: Was this page helpful? + ratings: + - icon: material/thumb-up-outline + name: This page was helpful + data: 1 + note: >- + Thanks for your feedback! + - icon: material/thumb-down-outline + name: This page could be improved + data: 0 + note: >- + Thanks for your feedback! + consent: + title: CookieCookie Consent + description: >- + We use cookies to recognize your repeated visits and preferences, as well + as to measure the effectiveness of our documentation and whether users + find what they're searching for. With your consent, you're helping us to + make our documentation better. # Plugins plugins: - search - git-committers: + enabled: !ENV [CI, false] repository: dapensoft/pyorlib branch: master exclude: @@ -92,7 +124,7 @@ plugins: show_signature_annotations: true show_category_heading: true - social: - enabled: !ENV [ CI, false ] + enabled: !ENV [CI, false] # Extensions markdown_extensions: @@ -122,6 +154,14 @@ markdown_extensions: - toc: permalink: true +# Extra Stylesheets +extra_css: + - stylesheets/consent.css + - stylesheets/header.css + - stylesheets/search-bar.css + - stylesheets/tabs.css + - stylesheets/task-list-indicator.css + # Extra JavaScript for MathJax extra_javascript: - javascript/mathjax.js @@ -184,7 +224,5 @@ nav: - Ortools Exception: api/exceptions/ortools-exception.md - Pulp Exception: api/exceptions/pulp-exception.md - Model Exception: api/exceptions/model-exception.md - - - Contributing: contributing.md - Release Notes: release-notes.md From 4c39851c47245a2b27011b630803fc8da2bda526 Mon Sep 17 00:00:00 2001 From: Manuel Da Pena <65864237+mdapena@users.noreply.github.com> Date: Sun, 7 Jun 2026 19:52:08 +0200 Subject: [PATCH 2/4] Remove `polyfill.io` from `extra_javascript` due to security risk --- mkdocs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index e3d147d..98849a1 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -165,7 +165,6 @@ extra_css: # Extra JavaScript for MathJax extra_javascript: - javascript/mathjax.js - - https://polyfill.io/v3/polyfill.min.js?features=es6 - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js # Page tree From c19c1a65b97267201fdef437c7ec9d64bed5428b Mon Sep 17 00:00:00 2001 From: Manuel Da Pena <65864237+mdapena@users.noreply.github.com> Date: Sun, 7 Jun 2026 20:14:22 +0200 Subject: [PATCH 3/4] Bump GitHub Actions versions & add Google Analytics variable --- .github/workflows/deploy-docs.yml | 8 +++++--- .github/workflows/publish-to-pypi.yml | 8 ++++---- .github/workflows/run-tests.yml | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index cbc7efb..b9f181d 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -11,9 +11,11 @@ permissions: jobs: deploy: runs-on: ubuntu-latest + env: + GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -21,11 +23,11 @@ jobs: run: | git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: "3.11" - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v5 with: key: mkdocs-material-${{ env.cache_id }} path: .cache diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 80766ee..d14e665 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -12,10 +12,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.x" @@ -26,7 +26,7 @@ jobs: run: python -m build - name: Store the distribution packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: python-package-distributions path: dist/ @@ -46,7 +46,7 @@ jobs: steps: - name: Download all the dists - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: python-package-distributions path: dist/ diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 61dd7c9..7b09391 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -20,10 +20,10 @@ jobs: python-version: [ "3.10", "3.11" ] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} From 4080cca74771186fe9aabe9281211e613dce675f Mon Sep 17 00:00:00 2001 From: Manuel Da Pena <65864237+mdapena@users.noreply.github.com> Date: Sun, 7 Jun 2026 20:32:22 +0200 Subject: [PATCH 4/4] Update mkdocs.yml --- mkdocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 98849a1..c0d590a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -3,7 +3,8 @@ site_name: PyORlib site_url: https://dapensoft.github.io/pyorlib/ site_author: Isaac Da Pena & Manuel Da Pena site_description: >- - A powerful Python library for operations research and optimization. + A powerful Python library for operations research. Define, solve, and interact with + mathematical models in a standardized manner across different optimization packages. # Repository repo_name: dapensoft/pyorlib