OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 | 2 |
3 import lilylib as ly | 3 import lilylib as ly |
4 import book_snippets as BookSnippet | 4 import book_snippets as BookSnippet |
5 from book_snippets import * | 5 from book_snippets import * |
6 import re | 6 import re |
7 global _;_=ly._ | 7 global _;_=ly._ |
8 | 8 |
9 progress = ly.progress | 9 progress = ly.progress |
10 warning = ly.warning | 10 warning = ly.warning |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 self.output = {} | 91 self.output = {} |
92 self.handled_extensions = [] | 92 self.handled_extensions = [] |
93 self.image_formats = "ps,png" | 93 self.image_formats = "ps,png" |
94 self.global_options = {} | 94 self.global_options = {} |
95 self.document_language = '' | 95 self.document_language = '' |
96 self.default_snippet_options = default_snippet_opts | 96 self.default_snippet_options = default_snippet_opts |
97 self.snippet_option_separator = "\s*,\s*" | 97 self.snippet_option_separator = "\s*,\s*" |
98 | 98 |
99 def supported_snippet_types (self): | 99 def supported_snippet_types (self): |
100 # Sort according to snippet_type_order, unknown keys come last | 100 # Sort according to snippet_type_order, unknown keys come last |
101 keys = self.snippet_res.keys () | 101 keys = list(self.snippet_res.keys ()) |
102 # First the entries in snippet_type_order in that order (if present) | 102 # First the entries in snippet_type_order in that order (if present) |
103 # then all entries not in snippet_type_order in given order | 103 # then all entries not in snippet_type_order in given order |
104 res = filter (lambda x:x in keys, snippet_type_order) + filter (lambda x
:x not in snippet_type_order, keys) | 104 res = [x for x in snippet_type_order if x in keys] + [x for x in keys if
x not in snippet_type_order] |
105 return res | 105 return res |
106 | 106 |
107 def snippet_regexp (self, snippettype): | 107 def snippet_regexp (self, snippettype): |
108 return self.snippet_res.get (snippettype, None) | 108 return self.snippet_res.get (snippettype, None) |
109 | 109 |
110 def can_handle_format (self, format): | 110 def can_handle_format (self, format): |
111 return format == self.format | 111 return format == self.format |
112 def can_handle_extension (self, extension): | 112 def can_handle_extension (self, extension): |
113 return extension in self.handled_extensions | 113 return extension in self.handled_extensions |
114 | 114 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 # UGH - junk global_options | 188 # UGH - junk global_options |
189 res = [] | 189 res = [] |
190 if (base + '.eps' in required_files and not snippet.global_options.skip_
png_check): | 190 if (base + '.eps' in required_files and not snippet.global_options.skip_
png_check): |
191 page_count = BookSnippet.ps_page_count (full + '.eps') | 191 page_count = BookSnippet.ps_page_count (full + '.eps') |
192 if page_count <= 1: | 192 if page_count <= 1: |
193 res.append (base + '.png') | 193 res.append (base + '.png') |
194 else: | 194 else: |
195 for page in range (1, page_count + 1): | 195 for page in range (1, page_count + 1): |
196 res.append (base + '-page%d.png' % page) | 196 res.append (base + '-page%d.png' % page) |
197 return res | 197 return res |
OLD | NEW |