fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Basic biblical tools.
[librarian.git]
/
src
/
librarian
/
builders
/
epub.py
diff --git
a/src/librarian/builders/epub.py
b/src/librarian/builders/epub.py
index
8f21879
..
3ef95f4
100644
(file)
--- a/
src/librarian/builders/epub.py
+++ b/
src/librarian/builders/epub.py
@@
-4,6
+4,7
@@
from datetime import date
import io
import os
from datetime import date
import io
import os
+import re
import tempfile
from ebooklib import epub
from lxml import etree
import tempfile
from ebooklib import epub
from lxml import etree
@@
-76,13
+77,16
@@
class Builder:
class EpubBuilder(Builder):
class EpubBuilder(Builder):
+ build_method_fn = 'epub_build'
file_extension = 'epub'
isbn_field = 'isbn_epub'
orphans = True
file_extension = 'epub'
isbn_field = 'isbn_epub'
orphans = True
- def __init__(self, *args, **kwargs):
+ def __init__(self, *args,
debug=False,
**kwargs):
self.chars = set()
self.fundr = 0
self.chars = set()
self.fundr = 0
+ self.debug = debug
+ self.splits = []
super().__init__(*args, **kwargs)
def build(self, document, **kwargs):
super().__init__(*args, **kwargs)
def build(self, document, **kwargs):
@@
-707,3
+711,8
@@
class EpubBuilder(Builder):
file_name=name
)
return name
file_name=name
)
return name
+
+ def process_comment(self, comment):
+ m = re.match(r'TRIM:(\d+)', comment.text)
+ if m is not None:
+ self.splits.append(comment.sourceline - int(m.group(1)))