Skip to content

Commit

Permalink
Merge pull request #7 from sanzoghenzo/major-refactor
Browse files Browse the repository at this point in the history
Major refactor
  • Loading branch information
flywire authored Jan 28, 2023
2 parents 05ee067 + b99384c commit 6a724ba
Show file tree
Hide file tree
Showing 10 changed files with 450 additions and 309 deletions.
50 changes: 0 additions & 50 deletions .build.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build package
run: |
python setup.py sdist bdist_wheel --universal
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python package

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 setuptools wheel twine pytest pytest-cov
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=89 --statistics
- name: Test with pytest
run: |
pytest --cov
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/build/
/dist/
/venv/
/.idea/
/.coverage
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Python markdown extensions are incorporated into other applications.
MkDocs users can add *caption* to their generator process by adding it to the
`mkdocs.yml` `markdown_extensions` section:

```python
```yaml
site_name: captionTest
# theme:
# name: material
Expand All @@ -63,23 +63,34 @@ nav:
Python will parse input to Markdown with *caption* as follows:
```python
import caption
import markdown
from caption import CaptionExtension

# ...

outputString = markdown.markdown(inputString, extensions = [caption.captionExtension(numbering=false)])
outputString = markdown.markdown(
input_string, extensions=[CaptionExtension(numbering=False)]
)
```

### Options

Currently supported options are listed below:

* `captionPrefix` (default: `"Figure"`):
* `figure_caption_prefix` (default: `"Figure"`):

The text to show at the front of the caption. A final non-breaking space
is inserted between the content of `captionPrefix` and the actual figure
is inserted between the content of `table_caption_prefix` and the actual figure
number.

* `table_caption_prefix` (default: `"Table"`):

Same as `figure_caption_prefix`, but for tables.

* `listing_caption_prefix` (default: `"Listing"`):

Same as `figure_caption_prefix`, but for listings.

* `numbering` (default: `True`):

Adds a caption number like "Figure 1:" in front of the caption. It's
Expand Down
5 changes: 4 additions & 1 deletion caption/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
# Copyright (c) 2020 flywire
#
# SPDX-License-Identifier: GPL-3.0-or-later
from .caption import makeExtension, captionExtension

from .caption import makeExtension, CaptionExtension

__all__ = ['makeExtension', 'CaptionExtension']
Loading

0 comments on commit 6a724ba

Please sign in to comment.