Skip to content

Commit

Permalink
v4.3.2 Card Video
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPacker committed Jan 17, 2024
1 parent bbe3ed5 commit 574a732
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 91 deletions.
4 changes: 4 additions & 0 deletions card.py
Expand Up @@ -21,6 +21,10 @@ def __init__(
self.graphicTitle = None
self.printableFilename = None

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

self.mediaURL = None

self.backgroundShape = None
Expand Down
34 changes: 21 additions & 13 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">Card Graphics</a></li>
<li><a href="#card-graphics-&amp;-video">Card Graphics &amp; Video</a></li>
</ul>
</li>
<li><a href="#code-slides">Code Slides</a><ul>
Expand Down Expand Up @@ -1484,14 +1484,19 @@ <h2 id="change-log">Change Log<a class="headerlink" href="#change-log" title="Pe
</thead>
<tbody>
<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>
</tr>
<tr>
<td align="left">4.3.1</td>
<td align="right">13&nbsp;January&nbsp;2024</td>
<td align="left">Card graphics are now clickable and can have tooltips. They can also use <code>data:</code> URL&rsquo;s.</td>
</tr>
<tr>
<td align="left">4.3</td>
<td align="right">3&nbsp;January&nbsp;2024</td>
<td align="left">Added card graphics 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-&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>
</tr>
<tr>
<td align="left">4.2.1</td>
Expand Down Expand Up @@ -2304,25 +2309,28 @@ <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>
<h4 id="card-graphics">Card Graphics<a class="headerlink" href="#card-graphics" title="Permanent link"></a></h4>
<p>You can add graphics to a card. They can be placed in reserved areas before or after the card bulleted list contents.</p>
<p>Place any graphic declaration between the card&rsquo;s title and the card&rsquo;s contents. For example:</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>
<pre><code>#### Card One

![](block.png)

* Some content for Card One
* And some more content
</code></pre>
<p>As you can see, the image reference is just a standard Markdown one.</p>
<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><strong>Notes:</strong></p>
<ol>
<li>You must code a non-zero value for <code>CardGraphicSize</code> for graphics to be shown. The default is 0.</li>
<li>If a card doesn&rsquo;t have a graphic the bulleted list contents can fill the whole of the card (except for any title inside the card).</li>
<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>
</ol>
<h3 id="code-slides">Code Slides<a class="headerlink" href="#code-slides" title="Permanent link"></a></h3>
<p><a id="code-slides"></a></p>
<h3 id="code-slides">Code Slides<a class="headerlink" href="#code-slides" title="Permanent link"></a></h3>
<p>You can create a slide where the body is in a monospace font, without bullets, in a number of different ways:</p>
<ul>
<li>Where what you type appears exactly as you typed it - using <code>&lt;code&gt;</code>, triple backticks, or by indentation.</li>
Expand Down Expand Up @@ -3570,17 +3578,17 @@ <h5 id="card-graphic-position-cardgraphicposition">Card Graphic Position - <code
</ol>
<p><a id="card-graphic-size-cardgraphicsize"></a></p>
<h5 id="card-graphic-size-cardgraphicsize">Card Graphic Size - <code>CardGraphicSize</code><a class="headerlink" href="#card-graphic-size-cardgraphicsize" title="Permanent link"></a></h5>
<p>If you want graphics to appear in cards you must specify a non-zero value of <code>CardGraphicSize</code>. For example:</p>
<p>If you want graphics or videos to appear in cards you must specify a non-zero value of <code>CardGraphicSize</code>. For example:</p>
<pre><code>cardGraphicSize: 0.75
</code></pre>
<p>would cause the graphics to be scaled to fit into a 0.75 inch square.</p>
<p>would cause the graphics and videos to be scaled to fit into a 0.75 inch square.</p>
<p>The default is <code>0</code>, that is no graphics.</p>
<p><a id="card-graphic-padding-cardgraphicpadding"></a></p>
<h5 id="card-graphic-padding-cardgraphicpadding">Card Graphic Padding - <code>CardGraphicPadding</code><a class="headerlink" href="#card-graphic-padding-cardgraphicpadding" title="Permanent link"></a></h5>
<p>You can specify space around the graphic on a card. For example:</p>
<p>You can specify space around the graphic or video on a card. For example:</p>
<pre><code>cardGraphicPadding: 0.5
</code></pre>
<p>will leave a space of 0.5 inches around the graphic. The default is <code>0.1</code>, leaving a 0.1 inch pad around the graphics.</p>
<p>will leave a space of 0.5 inches around the graphics and videos. The default is <code>0.1</code>, leaving a 0.1 inch pad around them.</p>
<p><a id="code-metadata"></></p>
<h4 id="code-metadata">Code Metadata<a class="headerlink" href="#code-metadata" title="Permanent link"></a></h4>
<p>You can adjust how code slides display their content.</p>
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 = 16&colon;31
Def date = 13 January&comma; 2024
Def time = 20&colon;24
Def date = 17 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
..... ..... ..... Card Graphics & Video
..... ..... Code Slides
..... ..... ..... `<code>`
..... ..... ..... Triple Backticks (```)
Expand Down
31 changes: 17 additions & 14 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](#card-graphics)
* [Card Graphics & Video](#card-graphics-&-video)
* [Code Slides](#code-slides)
* [`<code>`](#<code>)
* [Triple Backticks (```)](#triple-backticks-())
Expand Down Expand Up @@ -348,8 +348,9 @@ 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.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 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) 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 @@ -926,11 +927,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.

#### Card Graphics
<a id="card-graphics-&-video"></a>
#### Card Graphics & Video

You can add graphics to a card. They can be placed in reserved areas before or after the card bulleted list contents.
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.

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

#### Card One

Expand All @@ -939,17 +941,18 @@ Place any graphic declaration between the card's title and the card's contents.
* Some content for Card One
* And some more content

As you can see, the image reference is just a standard Markdown one.
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>

**Notes:**

1. You must code a non-zero value for `CardGraphicSize` for graphics to be shown. The default is 0.
2. If a card doesn't have a graphic the bulleted list contents can fill the whole of the card (except for any title inside the card).
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.


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

You can create a slide where the body is in a monospace font, without bullets, in a number of different ways:

Expand Down Expand Up @@ -2414,22 +2417,22 @@ causes the graphic to appear after the bulleted list.
<a id="card-graphic-size-cardgraphicsize"></a>
##### Card Graphic Size - `CardGraphicSize`

If you want graphics to appear in cards you must specify a non-zero value of `CardGraphicSize`. For example:
If you want graphics or videos to appear in cards you must specify a non-zero value of `CardGraphicSize`. For example:

cardGraphicSize: 0.75

would cause the graphics to be scaled to fit into a 0.75 inch square.
would cause the graphics and videos to be scaled to fit into a 0.75 inch square.

The default is `0`, that is no graphics.

<a id="card-graphic-padding-cardgraphicpadding"></a>
##### Card Graphic Padding - `CardGraphicPadding`

You can specify space around the graphic on a card. For example:
You can specify space around the graphic or video on a card. For example:

cardGraphicPadding: 0.5

will leave a space of 0.5 inches around the graphic. The default is `0.1`, leaving a 0.1 inch pad around the graphics.
will leave a space of 0.5 inches around the graphics and videos. The default is `0.1`, leaving a 0.1 inch pad around them.

<a id="code-metadata"></>
#### Code Metadata
Expand Down
32 changes: 18 additions & 14 deletions docs/user-guide.mdp
Expand Up @@ -154,8 +154,9 @@ 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.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 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) 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 @@ -808,12 +809,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.

#### Card Graphics
<a id="card-graphics-&-video"></a>
#### Card Graphics & Video

You can add graphics to a card. \
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.

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

#### Card One
Expand All @@ -823,19 +825,21 @@ For example:
* Some content for Card One
* And some more content

As you can see, the image reference is just a standard Markdown one.
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>

**Notes:**

1. You must code a non-zero value for `CardGraphicSize` for graphics to be shown. \
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 the bulleted list contents can fill the whole of the card (except for any title inside the card).
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.


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

You can create a slide where the body is in a monospace font, without bullets, in a number of different ways:

Expand Down Expand Up @@ -2455,25 +2459,25 @@ and specifying graphics instead.
<a id="card-graphic-size-cardgraphicsize"></a>
##### Card Graphic Size - `CardGraphicSize`

If you want graphics to appear in cards you must specify a non-zero value of `CardGraphicSize`. \
If you want graphics or videos to appear in cards you must specify a non-zero value of `CardGraphicSize`. \
For example:

cardGraphicSize: 0.75

would cause the graphics to be scaled to fit into a 0.75 inch square.
would cause the graphics and videos to be scaled to fit into a 0.75 inch square.

The default is `0`, that is no graphics.

<a id="card-graphic-padding-cardgraphicpadding"></a>
##### Card Graphic Padding - `CardGraphicPadding`

You can specify space around the graphic on a card. \
You can specify space around the graphic or video on a card. \
For example:

cardGraphicPadding: 0.5

will leave a space of 0.5 inches around the graphic. The default is `0.1`, \
leaving a 0.1 inch pad around the graphics.
will leave a space of 0.5 inches around the graphics and videos. The default is `0.1`, \
leaving a 0.1 inch pad around them.

<a id="code-metadata"></>
#### Code Metadata
Expand Down

0 comments on commit 574a732

Please sign in to comment.