Skip to content

Commit

Permalink
Add image commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sanand0 committed Jun 11, 2020
1 parent 54d7d51 commit 38d1e95
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions pptxhandler/v2/README.md
Expand Up @@ -300,10 +300,18 @@ content, or add new content (like charts). Here are some common commands:

### Position

- `top`: sets top (Y) position
- `left`: sets left (X) position
- `width`: sets width
- `height`: sets height
- `top`: sets top (Y) position in [length units](#length-units), e.g. `3 inches`
- `left`: sets left (X) position in [length units](#length-units), e.g. `3 inches`
- `width`: sets width in [length units](#length-units), e.g. `3 inches`
- `height`: sets height in [length units](#length-units), e.g. `3 inches`

TODO: Example

### Image

- `image`: set image of a picture to a file or URL, e.g. `new-pic.png` or `https://picsum.photos/200`. Retains aspect ratio, width and position. May change the height
- `image-width`: sets width in [length units](#length-units), e.g. `3 inches`. Retains aspect ratio and position (top and left). May change the height
- `image-height`: sets height in [length units](#length-units), e.g. `3 inches`. Retains aspect ratio and position (top and left). May change the width

TODO: Example

Expand Down Expand Up @@ -407,13 +415,32 @@ rules:
fill: colors[0] # Python expression using "colors" as a variable. Returns "red"
```

To specify an explicit value, use `{value: ...}` instead. For example:
To specify a literal text value, use `f'...'` instead. For example:

```yaml
rules:
- Rectangle 1:
width: f'6 inches' # Just set the width to 6 inches
fill: f'red' # Just set the color to red
```

Values inside `{}` are evaluated as Python expressions in the context of data. For example:

```yaml
data:
sales: [40, 50, 60]
rules:
- Rectangle 1:
text: f'Sales is {sum(sales)}' # Returns 'Sales is 150'
```

You can also use `{value: ...}` instead of `f'...'`. For example:

```yaml
rules:
- Rectangle 1:
width: {value: 6} # Just set the width to 6
fill: {value: red} # Just set the color to red
width: {value: 6} # Set the width to 6
fill: {value: [255, 0, 0]} # Set the color to RGB(255, 0, 0)
```

If your value is a string, it's formatted as a template. Values inside `{}` are evaluated as Python
Expand Down

0 comments on commit 38d1e95

Please sign in to comment.