pdf-auto-outline 0.1.2__py3-none-any.whl → 0.1.3__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.3.dist-info}/METADATA +1 -1
- pdf_auto_outline-0.1.3.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.3.dist-info}/WHEEL +0 -0
- {pdf_auto_outline-0.1.2.dist-info → pdf_auto_outline-0.1.3.dist-info}/entry_points.txt +0 -0
pdf_auto_outline/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.1.
|
|
1
|
+
__version__ = '0.1.3'
|
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.3')
|
|
226
236
|
|
|
227
237
|
args = parser.parse_args()
|
|
228
238
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pdf_auto_outline/__init__.py,sha256=uZsygMXMKRw-7qhWojAjnpm8GFPXU92xW6XA8O5GwFY,22
|
|
2
|
+
pdf_auto_outline/__main__.py,sha256=mRKsAFeG5R17vTYubIKregAve4vnKc-nk7jY3tcK4wI,78
|
|
3
|
+
pdf_auto_outline/main.py,sha256=nv3w9ORMKDOoQLVnxfy1IB2t6zhRDC3yuKhEUovAYQU,9978
|
|
4
|
+
pdf_auto_outline-0.1.3.dist-info/WHEEL,sha256=5w2T7AS2mz1-rW9CNagNYWRCaB0iQqBMYLwKdlgiR4Q,78
|
|
5
|
+
pdf_auto_outline-0.1.3.dist-info/entry_points.txt,sha256=HBvhmxJs8hHqbbpJmVTbBH3xy19Hk655O_ySwFC_53w,100
|
|
6
|
+
pdf_auto_outline-0.1.3.dist-info/METADATA,sha256=KANKIzlSCmMydXrlkU02hrreQNJJI-JiCFZ__hXmq1M,2316
|
|
7
|
+
pdf_auto_outline-0.1.3.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
|