Skip to content

Commit

Permalink
v4.3.3 Card Audio & Poster Image
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPacker committed Jan 20, 2024
1 parent 574a732 commit 8ce1b75
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 56 deletions.
10 changes: 6 additions & 4 deletions card.py
Expand Up @@ -19,12 +19,14 @@ def __init__(
self.graphicShape = None
self.graphicDimensions = None
self.graphicTitle = None

self.printableFilename = None

self.videoInfo = None
self.videoDimensions = None
self.videoShape = None

# Both audio and video
self.mediaInfo = None
self.mediaDimensions = None
self.mediaShape = None

self.mediaURL = None

self.backgroundShape = None
Expand Down
27 changes: 19 additions & 8 deletions docs/user-guide.html
Expand Up @@ -1124,7 +1124,7 @@ <h3 id="table-of-contents">Table Of Contents<a class="headerlink" href="#table-o
</li>
<li><a href="#card-slides">Card Slides</a><ul>
<li><a href="#card-titles">Card Titles</a></li>
<li><a href="#card-graphics-&amp;-video">Card Graphics &amp; Video</a></li>
<li><a href="#card-graphics-video-&amp;-audio">Card Graphics, Video, &amp; Audio</a></li>
</ul>
</li>
<li><a href="#code-slides">Code Slides</a><ul>
Expand Down Expand Up @@ -1484,9 +1484,14 @@ <h2 id="change-log">Change Log<a class="headerlink" href="#change-log" title="Pe
</thead>
<tbody>
<tr>
<td align="left">4.3.3</td>
<td align="right">20&nbsp;January&nbsp;2024</td>
<td align="left">Cards can now have audio where a graphic might be. Also media can have a &ldquo;poster&rdquo; image for when the media isn&rsquo;t playing. See <a href="#card-graphics-video-audio">Card Graphics&comma; Video&comma; &amp; Audio</a>.</td>
</tr>
<tr>
<td align="left">4.3.2</td>
<td align="right">17&nbsp;January&nbsp;2024</td>
<td align="left">Cards can now have a video where a graphic might be.</td>
<td align="left">Cards can now have a video where a graphic might be. See <a href="#card-graphics-video-audio">Card Graphics&comma; Video&comma; &amp; Audio</a>.</td>
</tr>
<tr>
<td align="left">4.3.1</td>
Expand All @@ -1496,7 +1501,7 @@ <h2 id="change-log">Change Log<a class="headerlink" href="#change-log" title="Pe
<tr>
<td align="left">4.3</td>
<td align="right">3&nbsp;January&nbsp;2024</td>
<td align="left">Added <a href="#card-graphics-&amp;-video">card graphics</a> support and <a href="#card-graphic-positioning-cardgraphicposition"><code>CardGraphicPosition</code></a>&comma; <a href="#card-graphic-size-cardgraphicsize"><code>CardGraphicSize</code></a>&comma; and <a href="#card-graphic-padding-cardgraphicpadding"><code>CardGraphicPadding</code></a>.</td>
<td align="left">Added <a href="#card-graphics-video-audio">card graphics</a> support and <a href="#card-graphic-positioning-cardgraphicposition"><code>CardGraphicPosition</code></a>&comma; <a href="#card-graphic-size-cardgraphicsize"><code>CardGraphicSize</code></a>&comma; and <a href="#card-graphic-padding-cardgraphicpadding"><code>CardGraphicPadding</code></a>.</td>
</tr>
<tr>
<td align="left">4.2.1</td>
Expand Down Expand Up @@ -2124,6 +2129,7 @@ <h5 id="graphics-file-references">Graphics File References<a class="headerlink"
<h4 id="video-and-audio-slides">Video And Audio Slides<a class="headerlink" href="#video-and-audio-slides" title="Permanent link"></a></h4>
<p><a id="video-and-audio-slides"></a></p>
<p>Videos and audio files are supported in a similar way to <a href="#graphics-slides">graphics slides</a>. However, there is no Markdown support for embedding videos or audio files. Fortunately, Markdown processors support HTML.</p>
<p>You should be aware that, though you can legitimately embed a video or audio, Powerpoint might not be able to play it on all platforms.</p>
<h5 id="video-slides">Video Slides<a class="headerlink" href="#video-slides" title="Permanent link"></a></h5>
<p><a id="video-slides"></a></p>
<p>md2pptx supports embedding videos using the HTML <code>&lt;video&gt;</code> element.</p>
Expand Down Expand Up @@ -2309,10 +2315,10 @@ <h4 id="card-titles">Card Titles<a class="headerlink" href="#card-titles" title=
</code></pre>
<p>(See <a href="#card-title-position-cardtitleposition">Card Title Position</a> for more information.)</p>
<p>You can suppress a title by coding its text value to <code>&amp;nbsp;</code>. If you do this for all the titles on a card slide the space reserved for card titles will be zero. If there are some titles not treated this way the <code>&amp;nbsp;</code>-titled cards will have a gap where the title would have been.</p>
<p><a id="card-graphics-&-video"></a></p>
<h4 id="card-graphics-video">Card Graphics &amp; Video<a class="headerlink" href="#card-graphics-video" title="Permanent link"></a></h4>
<p>You can add a graphic or a video to a card. They can be placed in reserved areas before or after the card bulleted list contents.</p>
<p>Place any graphic or video declaration between the card&rsquo;s title and the card&rsquo;s contents. For example:</p>
<p><a id="#card-graphics-video-audio"></a></p>
<h4 id="card-graphics-video-audio">Card Graphics, Video, &amp; Audio<a class="headerlink" href="#card-graphics-video-audio" title="Permanent link"></a></h4>
<p>You can add a single graphic, video, or audio file to each card. They can be placed in reserved areas before or after the card bulleted list contents.</p>
<p>Place any graphic, video, or audio declaration between the card&rsquo;s title and the card&rsquo;s contents. For example:</p>
<pre><code>#### Card One

![](block.png)
Expand All @@ -2323,11 +2329,16 @@ <h4 id="card-graphics-video">Card Graphics &amp; Video<a class="headerlink" href
<p>As you can see, the image reference is just a standard Markdown one. A video reference might be of the form:</p>
<pre><code>&lt;video height=300 width=400 src="waterdrop.mp4"&gt;&lt;/video&gt;
</code></pre>
<p>An audio reference might be of the form:</p>
<pre><code>&lt;audio src="audiotest.mp3" poster="Battery W2M.png"&gt;&lt;/audio&gt;
</code></pre>
<p>In this case the <code>poster</code> attribute is coded. This enables a graphic to be shown when the audio player isn&rsquo;t activated. You can also code the <code>poster</code> attribute for a video.</p>
<p><strong>Notes:</strong></p>
<ol>
<li>You must code a non-zero value for <a href="#card-graphic-size-cardgraphicsize"><code>CardGraphicSize</code></a> for graphics or videos to be shown. The default is 0.</li>
<li>If a card doesn&rsquo;t have a graphic or a video the bulleted list contents can fill the whole of the card (except for any title inside the card).</li>
<li>Card graphics can have tooltips and can be clickable. See <a href="#graphics-slides">Graphics Slides</a> for how to code this.</li>
<li>Card graphics can have tooltips and can be clickable. See <a href="#graphics-slides">Graphics Slides</a> for how to code this. (audio and video can&rsquo;t.)</li>
<li>Media (audio or video) might not be playable on a specific platform, even though it has been legitimately embedded in a presentation.</li>
</ol>
<p><a id="code-slides"></a></p>
<h3 id="code-slides">Code Slides<a class="headerlink" href="#code-slides" title="Permanent link"></a></h3>
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide.log
Expand Up @@ -5,8 +5,8 @@ mdpre Markdown Preprocessor v0.6.7 (17 December, 2023)
Def mdpre_date = 17 December, 2023
Def mdpre_level = 0.6.7
Def userid = martinpacker
Def time = 20&colon;24
Def date = 17 January&comma; 2024
Def time = 16&colon;52
Def date = 20 January&comma; 2024
Def TOC = Table Of Contents
Def md = Markdown
Def pp = Powerpoint
Expand Down Expand Up @@ -44,7 +44,7 @@ CSV Stop
..... ..... ..... Multi-Column Table Cells
..... ..... Card Slides
..... ..... ..... Card Titles
..... ..... ..... Card Graphics & Video
..... ..... ..... Card Graphics, Video, &amp; Audio
..... ..... Code Slides
..... ..... ..... `<code>`
..... ..... ..... Triple Backticks (```)
Expand Down
26 changes: 18 additions & 8 deletions docs/user-guide.md
Expand Up @@ -37,7 +37,7 @@ As you can see in the [change log](#change-log), md2pptx is frequently updated -
* [Multi-Column Table Cells](#multicolumn-table-cells)
* [Card Slides](#card-slides)
* [Card Titles](#card-titles)
* [Card Graphics & Video](#card-graphics-&-video)
* [Card Graphics, Video, &amp; Audio](#card-graphics-video-&amp;-audio)
* [Code Slides](#code-slides)
* [`<code>`](#<code>)
* [Triple Backticks (```)](#triple-backticks-())
Expand Down Expand Up @@ -348,9 +348,10 @@ To quote from the python-pptx license statement:

|Level|Date|What|
|:-|-:|:-|
|4.3.2|17&nbsp;January&nbsp;2024|Cards can now have a video where a graphic might be.|
|4.3.3|20&nbsp;January&nbsp;2024|Cards can now have audio where a graphic might be. Also media can have a "poster" image for when the media isn't playing. See [Card Graphics&comma; Video&comma; &amp; Audio](#card-graphics-video-audio).|
|4.3.2|17&nbsp;January&nbsp;2024|Cards can now have a video where a graphic might be. See [Card Graphics&comma; Video&comma; &amp; Audio](#card-graphics-video-audio).|
|4.3.1|13&nbsp;January&nbsp;2024|Card graphics are now clickable and can have tooltips. They can also use `data:` URL's.|
|4.3|3&nbsp;January&nbsp;2024|Added [card graphics](#card-graphics-&-video) support and [`CardGraphicPosition`](#card-graphic-positioning-cardgraphicposition)&comma; [`CardGraphicSize`](#card-graphic-size-cardgraphicsize)&comma; and [`CardGraphicPadding`](#card-graphic-padding-cardgraphicpadding).|
|4.3|3&nbsp;January&nbsp;2024|Added [card graphics](#card-graphics-video-audio) support and [`CardGraphicPosition`](#card-graphic-positioning-cardgraphicposition)&comma; [`CardGraphicSize`](#card-graphic-size-cardgraphicsize)&comma; and [`CardGraphicPadding`](#card-graphic-padding-cardgraphicpadding).|
|4.2.1|28&nbsp;December&nbsp;2023|Made [`backgroundImage`](#specifying-slide-background-images-with-backgroundimage) create **real** slide backgrounds.|
|4.2|27&nbsp;December&nbsp;2023|Added background image support using [`backgroundImage`](#specifying-slide-background-images-with-backgroundimage).|
|4.1.2|11&nbsp;July&nbsp;2023|Fixed two bugs: Using `<sub>` &amp; `<sup>` causes a crash. Also [Card Slides](#card-slides) cause a crash.|
Expand Down Expand Up @@ -670,6 +671,8 @@ You can optionally have md2pptx export the temporary PNG files. See [Exporting C

Videos and audio files are supported in a similar way to [graphics slides](#graphics-slides). However, there is no Markdown support for embedding videos or audio files. Fortunately, Markdown processors support HTML.

You should be aware that, though you can legitimately embed a video or audio, Powerpoint might not be able to play it on all platforms.

##### Video Slides
<a id="video-slides"></a>

Expand Down Expand Up @@ -927,12 +930,12 @@ In the above examples the card titles are above the cards. You can specify that

You can suppress a title by coding its text value to `&nbsp;`. If you do this for all the titles on a card slide the space reserved for card titles will be zero. If there are some titles not treated this way the `&nbsp;`-titled cards will have a gap where the title would have been.

<a id="card-graphics-&-video"></a>
#### Card Graphics & Video
<a id="#card-graphics-video-audio"></a>
#### Card Graphics, Video, &amp; Audio

You can add a graphic or a video to a card. They can be placed in reserved areas before or after the card bulleted list contents.
You can add a single graphic, video, or audio file to each card. They can be placed in reserved areas before or after the card bulleted list contents.

Place any graphic or video declaration between the card's title and the card's contents. For example:
Place any graphic, video, or audio declaration between the card's title and the card's contents. For example:

#### Card One

Expand All @@ -945,11 +948,18 @@ As you can see, the image reference is just a standard Markdown one. A video ref

<video height=300 width=400 src="waterdrop.mp4"></video>

An audio reference might be of the form:

<audio src="audiotest.mp3" poster="Battery W2M.png"></audio>

In this case the `poster` attribute is coded. This enables a graphic to be shown when the audio player isn't activated. You can also code the `poster` attribute for a video.

**Notes:**

1. You must code a non-zero value for [`CardGraphicSize`](#card-graphic-size-cardgraphicsize) for graphics or videos to be shown. The default is 0.
2. If a card doesn't have a graphic or a video the bulleted list contents can fill the whole of the card (except for any title inside the card).
3. Card graphics can have tooltips and can be clickable. See [Graphics Slides](#graphics-slides) for how to code this.
3. Card graphics can have tooltips and can be clickable. See [Graphics Slides](#graphics-slides) for how to code this. (audio and video can't.)
4. Media (audio or video) might not be playable on a specific platform, even though it has been legitimately embedded in a presentation.

<a id="code-slides"></a>
### Code Slides
Expand Down
27 changes: 20 additions & 7 deletions docs/user-guide.mdp
Expand Up @@ -154,9 +154,10 @@ To quote from the python-pptx license statement:
=colalign l r l
=csv
Level,Date,What
4.3.2,17&nbsp;January&nbsp;2024,Cards can now have a video where a graphic might be.
4.3.3,20&nbsp;January&nbsp;2024,Cards can now have audio where a graphic might be. Also media can have a "poster" image for when the media isn't playing. See [Card Graphics&comma; Video&comma; &amp; Audio](#card-graphics-video-audio).
4.3.2,17&nbsp;January&nbsp;2024,Cards can now have a video where a graphic might be. See [Card Graphics&comma; Video&comma; &amp; Audio](#card-graphics-video-audio).
4.3.1,13&nbsp;January&nbsp;2024,Card graphics are now clickable and can have tooltips. They can also use `data:` URL's.
4.3,3&nbsp;January&nbsp;2024,Added [card graphics](#card-graphics-&-video) support and [`CardGraphicPosition`](#card-graphic-positioning-cardgraphicposition)&comma; [`CardGraphicSize`](#card-graphic-size-cardgraphicsize)&comma; and [`CardGraphicPadding`](#card-graphic-padding-cardgraphicpadding).
4.3,3&nbsp;January&nbsp;2024,Added [card graphics](#card-graphics-video-audio) support and [`CardGraphicPosition`](#card-graphic-positioning-cardgraphicposition)&comma; [`CardGraphicSize`](#card-graphic-size-cardgraphicsize)&comma; and [`CardGraphicPadding`](#card-graphic-padding-cardgraphicpadding).
4.2.1,28&nbsp;December&nbsp;2023,Made [`backgroundImage`](#specifying-slide-background-images-with-backgroundimage) create **real** slide backgrounds.
4.2,27&nbsp;December&nbsp;2023,Added background image support using [`backgroundImage`](#specifying-slide-background-images-with-backgroundimage).
4.1.2,11&nbsp;July&nbsp;2023,Fixed two bugs: Using `<sub>` &amp; `<sup>` causes a crash. Also [Card Slides](#card-slides) cause a crash.
Expand Down Expand Up @@ -516,6 +517,8 @@ Videos and audio files are supported in a similar way to [graphics slides](#grap
However, there is no Markdown support for embedding videos or audio files. \
Fortunately, Markdown processors support HTML.

You should be aware that, though you can legitimately embed a video or audio, Powerpoint might not be able to play it on all platforms.

##### Video Slides
<a id="video-slides"></a>

Expand Down Expand Up @@ -809,13 +812,13 @@ You can suppress a title by coding its text value to `&nbsp;`. \
If you do this for all the titles on a card slide the space reserved for card titles will be zero. \
If there are some titles not treated this way the `&nbsp;`-titled cards will have a gap where the title would have been.

<a id="card-graphics-&-video"></a>
#### Card Graphics & Video
<a id="#card-graphics-video-audio"></a>
#### Card Graphics, Video, &amp; Audio

You can add a graphic or a video to a card. \
You can add a single graphic, video, or audio file to each card. \
They can be placed in reserved areas before or after the card bulleted list contents.

Place any graphic or video declaration between the card's title and the card's contents. \
Place any graphic, video, or audio declaration between the card's title and the card's contents. \
For example:

#### Card One
Expand All @@ -829,14 +832,24 @@ As you can see, the image reference is just a standard Markdown one. \
A video reference might be of the form:

<video height=300 width=400 src="waterdrop.mp4"></video>

An audio reference might be of the form:

<audio src="audiotest.mp3" poster="Battery W2M.png"></audio>

In this case the `poster` attribute is coded. \
This enables a graphic to be shown when the audio player isn't activated. \
You can also code the `poster` attribute for a video.

**Notes:**

1. You must code a non-zero value for [`CardGraphicSize`](#card-graphic-size-cardgraphicsize) for graphics or videos to be shown. \
The default is 0.
2. If a card doesn't have a graphic or a video the bulleted list contents can fill the whole of the card (except for any title inside the card).
3. Card graphics can have tooltips and can be clickable. \
See [Graphics Slides](#graphics-slides) for how to code this.
See [Graphics Slides](#graphics-slides) for how to code this. \
(audio and video can't.)
4. Media (audio or video) might not be playable on a specific platform, even though it has been legitimately embedded in a presentation.

<a id="code-slides"></a>
### Code Slides
Expand Down

0 comments on commit 8ce1b75

Please sign in to comment.