diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..41240f8 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,33 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.6 + uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8==2.5.4 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + python setup.py lint + - name: Test with pytest + run: | + python setup.py test diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..1a03a7b --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,31 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.gitignore b/.gitignore index 8350118..8817941 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /dist /MANIFEST /venv +build/ diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 56854e8..33d5b8f 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -181,7 +181,11 @@ class MarkdownConverter(object): def convert_li(self, el, text): parent = el.parent if parent is not None and parent.name == 'ol': - bullet = '%s.' % (parent.index(el) + 1) + if parent.get("start"): + start = int(parent.get("start")) + else: + start = 1 + bullet = '%s.' % (start + parent.index(el)) else: depth = -1 while el: diff --git a/setup.py b/setup.py index 57c2edf..06ab404 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read() pkgmeta = { '__title__': 'markdownify', '__author__': 'Matthew Tretter', - '__version__': '0.5.0', + '__version__': '0.5.2', } diff --git a/tests/test_conversions.py b/tests/test_conversions.py index b8487e5..9e7be24 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -123,6 +123,7 @@ def test_i(): def test_ol(): assert md('