Skip to content
Draft
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
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: github-actions
directory: /
commit-message:
prefix: 🔧
schedule:
interval: monthly
- package-ecosystem: pip
directory: /
commit-message:
prefix: ⬆️
schedule:
interval: monthly
72 changes: 72 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: ci
on:
push:
branches: [master]
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- uses: pre-commit/[email protected]
tests:
name: Test ${{ matrix.tox-env }}-${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
tox-env:
- py310-sphinx74
- py311-sphinx74
- py311-sphinx82
- py312-sphinx74
- py312-sphinx82
- py313-sphinx74
- py313-sphinx82
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install tox
run: uv pip install --system tox tox-uv
- name: Run tox environment
run: uv run tox -e ${{ matrix.tox-env }}
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install tox
run: uv pip install --system tox tox-uv
- name: Build documentation
run: uv run tox -e docs
all_good:
# This job does nothing and is only used for the branch protection
# see https://github.com/marketplace/actions/alls-green#why
if: ${{ !cancelled() }}
needs:
- lint
- tests
- docs
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ need_pie_*.png

# Files get build on CI
Sphinx-SimplePDF-DEMO.pdf
Sphinx-SimplePDF.pdf
Sphinx-SimplePDF.pdf
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.1
hooks:
- id: ruff-format
name: python format
- id: ruff
alias: ruff-check
name: python lint
args: [--fix]
- repo: https://github.com/google/yamlfmt
rev: v0.20.0
hooks:
- id: yamlfmt
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
# lint fetches schemas online at each call, deactivate for now
- id: taplo-lint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.7
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
SRC_FILES = sphinx_simplepdf/

.PHONY: list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

.PHONY: lint
lint:
pre-commit run --all-files

#.PHONY: test
#test:
# uv run pytest -n auto --tb=long tests/

.PHONY: test-matrix
test-matrix:
uv run tox

.PHONY: docs-html
docs-html:
uv run sphinx-build -a -E -j auto -b html docs/ docs/_build

.PHONY: docs-html-fast
docs-html-fast:
uv run sphinx-build -j auto -b html docs/ docs/_build

.PHONY: docs-pdf
docs-pdf:
uv run make --directory docs/ clean && uv run make --directory docs/ latexpdf

.PHONY: demo-pdf
demo-pdf:
uv run sphinx-build -M simplepdf demo demo/_build

.PHONY: docs-linkcheck
docs-linkcheck:
uv run make --directory docs/ linkcheck

.PHONY: format
format:
uv run ruff format ${SRC_FILES}
uv run ruff check --fix ${SRC_FILES}
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ Quickstart
1. ``pip install sphinx-simplepdf``.
2. ``make simplepdf`` inside your Sphinx documentation project.
3. Open your PDF under ``_build/simplepdf``.

2 changes: 1 addition & 1 deletion demo/_static/svg_process.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 45 additions & 43 deletions demo/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,77 +6,81 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import datetime
import os
import sys

import sphinx
import datetime

sys.path.append(os.path.dirname(__file__)) # Needed for test_py_module

# project = 'Sphinx-SimplePDF-DEMO'
project = 'Sphinx-SimplePDF-DEMO'
copyright = '2022, team useblocks'
author = 'team useblocks'
project = "Sphinx-SimplePDF-DEMO"
copyright = "2022, team useblocks"
author = "team useblocks"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx_simplepdf',
'sphinxcontrib.plantuml',
'sphinx_needs',
'sphinx.ext.autodoc',
'sphinx.ext.imgmath',

"sphinx_simplepdf",
"sphinxcontrib.plantuml",
"sphinx_needs",
"sphinx.ext.autodoc",
"sphinx.ext.imgmath",
]

version = "1.0" # Will not be raised

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

plantuml_output_format = "svg_img"

simplepdf_debug = True

simplepdf_file_name = 'Sphinx-SimplePDF-DEMO.pdf'
simplepdf_file_name = "Sphinx-SimplePDF-DEMO.pdf"

# Use WeasyPrint Python API instead of subprocess to avoid segfaults
simplepdf_use_weasyprint_api = True

simplepdf_vars = {
'cover-overlay': 'rgba(26, 150, 26, 0.7)',
'primary-opaque': 'rgba(26, 150, 26, 0.7)',
'cover-bg': 'url(frog.jpg) no-repeat center',
'primary': '#1a961a',
'secondary': '#379683',
'cover': '#ffffff',
'white': '#ffffff',
'links': '#1a961a',
'top-left-content': '"Header left"',
'top-center-content': '"Header center"',
'top-right-content': '"Header right"',
'bottom-left-content': 'counter(page)',
'bottom-center-content': '"Bottom center"',
'bottom-right-content': 'string(heading)',
"cover-overlay": "rgba(26, 150, 26, 0.7)",
"primary-opaque": "rgba(26, 150, 26, 0.7)",
"cover-bg": "url(frog.jpg) no-repeat center",
"primary": "#1a961a",
"secondary": "#379683",
"cover": "#ffffff",
"white": "#ffffff",
"links": "#1a961a",
"top-left-content": '"Header left"',
"top-center-content": '"Header center"',
"top-right-content": '"Header right"',
"bottom-left-content": "counter(page)",
"bottom-center-content": '"Bottom center"',
"bottom-right-content": "string(heading)",
}

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme = "alabaster"
html_static_path = ["_static"]

html_context = {
'docs_scope': 'external',
'cover_logo_title': '',
'cover_meta_data': 'DEMO PDF of Sphinx-SimplePDF',
'cover_footer': f'Build: {datetime.datetime.now().strftime("%d.%m.%Y")}<br>'
f'Maintained by <a href="https://useblocks.com">team useblocks</a>',
"docs_scope": "external",
"cover_logo_title": "",
"cover_meta_data": "DEMO PDF of Sphinx-SimplePDF",
"cover_footer": f"Build: {datetime.datetime.now().strftime('%d.%m.%Y')}<br>"
f'Maintained by <a href="https://useblocks.com">team useblocks</a>',
}

plantuml_output_format = "svg_img"
local_plantuml_path = os.path.join(os.path.dirname(__file__), "../", "docs", "utils", "plantuml.jar")
plantuml = f"java -Djava.awt.headless=true -jar {local_plantuml_path}"

imgmath_image_format = 'svg'
imgmath_image_format = "svg"


def setup_jquery(app, exception):
"""
Expand All @@ -90,12 +94,10 @@ def setup_jquery(app, exception):
# https://jquery.com/download/#using-jquery-with-a-cdn
jquery_cdn_url = "https://code.jquery.com/jquery-3.6.0.min.js"
html_js_files = getattr(app.config, "html_js_files", [])
html_js_files.append((
jquery_cdn_url,
{
'integrity': 'sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=',
'crossorigin': 'anonymous'
}
))
html_js_files.append(
(
jquery_cdn_url,
{"integrity": "sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=", "crossorigin": "anonymous"},
)
)
app.config.html_js_files = html_js_files

4 changes: 2 additions & 2 deletions demo/demo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Meta
:description lang=en: A demonstration of the reStructuredText
markup language, containing examples of all basic
constructs and many advanced constructs.

Blocks
======

Expand Down Expand Up @@ -284,7 +284,7 @@ Glossary
This is a glossary with definition terms for thing like :term:`Writing`:

.. glossary::

Documentation
Provides users with the knowledge they need to use something.

Expand Down
2 changes: 1 addition & 1 deletion demo/images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ Images in tables
- * Image 1
* Image 2
- * .. image:: /_static/phetus_2560x2176.jpg
* .. image:: /_static/svg_process.svg
* .. image:: /_static/svg_process.svg
3 changes: 0 additions & 3 deletions demo/lists_tables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,3 @@ Landscape tables
:file: /_static/example.csv
:header-rows: 2
:class: ssp-tiny



2 changes: 0 additions & 2 deletions demo/sphinx_needs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,3 @@ Sphinx-Needs needimport
.. needimport:: needs.json
:tags: imported
:collapse: True


8 changes: 4 additions & 4 deletions demo/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Aliquam accumsan feugiat ligula, nec fringilla libero commodo sed. Proin et erat
Etiam turpis ante, luctus sed velit tristique, finibus volutpat dui. Nam sagittis vel ante nec malesuada.
Praesent dignissim mi nec ornare elementum. Nunc eu augue vel sem dignissim cursus sed et nulla.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Pellentesque dictum dui sem, non placerat tortor rhoncus in. Sed placerat nulla at rhoncus iaculis.
Pellentesque dictum dui sem, non placerat tortor rhoncus in. Sed placerat nulla at rhoncus iaculis.

Document Section
================
Expand Down Expand Up @@ -49,7 +49,7 @@ pretium tristique lectus. Sed pellentesque leo lectus, et convallis ipsum euismo
Integer at leo vitae felis pretium aliquam fringilla quis odio. Sed pharetra enim accumsan feugiat pretium.
Maecenas at pharetra tortor. Morbi semper eget mi vel finibus. Cras rutrum nulla eros, id feugiat arcu pellentesque ut.
Sed finibus tortor ac nisi ultrices viverra. Duis feugiat malesuada sapien, at commodo ante porttitor ac.
Curabitur posuere mauris mi, vel ornare orci scelerisque sit amet. Suspendisse nec fringilla dui.
Curabitur posuere mauris mi, vel ornare orci scelerisque sit amet. Suspendisse nec fringilla dui.

Document Paragraph
""""""""""""""""""
Expand All @@ -66,7 +66,7 @@ Structural Elements 2
Etiam turpis ante, luctus sed velit tristique, finibus volutpat dui. Nam sagittis vel ante nec malesuada.
Praesent dignissim mi nec ornare elementum. Nunc eu augue vel sem dignissim cursus sed et nulla.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Pellentesque dictum dui sem, non placerat tortor rhoncus in. Sed placerat nulla at rhoncus iaculis.
Pellentesque dictum dui sem, non placerat tortor rhoncus in. Sed placerat nulla at rhoncus iaculis.

Document Section
================
Expand Down Expand Up @@ -98,4 +98,4 @@ Etiam efficitur sollicitudin libero, tincidunt volutpat ligula interdum sed. Pra
Vivamus sagittis risus et egestas commodo.Cras venenatis arcu in pharetra interdum.
Donec quis metus porttitor tellus cursus lobortis. Quisque et orci magna. Fusce rhoncus mi mi,
at vehicula massa rhoncus quis. Mauris augue leo, pretium eget molestie vitae, efficitur nec nulla.
In hac habitasse platea dictumst. Sed sit amet imperdiet purus.
In hac habitasse platea dictumst. Sed sit amet imperdiet purus.
Loading
Loading