Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for non-separated books

  • Loading branch information...
commit fc95b7b3f46b731f36974f001e014cd5e3067bd0 1 parent 3794347
@palfrey authored
Showing with 16 additions and 2 deletions.
  1. +16 −2 books.py
View
18 books.py
@@ -43,18 +43,32 @@
series = [series[k] for k in args]
+def infiniteRange():
+ i = 1
+ while True:
+ yield i
+ i +=1
+
for s in series:
print s
page = s.startPage
index = 1
while page!=None:
- folder = "%s #%02d"%(s.description, index)
+ if opts.count == -1:
+ folder = s.description
+ else:
+ folder = "%s #%02d"%(s.description, index)
toc = tocStart(folder)
titlePattern = compile(s.titlePattern, DOTALL | MULTILINE)
contentPattern = compile(s.contentPattern, DOTALL | MULTILINE)
nextPattern = compile(s.nextPattern, DOTALL | MULTILINE)
newitems = False
- for x in range(opts.count):
+ if opts.count == -1:
+ items = infiniteRange()
+ else:
+ items = range(opts.count)
+
+ for x in items:
print "generating", page
age = -1
while True:
Please sign in to comment.
Something went wrong with that request. Please try again.