039610dec2
Use new betterhelp.
2022-02-12 19:55:26 -08:00
c23335733c
Update uses of pathclass and a few command line argparsers.
2021-12-07 12:44:22 -08:00
de7f387f48
Update calls to pathclass.glob_files.
2021-11-08 23:38:26 -08:00
2162f1d982
Use pathclass.glob.
2021-09-30 19:02:18 -07:00
d36efec25f
Use random.choices instead of random.choice in a loop.
2021-08-09 08:46:36 -07:00
edf5277b7f
Transition calls to getpermission to interactive.
2020-12-07 01:05:55 -08:00
Ethan Dalool
bb9c32cadb
Add command 'new' to create empty book file.
2020-10-28 14:50:55 -07:00
Ethan Dalool
636438ad61
Add --help to "see details on each command".
2020-10-12 22:07:24 -07:00
Ethan Dalool
113d4fa863
Fix old args.epub -> epub.
2020-09-24 23:47:29 -07:00
Ethan Dalool
281a4a5db4
Use pathclass.Path.makedirs.
2020-09-24 14:20:04 -07:00
Ethan Dalool
f845cc3065
Use pathclass.Path.open.
2020-09-20 18:26:45 -07:00
Ethan Dalool
621ced7b22
Add setfont utility.
2020-08-27 16:28:39 -07:00
Ethan Dalool
6826aa15b7
Replace calls to manifest.find with get_manifest_item.
2020-08-26 18:12:40 -07:00
Ethan Dalool
37e1cd8ce2
Let easy_add_file return the created id.
2020-08-26 18:11:55 -07:00
Ethan Dalool
b561a3233f
Fix delete_item calling get_filepath after extract from manifest.
2020-08-26 17:58:10 -07:00
Ethan Dalool
8c888353e5
Use broader selectors for get_fonts media type filter.
2020-08-26 17:08:12 -07:00
Ethan Dalool
cedd3b19d8
Add skewer-case aliases for snake_case arguments.
2020-08-12 10:23:57 -07:00
Ethan Dalool
2da8d90996
Add force_sep=/ to root_directory.
2020-06-18 09:03:18 -07:00
Ethan Dalool
6e8446e7e4
Fix Lithium behavior by removing #anchor on first header.
2020-06-18 09:02:40 -07:00
Ethan Dalool
256aeee5d5
Add epub.get_dates and add "(Year)" to the headerfile template.
2020-06-10 18:39:33 -07:00
Ethan Dalool
4f44cd642f
Use betterhelp easy mains to get parser off the global.
2020-03-10 22:41:09 -07:00
Ethan Dalool
d928b950ac
Add a few metadata methods, just proof-of-concept for now.
...
I know I don't want to create a full-blown metadata editor, but
a couple methods for basic metadata types and simple adds/removes
could be useful.
2020-03-07 16:37:39 -08:00
Ethan Dalool
a68a69ab99
Improve some docstrings and comments.
2020-03-07 16:36:32 -08:00
Ethan Dalool
88fb94e84e
Remove Epub.open, use Epub('path'); support read-only mode.
...
Instead of Epub.open('path'), now use Epub('path'). This makes the
class more intuitive to use. This also removes the need for the
_original_epub_filepath argument which was simply awkward.
We now support read-only books with the read_only argument. The main
benefit is that we don't need to unzip the epub file, so if you are
going to be reading from epubs but don't need to write, setting
read_only can significately improve speed.
2020-03-07 16:22:38 -08:00
Ethan Dalool
6c63444d27
Use voussoirkit.getpermission.
2020-03-07 13:52:29 -08:00
Ethan Dalool
a73dbba387
Use enumerate(start=1) instead of index += 1.
2020-03-07 13:50:39 -08:00
Ethan Dalool
b99eecf8c5
main should return args.func(args) value.
2020-02-08 16:19:58 -08:00
Ethan Dalool
f17b46d88e
Add missing exec summary to main docstring.
2020-02-07 15:11:18 -08:00
Ethan Dalool
c56e0ec13e
Fix toc from climbing too high when going from h2 to h4 to h2 etc.
...
Can you believe there was a bug amidst all these wonderful comments?
The code previously assumed that climbing .parent corresponded to
climbing from hX to hX-1, but this wasn't true when the headers
themselves skipped a level. After creating some toc for h2 then h4,
then encountering a new h2, it would try to climb back two levels to
go from 4 to 2, but actually there was only ever one level between them.
2020-02-04 16:40:14 -08:00
Ethan Dalool
92d595c00d
Clarify this comment why the two .parent climbs are separate.
2020-02-04 00:18:25 -08:00
Ethan Dalool
38f432fe6e
Improve comments in generate_toc.
2020-02-03 23:12:36 -08:00
Ethan Dalool
81fe7cd47b
Use enumerate instead of manual counting, now that headers is exact.
2020-02-03 23:11:22 -08:00
Ethan Dalool
3cfb8030a7
Create a regex pattern for exactly needed headers, no postfiltering.
2020-02-03 23:07:02 -08:00
Ethan Dalool
3e254bddf1
Search for header elements directly instead of scanning descendants.
2020-02-03 22:45:20 -08:00
Ethan Dalool
edbd1e9996
Apply new pathclass.Extension with_dot.
2020-02-02 19:38:24 -08:00
Ethan Dalool
dfb3e9e6ed
Split this line up for length reasons.
2020-02-02 19:36:57 -08:00
Ethan Dalool
dcfb2edf85
Add helptext for merge --demote_headers.
2020-02-02 19:36:16 -08:00
Ethan Dalool
30ae76367f
Simplify move_nav_to_end by calling spine.index.
2020-02-02 19:35:46 -08:00
Ethan Dalool
7afb9fcb7a
Use betterhelp to manage docstrings.
2020-01-30 23:41:42 -08:00
Ethan Dalool
f6ab58eb78
Add these ### headers above the helper functions.
...
I'm trying to decide if I should create function classes to hold
these things, but for now these headers will do.
2020-01-20 17:56:21 -08:00
Ethan Dalool
9411e8cf80
Add function promote_xhtml_headers.
...
Isn't used anywhere yet but may as well have it to balance out.
2020-01-20 17:55:49 -08:00
Ethan Dalool
59776e5b4e
Delete unused MIMETYPE_CONTENT, dupe of MIMETYPE_FILE_TEMPLATE.
2020-01-20 17:43:30 -08:00
Ethan Dalool
1f1b36b173
Assign opf, opf_filepath normally instead of mutating in method.
2020-01-20 17:34:51 -08:00
Ethan Dalool
6386f25cd4
Rearrange the lines in delete_file.
...
If anything is going to raise an exception here I expect it to be
the item missing from the manifest. In which case let's get that out
of the way early and only delete from disk at the very end.
2020-01-20 17:33:58 -08:00
Ethan Dalool
fd73ecfe2e
Add, improve some comments, docstrings, exception texts.
2020-01-20 17:32:47 -08:00
Ethan Dalool
973731f797
Add argument demote_headers to merge.
2020-01-20 17:10:22 -08:00
Ethan Dalool
324689ea3c
Replace glob with winglob.
2020-01-20 17:06:27 -08:00
Ethan Dalool
73d88e12ce
Move covercomesfirst's save line back to the argparse func.
...
Because args doesn't exist in the other function. oops.
2020-01-02 20:13:09 -08:00
Ethan Dalool
96650c2886
During opf normalize, ensure ncx mimetype is correct.
2020-01-02 20:12:08 -08:00
Ethan Dalool
636b936539
Add argument number_headerfile to get index in the h1.
2019-12-30 13:53:12 -08:00