Show More
@@ -1,30 +1,31 b'' | |||
|
1 | 1 | """Filter used to select the first preferred output format available. |
|
2 | 2 | |
|
3 | 3 | The filter contained in the file allows the converter templates to select |
|
4 | 4 | the output format that is most valuable to the active export format. The |
|
5 | 5 | value of the different formats is set via |
|
6 | 6 | GlobalConfigurable.display_data_priority |
|
7 | 7 | """ |
|
8 | 8 | #----------------------------------------------------------------------------- |
|
9 | 9 | # Copyright (c) 2013, the IPython Development Team. |
|
10 | 10 | # |
|
11 | 11 | # Distributed under the terms of the Modified BSD License. |
|
12 | 12 | # |
|
13 | 13 | # The full license is in the file COPYING.txt, distributed with this software. |
|
14 | 14 | #----------------------------------------------------------------------------- |
|
15 | 15 | |
|
16 | 16 | #----------------------------------------------------------------------------- |
|
17 | 17 | # Classes and functions |
|
18 | 18 | #----------------------------------------------------------------------------- |
|
19 | ||
|
19 | 20 | class DataTypeFilter(object): |
|
20 | 21 | """ Returns the preferred display format """ |
|
21 | 22 | |
|
22 | 23 | display_data_priority = ['html', 'pdf', 'svg', 'latex', 'png', 'jpg', 'jpeg' , 'text'] |
|
23 | 24 | |
|
24 | 25 | def __call__(self, output): |
|
25 | 26 | """ Return the first available format in the priority """ |
|
26 | 27 | |
|
27 | 28 | for fmt in self.display_data_priority: |
|
28 | 29 | if fmt in output: |
|
29 | 30 | return [fmt] |
|
30 | 31 | return [] No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now