Skip to content

Commit 2083943

Browse files
Fix the mermaid graph on PyPI (GH-19)
2 parents e7f6c69 + fde181a commit 2083943

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ jobs:
2424
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2525
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2626
run: |
27+
python prepublish.py
2728
python setup.py sdist bdist_wheel
2829
twine upload dist/*

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
branches: [ master, tests ]
7+
branches: [ master ]
88

99
jobs:
1010
test:

fuzzymap/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1818

1919
__all__ = ('FuzzyMap',)
20-
__version__ = '1.1.0'
20+
__version__ = '1.1.1'

prepublish.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import re
2+
3+
if __name__ == "__main__":
4+
mermaid_snippet_pattern = r"^```mermaid[\s\S]+?```"
5+
mermaid_snippet_svg_url = (
6+
# Initially was uploaded to GitHub
7+
"https://user-images.githubusercontent.com/44609997/"
8+
"205437148-4fb3d7bd-1fe9-4ce8-8321-d7aef9488e37.svg"
9+
)
10+
html_replacement = "<p align=\"center\"><img src=\"%s\" height=\"400\" /></p>" % mermaid_snippet_svg_url
11+
with open("README.md", "r") as fp:
12+
readme = fp.read()
13+
readme = re.sub(mermaid_snippet_pattern, html_replacement, readme, flags=re.M)
14+
15+
with open("README.md", "w") as fp:
16+
fp.write(readme)

0 commit comments

Comments
 (0)