Page MenuHomec4science

pptx2slides
No OneTemporary

File Metadata

Created
Tue, Jun 3, 09:38

pptx2slides

#!/bin/env python
################################################################
import argparse
from pptx import Presentation
################################################################
def main():
parser = argparse.ArgumentParser(
description='Convert pptx to Jupyter notebook')
parser.add_argument("filename", nargs='*',
help="The pptx file to convert into notebooks")
args = parser.parse_args()
prs = Presentation(args.filename)
# prs.save('new-file-name.pptx')
################################################################
if __name__ == "__main__":
main()
# import sys
# import nbformat
# from PythonLatex.latex_structure import LatexStructure
# from PythonLatex.latex_structure import LatexEnvironment
#
# filename_in = sys.argv[1]
# filename_out = sys.argv[2]
#
# tex_struct = LatexStructure()
# tex_struct.parseLatexFile(filename_in)
# print(str(tex_struct))
#
# nb = nbformat.notebooknode.NotebookNode({
# u'nbformat_minor': 2,
# u'cells': [],
# u'nbformat': 4,
# u'metadata': {u'kernelspec': {u'display_name': u'Python 2',
# u'name': u'python2',
# u'language': u'python'},
#
# u'toc': {u'nav_menu': {u'width': u'252px',
# u'height': u'12px'},
# u'toc_window_display': False,
# u'widenNotebook': False,
# u'toc_section_display': u'block',
# u'colors': {u'hover_highlight': u'#DAA520',
# u'running_highlight': u'#FF0000',
# u'selected_highlight': u'#FFD700'},
# u'navigate_menu': True,
# u'number_sections': True,
# u'threshold': 4,
# u'moveMenuLeft': True,
# u'sideBar': True,
# u'toc_cell': False},
# u'hide_input': False,
# u'language_info': {u'mimetype': u'text/x-python',
# u'nbconvert_exporter': u'python',
# u'version': u'2.7.13',
# u'name': u'python',
# u'file_extension': u'.py',
# u'pygments_lexer': u'ipython2',
# u'codemirror_mode': {
# u'version': 2,
# u'name': u'ipython'}}}})
#
# nb['cells'] = []
#################################################################
#
#
# def createNewCell():
# print('create new cell')
# new_cell = nbformat.notebooknode.NotebookNode()
# new_cell['cell_type'] = 'markdown'
# new_cell['source'] = ''
# new_cell['metadata'] = {}
# nb['cells'].append(new_cell)
# return new_cell
#################################################################
#
#
# current_cell = None
#
# for c in tex_struct.content:
# if current_cell is None:
# current_cell = createNewCell()
# if isinstance(c, LatexEnvironment):
# current_cell = createNewCell()
# print('AAA:', type(c), str(c))
#
# print('adding:', type(c), str(c))
# current_cell['source'] += str(c)
#
# print(nb)
# print(type(nb))
# nbformat.write(nb, 'test.ipynb')

Event Timeline