From cc924463ce4d28c9e7ab3830135d67f30ce36fd8 2013-06-15 03:57:08 From: damianavila Date: 2013-06-15 03:57:08 Subject: [PATCH] Added changes to understand alignment metadata for each cells. --- diff --git a/nbconvert/templates/align_reveal_cells.tpl b/nbconvert/templates/align_reveal_cells.tpl new file mode 100644 index 0000000..191add6 --- /dev/null +++ b/nbconvert/templates/align_reveal_cells.tpl @@ -0,0 +1,17 @@ +{%- extends 'reveal_cells.tpl' -%} + + + +{%- block any_cell scoped -%} +{%- if cell.metadata.align_type in ['Left'] -%} + {{ super() }} +{%- elif cell.metadata.align_type in ['center'] -%} +
+ {{ super() }} +
+{%- elif cell.metadata.align_type in ['right'] -%} +
+ {{ super() }} +
+{%- endif -%} +{%- endblock any_cell -%} diff --git a/nbconvert/templates/subslides.tpl b/nbconvert/templates/subslides.tpl index c4181db..a3c10b4 100644 --- a/nbconvert/templates/subslides.tpl +++ b/nbconvert/templates/subslides.tpl @@ -1,4 +1,4 @@ -{%- extends 'reveal_cells.tpl' -%} +{%- extends 'align_reveal_cells.tpl' -%} diff --git a/nbconvert/transformers/revealhelp.py b/nbconvert/transformers/revealhelp.py index 2bf6be8..5ec4d1c 100755 --- a/nbconvert/transformers/revealhelp.py +++ b/nbconvert/transformers/revealhelp.py @@ -38,6 +38,7 @@ class RevealHelpTransformer(ConfigurableTransformer): for i, cell in enumerate(worksheet.cells): #Make sure the cell has slideshow metadata. + cell.metadata.align_type = cell.get('metadata', {}).get('slideshow', {}).get('align_type', 'Left') cell.metadata.slide_type = cell.get('metadata', {}).get('slideshow', {}).get('slide_type', '-') #Get the slide type. If type is start of subslide or slide,