X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/2903250a90904488ff3de04ecbbf2b6b5c421839..5adcf1231e8d4a4131bd09798f4dd296bd430081:/lib/librarian/bin/book2txt.py
diff --git a/lib/librarian/bin/book2txt.py b/lib/librarian/bin/book2txt.py
index 86f6f1274..1ca4623fd 100755
--- a/lib/librarian/bin/book2txt.py
+++ b/lib/librarian/bin/book2txt.py
@@ -1,25 +1,8 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import re
import os
import optparse
-import codecs
-
-REGEXES = [
- (r'
(.|\n)*?
', ''), - (r'<[^>]+>', ''), - (r'/$', ''), - (r'---', u'â'), - (r'--', u'-'), - (r',,', u'â'), - (r'"', u'â'), -] +from librarian import text if __name__ == '__main__': @@ -44,13 +27,5 @@ if __name__ == '__main__': print input_filename output_filename = os.path.splitext(input_filename)[0] + '.txt' - - xml = codecs.open(input_filename, 'r', encoding='utf-8').read() - for pattern, repl in REGEXES: - # print pattern, repl - xml, n = re.subn(pattern, repl, xml) - # print n - - output = codecs.open(output_filename, 'w', encoding='utf-8') - output.write(xml) + text.transform(input_filename, output_filename)