diff --git a/Makefile b/Makefile index a305782..a962058 100644 --- a/Makefile +++ b/Makefile @@ -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: @@ -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 diff --git a/graham.py b/graham.py index e5b9379..521ca38 100755 --- a/graham.py +++ b/graham.py @@ -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 @@ -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) @@ -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) diff --git a/requirements.txt b/requirements.txt index 0bac701..36e4aa7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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