pdf-auto-outline 0.1.2__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pdf_auto_outline/__init__.py +1 -1
- pdf_auto_outline/main.py +15 -5
- {pdf_auto_outline-0.1.2.dist-info → pdf_auto_outline-0.1.4.dist-info}/METADATA +5 -2
- pdf_auto_outline-0.1.4.dist-info/RECORD +7 -0
- pdf_auto_outline-0.1.2.dist-info/RECORD +0 -7
- {pdf_auto_outline-0.1.2.dist-info → pdf_auto_outline-0.1.4.dist-info}/WHEEL +0 -0
- {pdf_auto_outline-0.1.2.dist-info → pdf_auto_outline-0.1.4.dist-info}/entry_points.txt +0 -0
pdf_auto_outline/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.1.
|
|
1
|
+
__version__ = '0.1.4'
|
pdf_auto_outline/main.py
CHANGED
|
@@ -154,6 +154,8 @@ def generate_txtfile(toc_entries, txtfile='outline.txt') -> str:
|
|
|
154
154
|
============================================================
|
|
155
155
|
TABLE OF CONTENTS OUTLINE
|
|
156
156
|
4spaces/lvl text | pg# | {details dictionary} OR y-coord
|
|
157
|
+
|
|
158
|
+
Type 'C' as the first character of this file to cancel
|
|
157
159
|
============================================================
|
|
158
160
|
|
|
159
161
|
""")
|
|
@@ -173,8 +175,11 @@ def generate_txtfile(toc_entries, txtfile='outline.txt') -> str:
|
|
|
173
175
|
def parse_txtfile(txtfile='outline.txt', tablevel=2) -> list:
|
|
174
176
|
toc_entries = []
|
|
175
177
|
with open(txtfile) as f:
|
|
176
|
-
if f.read(1) == '
|
|
177
|
-
|
|
178
|
+
if (c := f.read(1)) == 'C':
|
|
179
|
+
log('Outline not written')
|
|
180
|
+
exit()
|
|
181
|
+
elif c == '=':
|
|
182
|
+
lines = f.readlines()[7:]
|
|
178
183
|
else: lines = f.read()
|
|
179
184
|
|
|
180
185
|
for i in lines:
|
|
@@ -208,8 +213,13 @@ def get_toc_custom(doc) -> list:
|
|
|
208
213
|
|
|
209
214
|
def edit_txtfile(txtfile='outline.txt'):
|
|
210
215
|
# editor = os.environ.get('EDITOR', 'notepad' if os.name == 'nt' else 'vi')
|
|
211
|
-
editor = os.environ.get('EDITOR', 'start' if os.name == 'nt' else 'xdg-open')
|
|
212
|
-
|
|
216
|
+
# editor = os.environ.get('EDITOR', 'start' if os.name == 'nt' else 'xdg-open')
|
|
217
|
+
name = os.name
|
|
218
|
+
if name == 'nt':
|
|
219
|
+
subprocess.run(['start', '/WAIT', txtfile], shell=True)
|
|
220
|
+
else: # name == 'posix':
|
|
221
|
+
editor = os.environ.get('EDITOR', 'vi')
|
|
222
|
+
subprocess.run([editor, txtfile])
|
|
213
223
|
|
|
214
224
|
def main():
|
|
215
225
|
parser = argparse.ArgumentParser(prog='pdfao')
|
|
@@ -222,7 +232,7 @@ def main():
|
|
|
222
232
|
parser.add_argument('-i', '--infile', type=str, metavar='<file>', help='write toc from file to pdf')
|
|
223
233
|
parser.add_argument('-t', '--tablevel', type=int, metavar='<n>', help='tab = n toc nesting levels (default 2)', default=2)
|
|
224
234
|
parser.add_argument('--sioyek', type=str, metavar='<path>', help='for users of the Sioyek pdf viewer')
|
|
225
|
-
parser.add_argument('--version', action='version', version='%(prog)s 0.1.
|
|
235
|
+
parser.add_argument('--version', action='version', version='%(prog)s 0.1.4')
|
|
226
236
|
|
|
227
237
|
args = parser.parse_args()
|
|
228
238
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pdf-auto-outline
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Automatically generate and edit PDF table of contents / outline
|
|
5
5
|
Author: Rossikos
|
|
6
6
|
Author-email: Rossikos <216631970+rossikos@users.noreply.github.com>
|
|
@@ -45,6 +45,9 @@ options:
|
|
|
45
45
|
--version show program's version number and exit
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
> [!NOTE]
|
|
49
|
+
> Multiprocessing on Windows and MacOS is considerably slower than on Linux. Users are encouraged to test and see what works best for them.
|
|
50
|
+
|
|
48
51
|
### Examples
|
|
49
52
|
|
|
50
53
|
Generate toc and edit before saving:
|
|
@@ -66,7 +69,7 @@ Example commands; add to `prefs_user.config`.
|
|
|
66
69
|
|
|
67
70
|
```
|
|
68
71
|
new_command _gen_toc pdfao "%{file_path}" --sioyek path/to/sioyek -mp 4
|
|
69
|
-
new_command _edit_toc pdfao
|
|
72
|
+
new_command _edit_toc pdfao %{file_path}" --sioyek path/to/sioyek -e
|
|
70
73
|
```
|
|
71
74
|
|
|
72
75
|
If you don't wish to install from PyPI, download source and use `python3 -m path/to/src/pdf_auto_outline` in place of `pdfao`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pdf_auto_outline/__init__.py,sha256=aBEbDvx4LMg8A1TJJR6dEHu8rQODVin528hLS_EDvuA,22
|
|
2
|
+
pdf_auto_outline/__main__.py,sha256=mRKsAFeG5R17vTYubIKregAve4vnKc-nk7jY3tcK4wI,78
|
|
3
|
+
pdf_auto_outline/main.py,sha256=s9rVJJjzqavhAfCAmCOadcOn_C_hbaTmNGSK-WX79JY,9978
|
|
4
|
+
pdf_auto_outline-0.1.4.dist-info/WHEEL,sha256=5w2T7AS2mz1-rW9CNagNYWRCaB0iQqBMYLwKdlgiR4Q,78
|
|
5
|
+
pdf_auto_outline-0.1.4.dist-info/entry_points.txt,sha256=HBvhmxJs8hHqbbpJmVTbBH3xy19Hk655O_ySwFC_53w,100
|
|
6
|
+
pdf_auto_outline-0.1.4.dist-info/METADATA,sha256=ALWzcv1m6sCGDJ6dJyLu9i0RO8IIgNNh086z_Wx873E,2449
|
|
7
|
+
pdf_auto_outline-0.1.4.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pdf_auto_outline/__init__.py,sha256=mdp2CftfqYbdKtP-eWv1z7rAUycYv6X1ntXSMUf8Kss,22
|
|
2
|
-
pdf_auto_outline/__main__.py,sha256=mRKsAFeG5R17vTYubIKregAve4vnKc-nk7jY3tcK4wI,78
|
|
3
|
-
pdf_auto_outline/main.py,sha256=oZJMNGDBLJNGWmjGtDdNoFXsPtSS7Km7uPdwjHXPA00,9638
|
|
4
|
-
pdf_auto_outline-0.1.2.dist-info/WHEEL,sha256=5w2T7AS2mz1-rW9CNagNYWRCaB0iQqBMYLwKdlgiR4Q,78
|
|
5
|
-
pdf_auto_outline-0.1.2.dist-info/entry_points.txt,sha256=HBvhmxJs8hHqbbpJmVTbBH3xy19Hk655O_ySwFC_53w,100
|
|
6
|
-
pdf_auto_outline-0.1.2.dist-info/METADATA,sha256=GyMWMb7y2SDwvxUEEMpVpz4Fxfe3_GwGJ-sdXHxAFZg,2316
|
|
7
|
-
pdf_auto_outline-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|