Skip to content

Commit

Permalink
Update dependencies and fix regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ofou committed Mar 29, 2024
1 parent 77f2921 commit 215e0ae
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ venv:
@echo "🐍 Creating a safe place for a Python... "
mkdir -p essays
python3 -m venv .venv
$(VENV_ACTIVATE) && pip3 install --upgrade pip
$(VENV_ACTIVATE) && pip3 install --upgrade pip setuptools
$(VENV_ACTIVATE) && pip3 install -r requirements.txt

fetch:
Expand All @@ -49,7 +49,7 @@ pdf: epub

dependencies:
if [ "$(UNAME_S)" = "Darwin" ]; then \
$(PKG_MANAGER) install python@3.12 pandoc calibre || true; \
$(PKG_MANAGER) install python pandoc calibre || true; \
else \
sudo apt update && sudo apt install -y python3-pip python3-venv pandoc calibre; \
fi
Expand Down
6 changes: 3 additions & 3 deletions graham.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def update_links_in_md(joined):
matches = re.findall(b"\[\d+\]", joined)
matches = re.findall(r"\[\d+\]", joined)

if not matches:
return joined
Expand All @@ -48,7 +48,7 @@ def update_links(match):
counter = [0]

note_number = int(match.decode().strip("[]"))
match_regex = match.replace(b"[", b"\[").replace(b"]", b"\]")
match_regex = match.replace(b"[", b"\\[").replace(b"]", b"\\]")

joined = re.sub(match_regex, update_links, joined)

Expand All @@ -61,7 +61,7 @@ def update_links(match):

try:
with urllib.request.urlopen(URL) as website:
content = website.read().decode(r"unicode_escape", "utf-8")
content = website.read().decode("utf-8")
parsed = h.handle(content)
title = "_".join(TITLE.split(" ")).lower()
title = re.sub(r"[\W\s]+", "", title)
Expand Down
40 changes: 20 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
certifi==2022.6.15
charset-normalizer==2.1.0
cssutils==2.5.0
dateparser==1.1.1
feedparser==6.0.10
html2text==2020.1.16
htmldate==1.2.3
idna==3.3
lxml==4.8.0
python-dateutil==2.8.2
pytz==2022.1
pytz-deprecation-shim==0.1.0.post0
regex==2022.3.2
requests==2.28.1
sgmllib3k==1.0.0
six==1.16.0
tzdata==2022.1
tzlocal==4.2
Unidecode==1.3.4
urllib3==1.26.10
certifi
charset-normalizer
cssutils
dateparser
feedparser
html2text
htmldate
idna
lxml
python-dateutil
pytz
pytz-deprecation-shim
regex
requests
sgmllib3k
six
tzdata
tzlocal
Unidecode
urllib3

0 comments on commit 215e0ae

Please sign in to comment.