Skip to content

Commit

Permalink
v1 ✨
Browse files Browse the repository at this point in the history
* Fix #27, #28

* Corrects namespace to be neoteroi.mkdocs

* Replace setup.py with pyproject.toml

* Update CHANGELOG.md
  • Loading branch information
RobertoPrevato authored Dec 20, 2022
1 parent 1971d02 commit a7a6a76
Show file tree
Hide file tree
Showing 58 changed files with 175 additions and 157 deletions.
29 changes: 9 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -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 }}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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/[email protected]
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ __*.html
__file_out.py

docs/res/contribs-new.html
dist/
17 changes: 12 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
1 change: 0 additions & 1 deletion neoteroi/contribs/py.typed

This file was deleted.

Empty file removed neoteroi/markdown/py.typed
Empty file.
1 change: 1 addition & 0 deletions neoteroi/mkdocs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 10 additions & 2 deletions neoteroi/cards/html.py → neoteroi/mkdocs/cards/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -12,6 +12,7 @@
@dataclass
class CardsViewOptions:
id: str = ""
class_name: str = ""
cols: int = 3
image_bg: bool = False

Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The markdown requires by default
neoteroi.mkdocsoad
neoteroi.mkdocs.oad
"""
import re

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion neoteroi/mkdocsoad/py.typed

This file was deleted.

Empty file removed neoteroi/projects/py.typed
Empty file.
1 change: 0 additions & 1 deletion neoteroi/spantable/py.typed

This file was deleted.

1 change: 0 additions & 1 deletion neoteroi/timeline/py.typed

This file was deleted.

Loading

0 comments on commit a7a6a76

Please sign in to comment.