Skip to content

Commit

Permalink
111 replace the pdf and epub with folder link (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
obar1 authored Jul 2, 2024
1 parent e99710a commit 2594cc0
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ and you have a `toc.md` for free to use as your index (bookmark it)
> as I use myself Lorenzo's great utility `safaribooks` I added some code to convert the downloaded epub contents into a related pdf and split that in chunks so I can easily use it on ipad or better remarkable for studying and later sync back in a repo for hands-on code... they call that **learning by doing** 🖖🏻
example:
![](z05502bb-4b90-422f-9624-568d9f02cd08.png)
![](z05502bb-4b90-422f-9624-568d9f02cd01.png)

### tools
> when you start to have a a few 0to100 based folders
Expand Down
12 changes: 6 additions & 6 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-r requirements.txt

black==23.7.0
pylint==2.17.5
pytest-cov==4.0.0
pytest==7.4.0
pytest-watch==4.2.0
types-PyYAML==6.0.12.12
black>=23.7.0
pylint>=2.17.5
pytest-cov>=4.0.0
pytest>=7.4.0
pytest-watch>=4.2.0
types-PyYAML>=6.0.12.12
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PyYAML==6.0
connect-markdown-renderer==3.0.0
PyMuPDF==1.23.8
PyYAML>=6.0
connect-markdown-renderer>=3.0.0
PyMuPDF>=1.23.8
Binary file added z05502bb-4b90-422f-9624-568d9f02cd01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed z05502bb-4b90-422f-9624-568d9f02cd08.png
Binary file not shown.
1 change: 1 addition & 0 deletions zero_to_one_hundred/models/meta_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
self.path_epub = f"{self.contents_path}/{self.isbn}.epub"
self.path_pdf = f"{self.contents_path}/{self.isbn}.pdf"
self.path_img = f"{self.contents_path}/{self.isbn}.png"
self.contents_path_as_md = self.path_as_md(f"./{self.isbn}/")
self.path_epub_as_md = self.path_as_md(f"./{self.isbn}/{self.isbn}.epub")
self.path_pdf_as_md = self.path_as_md(f"./{self.isbn}/{self.isbn}.pdf")
self.path_img_as_md = self.path_as_md(f"./{self.isbn}/{self.isbn}.png")
Expand Down
9 changes: 4 additions & 5 deletions zero_to_one_hundred/models/toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def flatten_meta_book(meta_book: MetaBook):
[
f'<span style="color:blue">**{meta_book.isbn}**</span>',
f"![`img`]({meta_book.path_img_as_md})",
f"[`epub`]({meta_book.path_epub_as_md})",
f"[`pdf`]({meta_book.path_pdf_as_md})",
f"[`xyz`]({meta_book.contents_path_as_md})",
f"{meta_book.metadata.asMarkDown()}",
f"{meta_book.metadata.status}",
]
Expand All @@ -66,10 +65,10 @@ def flatten_meta_book(meta_book: MetaBook):
md.append(
f"""
# TOC
## `{len(self.meta_books)}` books
## `{len(self.meta_books)}` metabook
### {self.process_fs.get_now()}
| ISBN | img | epub | pdf | `json-contents` | `status` |
|--- |--- |--- |--- |--- |--- |
| ISBN | img | `meta-contents` | `json-contents` | `status` |
|--- |--- |--- |--- |--- |
{backslash_n_char.join(flattened_meta_book)}
"""
)
Expand Down
1 change: 1 addition & 0 deletions zero_to_one_hundred/tests/test_validator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests."""

import pytest

from zero_to_one_hundred.exceptions.errors import NotURLFormatError
Expand Down
6 changes: 3 additions & 3 deletions zero_to_one_hundred/tests_sb/test_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def test_asMarkDown(get_config_map, persist_fs, process_fs, http_url, http_url2)
current = actual.asMarkDown()
expected = """
# TOC
## `0` books
## `0` metabook
### 2099/01/01 - 00:00:00
| ISBN | img | epub | pdf | `json-contents` | `status` |
|--- |--- |--- |--- |--- |--- |
| ISBN | img | `meta-contents` | `json-contents` | `status` |
|--- |--- |--- |--- |--- |
"""
assert str_relaxed("".join(current)) == str_relaxed("".join(expected))

0 comments on commit 2594cc0

Please sign in to comment.