bugfix
[librarian.git] / scripts / book2txt
1 #!/usr/bin/env python
2 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from librarian.book2anything import Book2Anything, Option
6 from librarian.parser import WLDocument
7
8
9 class Book2Txt(Book2Anything):
10     format_name = "TXT"
11     ext = "txt"
12     uses_cover = False
13     uses_provider = False
14     parser_options = [
15         Option('-i', '--ignore-dublin-core', dest='parse_dublincore', 
16                 action='store_false', default=True,
17                 help='don\'t try to parse dublin core metadata')
18     ]
19     transform_options = [
20         Option('-w', '--wrap', action='store', type='int', dest='wrapping', default=0,
21                 help='set line wrap column')
22     ]
23     transform_flags = [
24         Option('-r', '--raw', dest='raw-text', 
25                 action='store_true', default=False,
26                 help='Produce raw text, without any surrounding info.')
27     ]
28     transform = WLDocument.as_text
29
30
31 if __name__ == '__main__':
32     Book2Txt.run()