1717WIDTH = 1000.0
1818
1919CODEPANE_THEMES = ['tomorrow' , 'tomorrowNight' ]
20- VALID_STYLE_KEYS = ['fontFamily' , 'fontSize' , 'margin' , 'position' ,
21- 'textAlign' , 'opacity' , 'color' , 'fontStyle' ,
22- 'fontWeight' , 'lineHeight' , 'minWidth' , 'textDecoration' ,
23- 'wordBreak' ]
24- VALID_PROPS_KEYS = ['theme' , 'listType' , 'href' ]
25- NEEDED_STYLE_KEYS = ['left' , 'top' , 'height' , 'width' ]
20+
2621VALID_LANGUAGES = ['cpp' , 'cs' , 'css' , 'fsharp' , 'go' , 'haskell' , 'java' ,
2722 'javascript' , 'jsx' , 'julia' , 'xml' , 'matlab' , 'php' ,
2823 'python' , 'r' , 'ruby' , 'scala' , 'sql' , 'yaml' ]
29- VALID_CLASS_STYLES = ['pictureleft' , 'pictureright' , 'picturemiddle' ,
30- 'pictureleft_tiled' , 'pictureright_tiled' ]
31-
32- VALID_SLIDE_PROPS = ['class' , 'transition' , 'background-image' ,
33- 'background-position' , 'background-repeat' ,
34- 'background-size' , 'background_color' ]
3524
3625VALID_TRANSITIONS = ['slide' , 'zoom' , 'fade' , 'spin' ]
3726
@@ -176,40 +165,21 @@ def _box(boxtype, text_or_url, left, top, height, width, id, props_attr,
176165 if boxtype == 'Text' :
177166 children_list = text_or_url .split ('\n ' )
178167
179- #props = {
180- # 'isQuote': False,
181- # 'listType': None,
182- # 'paragraphStyle': paragraphStyle,
183- # 'size': 4,
184- # 'style': copy.deepcopy(paragraph_styles[paragraphStyle])
185- # #'style': paragraph_styles[paragraphStyle]
186- #}
187-
188- #props['style'].update(
189- # {'height': height,
190- # 'left': left,
191- # 'top': top,
192- # 'width': width}
193- #)
194-
195- props = {'isQuote' : False ,
196- 'listType' : None ,
197- 'paragraphStyle' : 'Heading 1' ,
198- 'size' : 4 ,
199- 'style' : {'color' : '#3d3d3d' ,
200- 'fontFamily' : 'Open Sans' ,
201- 'fontSize' : 26 ,
202- 'fontStyle' : 'normal' ,
203- 'fontWeight' : 400 ,
204- 'height' : height ,
205- 'left' : left ,
206- 'lineHeight' : 'normal' ,
207- 'minWidth' : 20 ,
208- 'opacity' : 1 ,
209- 'textAlign' : 'center' ,
210- 'textDecoration' : 'none' ,
211- 'top' : top ,
212- 'width' : width }}
168+ props = {
169+ 'isQuote' : False ,
170+ 'listType' : None ,
171+ 'paragraphStyle' : paragraphStyle ,
172+ 'size' : 4 ,
173+ 'style' : copy .deepcopy (paragraph_styles [paragraphStyle ])
174+ }
175+
176+ props ['style' ].update (
177+ {'height' : height ,
178+ 'left' : left ,
179+ 'top' : top ,
180+ 'width' : width ,
181+ 'position' : 'absolute' }
182+ )
213183
214184 elif boxtype == 'Image' :
215185 props = {
@@ -268,10 +238,10 @@ def _box(boxtype, text_or_url, left, top, height, width, id, props_attr,
268238 'type' : boxtype
269239 }
270240
271- # if boxtype == 'Text':
272- # child['defaultHeight'] = 36
273- # child['defaultWidth'] = 52
274- # child['resizeVertical'] = False
241+ if boxtype == 'Text' :
242+ child ['defaultHeight' ] = 36
243+ child ['defaultWidth' ] = 52
244+ child ['resizeVertical' ] = False
275245 if boxtype == 'CodePane' :
276246 child ['defaultText' ] = 'Code'
277247
@@ -613,7 +583,30 @@ def _return_layout_specs(num_of_boxes, url_lines, title_lines, text_block,
613583 margin = 18
614584 code_theme = 'tomorrowNight'
615585
616- # fill back
586+ # set Headings styles
587+ paragraph_styles ['Heading 1' ].update (
588+ {'color' : '#000016' ,
589+ 'fontFamily' : 'Roboto' ,
590+ 'fontSize' : 55 ,
591+ 'fontWeight' : fontWeight_dict ['Black' ]['fontWeight' ]}
592+ )
593+
594+ paragraph_styles ['Heading 2' ] = copy .deepcopy (
595+ paragraph_styles ['Heading 1' ]
596+ )
597+ paragraph_styles ['Heading 2' ].update ({'fontSize' : 36 })
598+ paragraph_styles ['Heading 3' ] = copy .deepcopy (
599+ paragraph_styles ['Heading 1' ]
600+ )
601+ paragraph_styles ['Heading 3' ].update ({'fontSize' : 30 })
602+
603+ # set Body style
604+ paragraph_styles ['Body' ].update (
605+ {'color' : '#000016' ,
606+ 'fontFamily' : 'Roboto' ,
607+ 'fontSize' : 16 ,
608+ 'fontWeight' : fontWeight_dict ['Thin' ]['fontWeight' ]}
609+ )
617610
618611 bkgd_color = '#FFFFFF'
619612 title_font_color = None
@@ -996,8 +989,6 @@ def _markdown_to_presentation(self, markdown_string, style, imgStretch):
996989 code_theme ) = _return_layout_specs (num_of_boxes , url_lines ,
997990 title_lines , text_block , code_blocks , slide_num , style )
998991
999- print specs_for_title
1000-
1001992 # background color
1002993 self ._color_background (bkgd_color , slide_num )
1003994
@@ -1011,13 +1002,12 @@ def _markdown_to_presentation(self, markdown_string, style, imgStretch):
10111002 num_hashes += 1
10121003 title = _remove_extra_whitespace_from_line (title )
10131004
1014- print specs_for_title
10151005 self ._insert (
10161006 box = 'Text' , text_or_url = title ,
10171007 left = specs_for_title [0 ], top = specs_for_title [1 ],
10181008 height = specs_for_title [2 ], width = specs_for_title [3 ],
1019- slide = slide_num , # style_attr=title_style_attr,
1020- paragraphStyle = 'Heading {} ' .format (
1009+ slide = slide_num , style_attr = title_style_attr ,
1010+ paragraphStyle = 'Heading 1 ' .format (
10211011 min (num_hashes , 3 )
10221012 )
10231013 )
0 commit comments