From a7a6a761fffd73fca4d5cff2d4f959075b47d95f Mon Sep 17 00:00:00 2001 From: Roberto Prevato Date: Tue, 20 Dec 2022 22:54:58 +0100 Subject: [PATCH] =?UTF-8?q?v1=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix #27, #28 * Corrects namespace to be neoteroi.mkdocs * Replace setup.py with pyproject.toml * Update CHANGELOG.md --- .github/workflows/build.yml | 29 +++------ .gitignore | 1 + CHANGELOG.md | 17 +++-- Makefile | 17 ++--- neoteroi/contribs/py.typed | 1 - neoteroi/markdown/py.typed | 0 neoteroi/mkdocs/__init__.py | 1 + neoteroi/{ => mkdocs}/cards/__init__.py | 9 ++- neoteroi/{ => mkdocs}/cards/domain.py | 2 +- neoteroi/{ => mkdocs}/cards/html.py | 12 +++- neoteroi/{ => mkdocs}/contribs/__init__.py | 30 +++++---- neoteroi/{ => mkdocs}/contribs/domain.py | 0 neoteroi/{ => mkdocs}/contribs/git.py | 2 +- neoteroi/{ => mkdocs}/contribs/html.py | 2 +- neoteroi/{ => mkdocs}/markdown/__init__.py | 0 neoteroi/{ => mkdocs}/markdown/align.py | 0 .../{ => mkdocs}/markdown/data/__init__.py | 0 neoteroi/{ => mkdocs}/markdown/data/files.py | 0 neoteroi/{ => mkdocs}/markdown/data/source.py | 0 neoteroi/{ => mkdocs}/markdown/data/text.py | 0 neoteroi/{ => mkdocs}/markdown/data/web.py | 0 neoteroi/{ => mkdocs}/markdown/images.py | 0 neoteroi/{ => mkdocs}/markdown/processors.py | 17 +++-- .../{ => mkdocs}/markdown/tables/__init__.py | 0 .../{ => mkdocs}/markdown/tables/spantable.py | 0 neoteroi/{ => mkdocs}/markdown/utils.py | 0 .../{mkdocsoad => mkdocs/oad}/__init__.py | 2 +- neoteroi/{ => mkdocs}/projects/__init__.py | 0 neoteroi/{ => mkdocs}/projects/domain.py | 2 +- .../{ => mkdocs}/projects/gantt/__init__.py | 7 ++- neoteroi/{ => mkdocs}/projects/gantt/html.py | 2 +- neoteroi/{ => mkdocs}/projects/timeutil.py | 0 neoteroi/{cards => mkdocs}/py.typed | 0 neoteroi/{ => mkdocs}/spantable/__init__.py | 6 +- neoteroi/{ => mkdocs}/timeline/__init__.py | 9 ++- neoteroi/{ => mkdocs}/timeline/domain.py | 0 neoteroi/{ => mkdocs}/timeline/html.py | 4 +- neoteroi/mkdocsoad/py.typed | 1 - neoteroi/projects/py.typed | 0 neoteroi/spantable/py.typed | 1 - neoteroi/timeline/py.typed | 1 - pyproject.toml | 50 +++++++++++++++ setup.py | 63 ------------------- tests/test_align.py | 6 +- tests/test_cards.py | 2 +- tests/test_contribs.py | 8 ++- tests/test_gantt.py | 2 +- tests/test_http.py | 4 +- tests/test_images.py | 2 +- tests/test_markdown.py | 4 +- tests/test_mkdocsoad.py | 2 +- tests/test_processors.py | 2 +- tests/test_projects.py | 2 +- tests/test_spantable.py | 2 +- tests/test_table.py | 2 +- tests/test_timeline.py | 2 +- tests/test_timeutil.py | 2 +- tests/test_utils.py | 2 +- 58 files changed, 175 insertions(+), 157 deletions(-) delete mode 100644 neoteroi/contribs/py.typed delete mode 100644 neoteroi/markdown/py.typed create mode 100644 neoteroi/mkdocs/__init__.py rename neoteroi/{ => mkdocs}/cards/__init__.py (88%) rename neoteroi/{ => mkdocs}/cards/domain.py (86%) rename neoteroi/{ => mkdocs}/cards/html.py (87%) rename neoteroi/{ => mkdocs}/contribs/__init__.py (85%) rename neoteroi/{ => mkdocs}/contribs/domain.py (100%) rename neoteroi/{ => mkdocs}/contribs/git.py (96%) rename neoteroi/{ => mkdocs}/contribs/html.py (98%) rename neoteroi/{ => mkdocs}/markdown/__init__.py (100%) rename neoteroi/{ => mkdocs}/markdown/align.py (100%) rename neoteroi/{ => mkdocs}/markdown/data/__init__.py (100%) rename neoteroi/{ => mkdocs}/markdown/data/files.py (100%) rename neoteroi/{ => mkdocs}/markdown/data/source.py (100%) rename neoteroi/{ => mkdocs}/markdown/data/text.py (100%) rename neoteroi/{ => mkdocs}/markdown/data/web.py (100%) rename neoteroi/{ => mkdocs}/markdown/images.py (100%) rename neoteroi/{ => mkdocs}/markdown/processors.py (95%) rename neoteroi/{ => mkdocs}/markdown/tables/__init__.py (100%) rename neoteroi/{ => mkdocs}/markdown/tables/spantable.py (100%) rename neoteroi/{ => mkdocs}/markdown/utils.py (100%) rename neoteroi/{mkdocsoad => mkdocs/oad}/__init__.py (98%) rename neoteroi/{ => mkdocs}/projects/__init__.py (100%) rename neoteroi/{ => mkdocs}/projects/domain.py (99%) rename neoteroi/{ => mkdocs}/projects/gantt/__init__.py (89%) rename neoteroi/{ => mkdocs}/projects/gantt/html.py (99%) rename neoteroi/{ => mkdocs}/projects/timeutil.py (100%) rename neoteroi/{cards => mkdocs}/py.typed (100%) rename neoteroi/{ => mkdocs}/spantable/__init__.py (96%) rename neoteroi/{ => mkdocs}/timeline/__init__.py (89%) rename neoteroi/{ => mkdocs}/timeline/domain.py (100%) rename neoteroi/{ => mkdocs}/timeline/html.py (95%) delete mode 100644 neoteroi/mkdocsoad/py.typed delete mode 100644 neoteroi/projects/py.typed delete mode 100644 neoteroi/spantable/py.typed delete mode 100644 neoteroi/timeline/py.typed create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8df0a02..544a7ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ env: jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -47,7 +47,7 @@ jobs: if: matrix.python-version == '3.10' - name: Use Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} @@ -96,29 +96,29 @@ jobs: bash <(curl -s https://codecov.io/bash) - name: Install distribution dependencies - run: pip install --upgrade twine setuptools wheel + run: pip install build if: matrix.python-version == '3.10' - name: Create distribution package - run: python setup.py sdist bdist_wheel + run: python -m build if: matrix.python-version == '3.10' - name: Upload distribution package uses: actions/upload-artifact@master with: - name: dist-package-${{ matrix.python-version }} + name: dist path: dist if: matrix.python-version == '3.10' publish: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: build if: github.event_name == 'release' steps: - name: Download the distribution package uses: actions/download-artifact@v2 with: - name: dist-package-3.10 + name: dist path: dist - name: Publish distribution 📦 to Test PyPI @@ -148,17 +148,6 @@ jobs: with: upload_url: ${{ github.event.release.upload_url }} asset_path: ./dist-css/neoteroi-mkdocs.css - asset_name: css-${{ github.event.release.tag_name }}.zip - asset_content_type: application/zip - continue-on-error: true - - - name: Add CSS package to the release - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./dist-css/neoteroi-mkdocs.min.css - asset_name: css-${{ github.event.release.tag_name }}.zip - asset_content_type: application/zip + asset_name: css-${{ github.event.release.tag_name }}.css + asset_content_type: text/css continue-on-error: true diff --git a/.gitignore b/.gitignore index fefb65d..9385926 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ __*.html __file_out.py docs/res/contribs-new.html +dist/ diff --git a/CHANGELOG.md b/CHANGELOG.md index c66b7ae..3d24330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,15 +5,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.0] - 2022-12-20 +- Adds the possibility to specify a `class` for the root HTML element of `cards`. +- Fixes a bug in the `contribs` plugin (adds a carriage return before the + contribution fragment). +- Modifies the packages to group all extensions under `neoteroi.mkdocs` namespace. +- Replaces `setup.py` with `pyproject.toml`. + ## [0.1.2] - 2022-10-04 -- Corrects the pattern handling name and email for the `contribs` plugin -- Adds tests for the `contribs` plugin +- Corrects the pattern handling name and email for the `contribs` plugin. +- Adds tests for the `contribs` plugin. ## [0.1.1] - 2022-10-04 - Corrects bug in the `contribs` plugin, causing failures in certain CI/CD - solutions and improves its safety and performance (removes `shell=True`!) -- Adds option to apply a class to specific contributors, for simpler styling -- Minor improvements to styles + solutions and improves its safety and performance (removes `shell=True`!). +- Adds option to apply a class to specific contributors, for simpler styling. +- Minor improvements to styles. ## [0.0.9] - 2022-10-02 - Improves the `contributors` plugin: diff --git a/Makefile b/Makefile index 113f80a..e6851d2 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,23 @@ .PHONY: release test annotate -artifacts: test - python setup.py sdist +artifacts: test build prepforbuild: - pip install --upgrade twine setuptools wheel + pip install build -testrelease: - twine upload --repository-url https://test.pypi.org/legacy/ dist/* +build: + python -m build -release: artifacts - twine upload --repository-url https://upload.pypi.org/legacy/ dist/* +test-release: + twine upload --repository testpypi dist/* + + +release: + twine upload --repository pypi dist/* test: diff --git a/neoteroi/contribs/py.typed b/neoteroi/contribs/py.typed deleted file mode 100644 index 8b13789..0000000 --- a/neoteroi/contribs/py.typed +++ /dev/null @@ -1 +0,0 @@ - diff --git a/neoteroi/markdown/py.typed b/neoteroi/markdown/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/neoteroi/mkdocs/__init__.py b/neoteroi/mkdocs/__init__.py new file mode 100644 index 0000000..5becc17 --- /dev/null +++ b/neoteroi/mkdocs/__init__.py @@ -0,0 +1 @@ +__version__ = "1.0.0" diff --git a/neoteroi/cards/__init__.py b/neoteroi/mkdocs/cards/__init__.py similarity index 88% rename from neoteroi/cards/__init__.py rename to neoteroi/mkdocs/cards/__init__.py index a5cb6cd..3227960 100644 --- a/neoteroi/cards/__init__.py +++ b/neoteroi/mkdocs/cards/__init__.py @@ -8,9 +8,12 @@ """ from markdown import Extension -from neoteroi.markdown.images import Image -from neoteroi.markdown.processors import EmbeddedBlockProcessor, SourceBlockProcessor -from neoteroi.markdown.utils import create_instance, create_instances +from neoteroi.mkdocs.markdown.images import Image +from neoteroi.mkdocs.markdown.processors import ( + EmbeddedBlockProcessor, + SourceBlockProcessor, +) +from neoteroi.mkdocs.markdown.utils import create_instance, create_instances from .domain import CardItem, Cards from .html import CardsHTMLBuilder, CardsViewOptions diff --git a/neoteroi/cards/domain.py b/neoteroi/mkdocs/cards/domain.py similarity index 86% rename from neoteroi/cards/domain.py rename to neoteroi/mkdocs/cards/domain.py index 4314d39..696d42d 100644 --- a/neoteroi/cards/domain.py +++ b/neoteroi/mkdocs/cards/domain.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import List, Optional -from neoteroi.markdown.images import Image +from neoteroi.mkdocs.markdown.images import Image @dataclass diff --git a/neoteroi/cards/html.py b/neoteroi/mkdocs/cards/html.py similarity index 87% rename from neoteroi/cards/html.py rename to neoteroi/mkdocs/cards/html.py index eee0bfa..fde933e 100644 --- a/neoteroi/cards/html.py +++ b/neoteroi/mkdocs/cards/html.py @@ -2,7 +2,7 @@ import xml.etree.ElementTree as etree from dataclasses import dataclass -from neoteroi.markdown.images import build_image_html +from neoteroi.mkdocs.markdown.images import build_image_html from .domain import CardItem, Cards @@ -12,6 +12,7 @@ @dataclass class CardsViewOptions: id: str = "" + class_name: str = "" cols: int = 3 image_bg: bool = False @@ -36,9 +37,16 @@ def get_item_props(self, item: CardItem): return item_props + def _get_root_class(self): + base_class = f"nt-cards nt-grid cols-{self.options.cols}" + + if self.options.class_name: + return base_class + " " + self.options.class_name + return base_class + def build_html(self, parent, cards: Cards): root_element = etree.SubElement( - parent, "div", {"class": f"nt-cards nt-grid cols-{self.options.cols}"} + parent, "div", {"class": self._get_root_class()} ) for item in cards.items: diff --git a/neoteroi/contribs/__init__.py b/neoteroi/mkdocs/contribs/__init__.py similarity index 85% rename from neoteroi/contribs/__init__.py rename to neoteroi/mkdocs/contribs/__init__.py index 28a8549..3970d09 100644 --- a/neoteroi/contribs/__init__.py +++ b/neoteroi/mkdocs/contribs/__init__.py @@ -17,9 +17,9 @@ from mkdocs.structure.files import File from mkdocs.structure.pages import Page -from neoteroi.contribs.domain import ContributionsReader, Contributor -from neoteroi.contribs.git import GitContributionsReader -from neoteroi.contribs.html import ContribsViewOptions, render_contribution_stats +from neoteroi.mkdocs.contribs.domain import ContributionsReader, Contributor +from neoteroi.mkdocs.contribs.git import GitContributionsReader +from neoteroi.mkdocs.contribs.html import ContribsViewOptions, render_contribution_stats logger = logging.getLogger("MARKDOWN") @@ -111,16 +111,20 @@ def _set_contributors(self, markdown: str, page: Page) -> str: page_file = page.file last_commit_date = self._get_last_commit_date(page_file) contributors = self._get_contributors(page_file) - return markdown + render_contribution_stats( - contributors, - last_commit_date, - ContribsViewOptions( - self.config["contributors_label"], - self.config["last_modified_label"], - self.config["show_last_modified_time"], - self.config["show_contributors_title"], - self.config["time_format"], - ), + return ( + markdown + + "\n\n" + + render_contribution_stats( + contributors, + last_commit_date, + ContribsViewOptions( + self.config["contributors_label"], + self.config["last_modified_label"], + self.config["show_last_modified_time"], + self.config["show_contributors_title"], + self.config["time_format"], + ), + ) ) def on_page_markdown(self, markdown, *args, **kwargs): diff --git a/neoteroi/contribs/domain.py b/neoteroi/mkdocs/contribs/domain.py similarity index 100% rename from neoteroi/contribs/domain.py rename to neoteroi/mkdocs/contribs/domain.py diff --git a/neoteroi/contribs/git.py b/neoteroi/mkdocs/contribs/git.py similarity index 96% rename from neoteroi/contribs/git.py rename to neoteroi/mkdocs/contribs/git.py index 6ae9adc..6048cad 100644 --- a/neoteroi/contribs/git.py +++ b/neoteroi/mkdocs/contribs/git.py @@ -6,7 +6,7 @@ from dateutil.parser import parse as parse_date -from neoteroi.contribs.domain import ContributionsReader, Contributor +from neoteroi.mkdocs.contribs.domain import ContributionsReader, Contributor class GitContributionsReader(ContributionsReader): diff --git a/neoteroi/contribs/html.py b/neoteroi/mkdocs/contribs/html.py similarity index 98% rename from neoteroi/contribs/html.py rename to neoteroi/mkdocs/contribs/html.py index 8c6d2c7..1eb817e 100644 --- a/neoteroi/contribs/html.py +++ b/neoteroi/mkdocs/contribs/html.py @@ -7,7 +7,7 @@ from typing import List from xml.etree.ElementTree import tostring as xml_to_str -from neoteroi.contribs.domain import Contributor +from neoteroi.mkdocs.contribs.domain import Contributor def _get_initials(value: str) -> str: diff --git a/neoteroi/markdown/__init__.py b/neoteroi/mkdocs/markdown/__init__.py similarity index 100% rename from neoteroi/markdown/__init__.py rename to neoteroi/mkdocs/markdown/__init__.py diff --git a/neoteroi/markdown/align.py b/neoteroi/mkdocs/markdown/align.py similarity index 100% rename from neoteroi/markdown/align.py rename to neoteroi/mkdocs/markdown/align.py diff --git a/neoteroi/markdown/data/__init__.py b/neoteroi/mkdocs/markdown/data/__init__.py similarity index 100% rename from neoteroi/markdown/data/__init__.py rename to neoteroi/mkdocs/markdown/data/__init__.py diff --git a/neoteroi/markdown/data/files.py b/neoteroi/mkdocs/markdown/data/files.py similarity index 100% rename from neoteroi/markdown/data/files.py rename to neoteroi/mkdocs/markdown/data/files.py diff --git a/neoteroi/markdown/data/source.py b/neoteroi/mkdocs/markdown/data/source.py similarity index 100% rename from neoteroi/markdown/data/source.py rename to neoteroi/mkdocs/markdown/data/source.py diff --git a/neoteroi/markdown/data/text.py b/neoteroi/mkdocs/markdown/data/text.py similarity index 100% rename from neoteroi/markdown/data/text.py rename to neoteroi/mkdocs/markdown/data/text.py diff --git a/neoteroi/markdown/data/web.py b/neoteroi/mkdocs/markdown/data/web.py similarity index 100% rename from neoteroi/markdown/data/web.py rename to neoteroi/mkdocs/markdown/data/web.py diff --git a/neoteroi/markdown/images.py b/neoteroi/mkdocs/markdown/images.py similarity index 100% rename from neoteroi/markdown/images.py rename to neoteroi/mkdocs/markdown/images.py diff --git a/neoteroi/markdown/processors.py b/neoteroi/mkdocs/markdown/processors.py similarity index 95% rename from neoteroi/markdown/processors.py rename to neoteroi/mkdocs/markdown/processors.py index 3fcc74c..6c27f0e 100644 --- a/neoteroi/markdown/processors.py +++ b/neoteroi/mkdocs/markdown/processors.py @@ -20,11 +20,16 @@ from markdown.blockprocessors import BlockProcessor -from neoteroi.markdown import parse_props -from neoteroi.markdown.data.files import FileReader -from neoteroi.markdown.data.source import DataReader -from neoteroi.markdown.data.text import CSVParser, JSONParser, TextParser, YAMLParser -from neoteroi.markdown.data.web import HTTPDataReader +from neoteroi.mkdocs.markdown import parse_props +from neoteroi.mkdocs.markdown.data.files import FileReader +from neoteroi.mkdocs.markdown.data.source import DataReader +from neoteroi.mkdocs.markdown.data.text import ( + CSVParser, + JSONParser, + TextParser, + YAMLParser, +) +from neoteroi.mkdocs.markdown.data.web import HTTPDataReader logger = logging.getLogger("MARKDOWN") @@ -198,6 +203,8 @@ def run(self, parent, blocks): else: props = {} + props["__source"] = source + try: data = self.read_from_source(source) except ValueError as value_error: diff --git a/neoteroi/markdown/tables/__init__.py b/neoteroi/mkdocs/markdown/tables/__init__.py similarity index 100% rename from neoteroi/markdown/tables/__init__.py rename to neoteroi/mkdocs/markdown/tables/__init__.py diff --git a/neoteroi/markdown/tables/spantable.py b/neoteroi/mkdocs/markdown/tables/spantable.py similarity index 100% rename from neoteroi/markdown/tables/spantable.py rename to neoteroi/mkdocs/markdown/tables/spantable.py diff --git a/neoteroi/markdown/utils.py b/neoteroi/mkdocs/markdown/utils.py similarity index 100% rename from neoteroi/markdown/utils.py rename to neoteroi/mkdocs/markdown/utils.py diff --git a/neoteroi/mkdocsoad/__init__.py b/neoteroi/mkdocs/oad/__init__.py similarity index 98% rename from neoteroi/mkdocsoad/__init__.py rename to neoteroi/mkdocs/oad/__init__.py index eb12c44..587c06b 100644 --- a/neoteroi/mkdocsoad/__init__.py +++ b/neoteroi/mkdocs/oad/__init__.py @@ -6,7 +6,7 @@ The markdown requires by default -neoteroi.mkdocsoad +neoteroi.mkdocs.oad """ import re diff --git a/neoteroi/projects/__init__.py b/neoteroi/mkdocs/projects/__init__.py similarity index 100% rename from neoteroi/projects/__init__.py rename to neoteroi/mkdocs/projects/__init__.py diff --git a/neoteroi/projects/domain.py b/neoteroi/mkdocs/projects/domain.py similarity index 99% rename from neoteroi/projects/domain.py rename to neoteroi/mkdocs/projects/domain.py index 3c34ec5..c7f13df 100644 --- a/neoteroi/projects/domain.py +++ b/neoteroi/mkdocs/projects/domain.py @@ -4,7 +4,7 @@ from dateutil.parser import parse as parse_date -from neoteroi.projects.timeutil import parse_lasts +from neoteroi.mkdocs.projects.timeutil import parse_lasts @dataclass(frozen=True) diff --git a/neoteroi/projects/gantt/__init__.py b/neoteroi/mkdocs/projects/gantt/__init__.py similarity index 89% rename from neoteroi/projects/gantt/__init__.py rename to neoteroi/mkdocs/projects/gantt/__init__.py index 2c1ab62..f6565cd 100644 --- a/neoteroi/projects/gantt/__init__.py +++ b/neoteroi/mkdocs/projects/gantt/__init__.py @@ -6,8 +6,11 @@ MIT License Copyright (c) 2022 to present, Roberto Prevato """ -from neoteroi.markdown.processors import EmbeddedBlockProcessor, SourceBlockProcessor -from neoteroi.markdown.utils import create_instance +from neoteroi.mkdocs.markdown.processors import ( + EmbeddedBlockProcessor, + SourceBlockProcessor, +) +from neoteroi.mkdocs.markdown.utils import create_instance from ..domain import Plan from .html import GanttHTMLBuilder, GanttViewOptions diff --git a/neoteroi/projects/gantt/html.py b/neoteroi/mkdocs/projects/gantt/html.py similarity index 99% rename from neoteroi/projects/gantt/html.py rename to neoteroi/mkdocs/projects/gantt/html.py index e988149..d1d4491 100644 --- a/neoteroi/projects/gantt/html.py +++ b/neoteroi/mkdocs/projects/gantt/html.py @@ -7,7 +7,7 @@ from typing import List, Union from uuid import uuid4 -from neoteroi.markdown.images import build_icon_html +from neoteroi.mkdocs.markdown.images import build_icon_html from ..domain import Activity, Event, Plan from ..timeutil import ( diff --git a/neoteroi/projects/timeutil.py b/neoteroi/mkdocs/projects/timeutil.py similarity index 100% rename from neoteroi/projects/timeutil.py rename to neoteroi/mkdocs/projects/timeutil.py diff --git a/neoteroi/cards/py.typed b/neoteroi/mkdocs/py.typed similarity index 100% rename from neoteroi/cards/py.typed rename to neoteroi/mkdocs/py.typed diff --git a/neoteroi/spantable/__init__.py b/neoteroi/mkdocs/spantable/__init__.py similarity index 96% rename from neoteroi/spantable/__init__.py rename to neoteroi/mkdocs/spantable/__init__.py index 379fa60..bfb0367 100644 --- a/neoteroi/spantable/__init__.py +++ b/neoteroi/mkdocs/spantable/__init__.py @@ -14,9 +14,9 @@ from markdown import Extension from markdown.blockprocessors import BlockProcessor -from neoteroi.markdown import parse_props -from neoteroi.markdown.tables import read_table -from neoteroi.markdown.tables.spantable import Cell, SpanTable +from neoteroi.mkdocs.markdown import parse_props +from neoteroi.mkdocs.markdown.tables import read_table +from neoteroi.mkdocs.markdown.tables.spantable import Cell, SpanTable logger = logging.getLogger("MARKDOWN") diff --git a/neoteroi/timeline/__init__.py b/neoteroi/mkdocs/timeline/__init__.py similarity index 89% rename from neoteroi/timeline/__init__.py rename to neoteroi/mkdocs/timeline/__init__.py index fd14b1e..bbbdf52 100644 --- a/neoteroi/timeline/__init__.py +++ b/neoteroi/mkdocs/timeline/__init__.py @@ -9,9 +9,12 @@ """ from markdown import Extension -from neoteroi.markdown.align import aligment_from_props -from neoteroi.markdown.processors import EmbeddedBlockProcessor, SourceBlockProcessor -from neoteroi.markdown.utils import create_instance, create_instances +from neoteroi.mkdocs.markdown.align import aligment_from_props +from neoteroi.mkdocs.markdown.processors import ( + EmbeddedBlockProcessor, + SourceBlockProcessor, +) +from neoteroi.mkdocs.markdown.utils import create_instance, create_instances from .domain import Timeline, TimelineItem from .html import TimelineHTMLBuilder, TimelineViewOptions diff --git a/neoteroi/timeline/domain.py b/neoteroi/mkdocs/timeline/domain.py similarity index 100% rename from neoteroi/timeline/domain.py rename to neoteroi/mkdocs/timeline/domain.py diff --git a/neoteroi/timeline/html.py b/neoteroi/mkdocs/timeline/html.py similarity index 95% rename from neoteroi/timeline/html.py rename to neoteroi/mkdocs/timeline/html.py index 3e45679..fbc44fe 100644 --- a/neoteroi/timeline/html.py +++ b/neoteroi/mkdocs/timeline/html.py @@ -2,8 +2,8 @@ import xml.etree.ElementTree as etree from dataclasses import dataclass -from neoteroi.markdown.align import Alignment -from neoteroi.markdown.images import build_icon_html +from neoteroi.mkdocs.markdown.align import Alignment +from neoteroi.mkdocs.markdown.images import build_icon_html from .domain import Timeline, TimelineItem diff --git a/neoteroi/mkdocsoad/py.typed b/neoteroi/mkdocsoad/py.typed deleted file mode 100644 index 8b13789..0000000 --- a/neoteroi/mkdocsoad/py.typed +++ /dev/null @@ -1 +0,0 @@ - diff --git a/neoteroi/projects/py.typed b/neoteroi/projects/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/neoteroi/spantable/py.typed b/neoteroi/spantable/py.typed deleted file mode 100644 index 8b13789..0000000 --- a/neoteroi/spantable/py.typed +++ /dev/null @@ -1 +0,0 @@ - diff --git a/neoteroi/timeline/py.typed b/neoteroi/timeline/py.typed deleted file mode 100644 index 8b13789..0000000 --- a/neoteroi/timeline/py.typed +++ /dev/null @@ -1 +0,0 @@ - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7fca751 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,50 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "neoteroi-mkdocs" +dynamic = ["version"] +authors = [ + { name = "Roberto Prevato", email = "roberto.prevato@gmail.com" }, +] +description = "Plugins for MkDocs and Python Markdown" +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", +] +keywords = ["MkDocs", "OpenAPI", "Swagger", "Markdown", "plugins", "extensions", "documentation"] +dependencies = [ + "essentials-openapi", + "mkdocs~=1.4.0", + "httpx<1", + "click", + "Jinja2", + "rich", +] + +[tool.hatch.version] +path = "neoteroi/mkdocs/__init__.py" + +[project.urls] +"Homepage" = "https://github.com/Neoteroi/mkdocs-plugins" +"Bug Tracker" = "https://github.com/Neoteroi/mkdocs-plugins/issues" + +[project.entry-points."mkdocs.plugins"] +"neoteroi.mkdocsoad" = "neoteroi.mkdocs.oad:MkDocsOpenAPIDocumentationPlugin" +"neoteroi.contribs" = "neoteroi.mkdocs.contribs:ContribsPlugin" + +[project.entry-points."markdown.extensions"] +"neoteroi.spantable" = "neoteroi.mkdocs.spantable:SpanTableExtension" +"neoteroi.timeline" = "neoteroi.mkdocs.timeline:TimelineExtension" +"neoteroi.cards" = "neoteroi.mkdocs.cards:CardsExtension" +"neoteroi.projects" = "neoteroi.mkdocs.projects:ProjectsExtension" diff --git a/setup.py b/setup.py deleted file mode 100644 index 730ccf5..0000000 --- a/setup.py +++ /dev/null @@ -1,63 +0,0 @@ -from setuptools import setup - - -def readme(): - with open("README.md", mode="rt", encoding="utf8") as readme: - return readme.read() - - -setup( - name="neoteroi-mkdocs", - version="0.1.2", - description="Plugins for MkDocs and Python Markdown", - long_description=readme(), - long_description_content_type="text/markdown", - classifiers=[ - "Development Status :: 4 - Beta", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Operating System :: OS Independent", - ], - url="https://github.com/Neoteroi/mkdocs-plugins", - author="RobertoPrevato", - author_email="roberto.prevato@gmail.com", - keywords="MkDocs OpenAPI Swagger Markdown plugins extensions documentation", - license="MIT", - packages=[ - "neoteroi.markdown", - "neoteroi.markdown.data", - "neoteroi.markdown.tables", - "neoteroi.mkdocsoad", - "neoteroi.contribs", - "neoteroi.spantable", - "neoteroi.timeline", - "neoteroi.cards", - "neoteroi.projects", - "neoteroi.projects.gantt", - ], - install_requires=[ - "essentials-openapi", - "mkdocs~=1.4.0", - "httpx<1", - "click~=8.0.3", - "Jinja2~=3.0.2", - "rich~=12.2.0", - ], - entry_points={ - "mkdocs.plugins": [ - "neoteroi.mkdocsoad = neoteroi.mkdocsoad:MkDocsOpenAPIDocumentationPlugin", - "neoteroi.contribs = neoteroi.contribs:ContribsPlugin", - ], - "markdown.extensions": [ - "neoteroi.spantable = neoteroi.spantable:SpanTableExtension", - "neoteroi.timeline = neoteroi.timeline:TimelineExtension", - "neoteroi.cards = neoteroi.cards:CardsExtension", - "neoteroi.projects = neoteroi.projects:ProjectsExtension", - ], - }, - include_package_data=True, - zip_safe=False, -) diff --git a/tests/test_align.py b/tests/test_align.py index f9a4896..cd202c6 100644 --- a/tests/test_align.py +++ b/tests/test_align.py @@ -1,6 +1,10 @@ import pytest -from neoteroi.markdown.align import Alignment, aligment_from_props, try_parse_align +from neoteroi.mkdocs.markdown.align import ( + Alignment, + aligment_from_props, + try_parse_align, +) @pytest.mark.parametrize( diff --git a/tests/test_cards.py b/tests/test_cards.py index cf81e30..a6d447c 100644 --- a/tests/test_cards.py +++ b/tests/test_cards.py @@ -3,7 +3,7 @@ import markdown import pytest -from neoteroi.cards import BaseCardsProcessor, CardsExtension +from neoteroi.mkdocs.cards import BaseCardsProcessor, CardsExtension from tests import equal_html EXAMPLE_1 = """ diff --git a/tests/test_contribs.py b/tests/test_contribs.py index 5393478..0b47fea 100644 --- a/tests/test_contribs.py +++ b/tests/test_contribs.py @@ -4,9 +4,9 @@ from mkdocs.structure.files import File from mkdocs.structure.pages import Page -from neoteroi.contribs import ContribsPlugin -from neoteroi.contribs.domain import Contributor -from neoteroi.contribs.git import GitContributionsReader +from neoteroi.mkdocs.contribs import ContribsPlugin +from neoteroi.mkdocs.contribs.domain import Contributor +from neoteroi.mkdocs.contribs.git import GitContributionsReader @pytest.mark.parametrize( @@ -87,6 +87,8 @@ def test_contribs_plugin_success(): Lorem ipsum dolor sit amet. + +

Last modified on: 2022-10-04 21""" + """:01:05