@@ 156-177 (lines=22) @@ | ||
153 | self.user_js.append({ |
|
154 | 'path_url': js_path, |
|
155 | 'contents': '', |
|
156 | }) |
|
157 | elif not os.path.exists(js_path): |
|
158 | raise IOError('%s user js file not found' % (js_path,)) |
|
159 | else: |
|
160 | with codecs.open(js_path, |
|
161 | encoding=self.encoding) as js_file: |
|
162 | self.user_js.append({ |
|
163 | 'path_url': utils.get_path_url(js_path, |
|
164 | self.relative and self.destination_dir), |
|
165 | 'contents': js_file.read(), |
|
166 | }) |
|
167 | ||
168 | def add_toc_entry(self, title, level, slide_number): |
|
169 | """ Adds a new entry to current presentation Table of Contents. |
|
170 | """ |
|
171 | self.__toc.append({'title': title, 'number': slide_number, |
|
172 | 'level': level}) |
|
173 | ||
174 | @property |
|
175 | def toc(self): |
|
176 | """ Smart getter for Table of Content list. |
|
177 | """ |
|
178 | toc = [] |
|
179 | stack = [toc] |
|
180 | for entry in self.__toc: |
|
@@ 138-153 (lines=16) @@ | ||
135 | if not os.path.exists(css_path): |
|
136 | raise IOError('%s user css file not found' % (css_path,)) |
|
137 | with codecs.open(css_path, encoding=self.encoding) as css_file: |
|
138 | self.user_css.append({ |
|
139 | 'path_url': utils.get_path_url(css_path, |
|
140 | self.relative and self.destination_dir), |
|
141 | 'contents': css_file.read(), |
|
142 | }) |
|
143 | ||
144 | def add_user_js(self, js_list): |
|
145 | """ Adds supplementary user javascript files to the presentation. The |
|
146 | ``js_list`` arg can be either a ``list`` or a string. |
|
147 | """ |
|
148 | if isinstance(js_list, string_types): |
|
149 | js_list = [js_list] |
|
150 | for js_path in js_list: |
|
151 | if js_path and js_path not in self.user_js: |
|
152 | if js_path.startswith("http:"): |
|
153 | self.user_js.append({ |
|
154 | 'path_url': js_path, |
|
155 | 'contents': '', |
|
156 | }) |