Package: newsworthy-slides
Installingpipinstallnewsworthy_slidesUsingThis library has one main function:slides_from_xml()which lets you generate and slides from a custom HTML structure (described below).Basic usage:fromnewsworthy_slidesimportslides_from_xmlslides_xml="""
<slide layout="Title and content">
  <placeholder type="text">
    Hello world!
  </placeholder>
</slide>
"""# Generate to new, empty presentationpres=slides_from_xml(slides_xml)# Generate to existing presentationpres=slides_from_xml(slides_xml,"path/to/my_base_slides.pptx")# pres is an instance of pptx.Presentation and can be saved easily:pres.save('my_presentation.pptx')The XML structureSlidesA slide must always have alayoutattribute referring to the name of a slide layout.<slidelayout="Title and content"></slide>A slidemayhavepositionattribute which defines where in the presentation the slide is to be added.A slide consists of a number of placeholders.<slidelayout="Title and content"><placeholdertype="text">Helloworld!</placeholder></slide>Each placeholder must have  atypeattribute, which can be eithertext,image,table. Thetypeattribute defines how the content of the tag is to be interpreted.The placeholders may also have anameattribute. This attribute should refer to a placeholder name in the slide layout.<slidelayout="Title and content"><placeholdertype="text"name="Text Placeholder 1">Hello</placeholder><placeholdertype="text"name="Text Placeholder 2">World!</placeholder></slide>If no placeholder name is defined the placeholders will be positioned in order.<slidelayout="Title and content"><placeholdertype="text">Firstplaceholder</placeholder><placeholdertype="text">Secondplaceholder</placeholder></slide>The different placeholders types are defined below.Text placeholdersText placeholders may contain plain text or basic html.<p>and<li>tags are interpreted as paragraphs.<placeholdertype="text">Helloworld!</placeholder><placeholdertype="text"><p>HelloEarth!</p><p>HelloMars!</p></placeholder><placeholdertype="text"auto-size="text-to-fit-shape"><li>HelloEarth!</li><li>HelloMars!</li><li>HelloJupiter!</li><li>HelloSaturn!</li><li>HelloUranus!</li></placeholder><strong>,<i>/<em>and<a>tags may be used for inline formating and linking.Theauto-sizeattribute may be set to autosize either the text (text-to-fit-shape) or the shape (shape-to-fit-text).<placeholdertype="text">Hello<strong>world</strong>.Consideringa<ahref="http://outer.space">Mars</a>?</placeholder>Image placeholdersAn image placeholder recognizes<img>tags and picks up the path (or url) to the image from thesrcattribute.<placeholdertype="image"vertical-alignment="top>
  <img src="path/to/image.png"></placeholder>Use attributesvertical-alignment(orva) andhorizontal-alignment(orha) for positioning.Note that the placeholder explicitly has to be either a picture or an object placeholder. This has to be set manually in Powerpoint. At the moment of writing Google Slides does not support picture placeholders (neither does Libre Office).Table placeholdersA table placeholder should contain an html table. All<tr>tags are parsed as rows.<td>and<th>tags are parsed as cells. The cells may contain same basic text formatting as paragraphs (<strong>for bold,<i>for italic etc).Cells withclass="value"are interpreted as numbers and right-aligned.<thead>and<tbody>may be present, but does not bring any meaning.<caption>is _not_ parsed.<placeholdertype="table"><table><tr><td>Country</td><td>Happiness</td></tr><tr><td>Finland</td><tdclass="value">9.5</td></tr><tr><td>Sweden</td><tdclass="value">8.5</td></tr></table></placeholder>NotesA slide may contain<notes>tag containing slide notes. The content will be parsed as text just as regular text placeholders.<notes><li>Hereisanimportantthingtokeepinmind!</<li></notes>Presentation metadataPresentation level metadata such as title, author and comments may be defined as attributes of a<presentation>tag. Available properties equals thecore properties of the pptx library.<presentationtitle="My Report"author="John Smith"created="2020-01-01"></presentation>DevelopingTo run tests:python3-mpytesttestDeploymentTo deploy a new version to PyPi:Update Changelog below.Updateversion.pyBuild:python3 setup.py sdist bdist_wheelUpload:python3 -m twine upload dist/newsworthy_slides-X.Y.X*…assuming you have Twine installed (pip install twine) and configured.Changelog1.6.0New feature: Notes1.5.0Enable alignment of images.1.4.0Enable autosizing of text.1.3.0Enable insertion of image to general purpose object placeholders.1.2.0Adds ability to parse presentation level metadata.1.1.1Bug fix: Handle negative rotation.1.1.0Makes it possible to rotate images.1.0.2Fixes ordering bug in table1.0.1Add custom exception if image is missing1.0.0First version