Skip to content

Commit a7a6a76

Browse files
v1 ✨
* Fix #27, #28 * Corrects namespace to be neoteroi.mkdocs * Replace setup.py with pyproject.toml * Update CHANGELOG.md
1 parent 1971d02 commit a7a6a76

58 files changed

Lines changed: 175 additions & 157 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616

1717
jobs:
1818
build:
19-
runs-on: ubuntu-18.04
19+
runs-on: ubuntu-latest
2020
strategy:
2121
fail-fast: false
2222
matrix:
@@ -47,7 +47,7 @@ jobs:
4747
if: matrix.python-version == '3.10'
4848

4949
- name: Use Python ${{ matrix.python-version }}
50-
uses: actions/setup-python@v1
50+
uses: actions/setup-python@v3
5151
with:
5252
python-version: ${{ matrix.python-version }}
5353

@@ -96,29 +96,29 @@ jobs:
9696
bash <(curl -s https://codecov.io/bash)
9797
9898
- name: Install distribution dependencies
99-
run: pip install --upgrade twine setuptools wheel
99+
run: pip install build
100100
if: matrix.python-version == '3.10'
101101

102102
- name: Create distribution package
103-
run: python setup.py sdist bdist_wheel
103+
run: python -m build
104104
if: matrix.python-version == '3.10'
105105

106106
- name: Upload distribution package
107107
uses: actions/upload-artifact@master
108108
with:
109-
name: dist-package-${{ matrix.python-version }}
109+
name: dist
110110
path: dist
111111
if: matrix.python-version == '3.10'
112112

113113
publish:
114-
runs-on: ubuntu-18.04
114+
runs-on: ubuntu-latest
115115
needs: build
116116
if: github.event_name == 'release'
117117
steps:
118118
- name: Download the distribution package
119119
uses: actions/download-artifact@v2
120120
with:
121-
name: dist-package-3.10
121+
name: dist
122122
path: dist
123123

124124
- name: Publish distribution 📦 to Test PyPI
@@ -148,17 +148,6 @@ jobs:
148148
with:
149149
upload_url: ${{ github.event.release.upload_url }}
150150
asset_path: ./dist-css/neoteroi-mkdocs.css
151-
asset_name: css-${{ github.event.release.tag_name }}.zip
152-
asset_content_type: application/zip
153-
continue-on-error: true
154-
155-
- name: Add CSS package to the release
156-
uses: actions/upload-release-asset@v1.0.1
157-
env:
158-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159-
with:
160-
upload_url: ${{ github.event.release.upload_url }}
161-
asset_path: ./dist-css/neoteroi-mkdocs.min.css
162-
asset_name: css-${{ github.event.release.tag_name }}.zip
163-
asset_content_type: application/zip
151+
asset_name: css-${{ github.event.release.tag_name }}.css
152+
asset_content_type: text/css
164153
continue-on-error: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ __*.html
1313
__file_out.py
1414

1515
docs/res/contribs-new.html
16+
dist/

CHANGELOG.md

Lines changed: 12 additions & 5 deletions

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
.PHONY: release test annotate
22

33

4-
artifacts: test
5-
python setup.py sdist
4+
artifacts: test build
65

76

87
prepforbuild:
9-
pip install --upgrade twine setuptools wheel
8+
pip install build
109

1110

12-
testrelease:
13-
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
11+
build:
12+
python -m build
1413

1514

16-
release: artifacts
17-
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
15+
test-release:
16+
twine upload --repository testpypi dist/*
17+
18+
19+
release:
20+
twine upload --repository pypi dist/*
1821

1922

2023
test:

neoteroi/contribs/py.typed

Lines changed: 0 additions & 1 deletion
This file was deleted.

neoteroi/markdown/py.typed

Whitespace-only changes.

neoteroi/mkdocs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "1.0.0"
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
"""
99
from markdown import Extension
1010

11-
from neoteroi.markdown.images import Image
12-
from neoteroi.markdown.processors import EmbeddedBlockProcessor, SourceBlockProcessor
13-
from neoteroi.markdown.utils import create_instance, create_instances
11+
from neoteroi.mkdocs.markdown.images import Image
12+
from neoteroi.mkdocs.markdown.processors import (
13+
EmbeddedBlockProcessor,
14+
SourceBlockProcessor,
15+
)
16+
from neoteroi.mkdocs.markdown.utils import create_instance, create_instances
1417

1518
from .domain import CardItem, Cards
1619
from .html import CardsHTMLBuilder, CardsViewOptions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22
from typing import List, Optional
33

4-
from neoteroi.markdown.images import Image
4+
from neoteroi.mkdocs.markdown.images import Image
55

66

77
@dataclass
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import xml.etree.ElementTree as etree
33
from dataclasses import dataclass
44

5-
from neoteroi.markdown.images import build_image_html
5+
from neoteroi.mkdocs.markdown.images import build_image_html
66

77
from .domain import CardItem, Cards
88

@@ -12,6 +12,7 @@
1212
@dataclass
1313
class CardsViewOptions:
1414
id: str = ""
15+
class_name: str = ""
1516
cols: int = 3
1617
image_bg: bool = False
1718

@@ -36,9 +37,16 @@ def get_item_props(self, item: CardItem):
3637

3738
return item_props
3839

40+
def _get_root_class(self):
41+
base_class = f"nt-cards nt-grid cols-{self.options.cols}"
42+
43+
if self.options.class_name:
44+
return base_class + " " + self.options.class_name
45+
return base_class
46+
3947
def build_html(self, parent, cards: Cards):
4048
root_element = etree.SubElement(
41-
parent, "div", {"class": f"nt-cards nt-grid cols-{self.options.cols}"}
49+
parent, "div", {"class": self._get_root_class()}
4250
)
4351

4452
for item in cards.items:

0 commit comments

Comments
 (0)