Skip to content

Commit

Permalink
Add default text style to ensure first letter is capital
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Oct 24, 2020
1 parent c4a7d2d commit a5ac420
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 19 deletions.
3 changes: 3 additions & 0 deletions app/models.py
Expand Up @@ -41,6 +41,9 @@ def stylize(self, text: str) -> str:
if self.style == "none":
return text

if self.style == "default":
return text.capitalize() if text.islower() else text

if self.style == "mock":
return spongemock.mock(text, diversity_bias=0.75, random_seed=0)

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app/tests/test_models.py
Expand Up @@ -13,6 +13,8 @@ def describe_stylize():
("style", "before", "after"),
[
("none", "Hello, world!", "Hello, world!"),
("default", "these are words.", "These are words."),
("default", "These ARE words.", "These ARE words."),
("upper", "Hello, world!", "HELLO, WORLD!"),
("lower", "Hello, world!", "hello, world!"),
("title", "these are words", "These Are Words"),
Expand Down
4 changes: 2 additions & 2 deletions templates/ds/config.yml
Expand Up @@ -2,14 +2,14 @@ name: Daily Struggle
source: https://knowyourmeme.com/memes/daily-struggle
text:
- color: black
style: none
style: default
anchor_x: 0.085
anchor_y: 0.085
angle: 12.5
scale_x: 0.32
scale_y: 0.095
- color: black
style: none
style: default
anchor_x: 0.455
anchor_y: 0.055
angle: 10.5
Expand Down
4 changes: 2 additions & 2 deletions templates/kombucha/config.yml
Expand Up @@ -2,14 +2,14 @@ name: Kombucha Girl
source: https://www.buzzfeed.com/daniellaemanuel/woman-trying-kombucha-meme
text:
- color: black
style: none
style: default
anchor_x: 0.0
anchor_y: 0.0
angle: 0.0
scale_x: 0.5
scale_y: 0.3
- color: black
style: none
style: default
anchor_x: 0.5125
anchor_y: 0.0
angle: 0.0
Expand Down
10 changes: 5 additions & 5 deletions templates/millers/config.yml
Expand Up @@ -2,28 +2,28 @@ name: You Guys Are Getting Paid?
source: https://knowyourmeme.com/photos/1712302-you-guys-are-getting-paid
text:
- color: white
style: none
style: default
anchor_x: 0.0
anchor_y: 0.35
angle: 0.0
scale_x: 0.5
scale_y: 0.15
- color: white
style: none
style: default
anchor_x: 0.5
anchor_y: 0.35
angle: 0.0
scale_x: 0.5
scale_y: 0.15
- color: white
style: none
style: default
anchor_x: 0.0
anchor_y: 0.85
angle: 0.0
scale_x: 0.5
scale_y: 0.15
- color: white
style: none
style: default
anchor_x: 0.5
anchor_y: 0.85
angle: 0.0
Expand All @@ -32,7 +32,7 @@ text:
styles:
-
sample:
- ''
- ""
- You are making 500 thousand dollars and you were only gonna pay me 30?
- You're getting 30 grand? I'm getting a thousand!
- You guys are getting paid?
4 changes: 2 additions & 2 deletions templates/ntot/config.yml
Expand Up @@ -2,14 +2,14 @@ name: No Take, Only Throw
source: https://knowyourmeme.com/memes/no-take-only-throw
text:
- color: black
style: none
style: default
anchor_x: 0.055
anchor_y: 0.08
angle: 12.0
scale_x: 0.21
scale_y: 0.15
- color: black
style: none
style: default
anchor_x: 0.46
anchor_y: 0.15
angle: -0.01
Expand Down
6 changes: 3 additions & 3 deletions templates/pigeon/config.yml
Expand Up @@ -2,21 +2,21 @@ name: Is This a Pigeon?
source: https://knowyourmeme.com/memes/is-this-a-pigeon
text:
- color: white
style: none
style: default
anchor_x: 0.15
anchor_y: 0.0
angle: 0.0
scale_x: 0.35
scale_y: 0.2
- color: white
style: none
style: default
anchor_x: 0.71
anchor_y: 0.3
angle: 0.0
scale_x: 0.175
scale_y: 0.1
- color: white
style: none
style: default
anchor_x: 0.0
anchor_y: 0.8
angle: 0.0
Expand Down
8 changes: 4 additions & 4 deletions templates/ptj/config.yml
Expand Up @@ -2,14 +2,14 @@ name: Phoebe Teaching Joey
source: https://knowyourmeme.com/photos/1846826-phoebe-teaching-joey
text:
- color: white
style: none
style: default
anchor_x: 0.0
anchor_y: 0.175
angle: 0.0
scale_x: 0.5
scale_y: 0.05
- color: white
style: none
style: default
anchor_x: 0.5
anchor_y: 0.175
angle: 0.0
Expand Down Expand Up @@ -44,14 +44,14 @@ text:
scale_x: 0.5
scale_y: 0.05
- color: white
style: none
style: default
anchor_x: 0.0
anchor_y: 0.925
angle: 0.0
scale_x: 0.5
scale_y: 0.05
- color: white
style: none
style: default
anchor_x: 0.5
anchor_y: 0.925
angle: 0.0
Expand Down
2 changes: 1 addition & 1 deletion templates/spongebob/config.yml
Expand Up @@ -2,7 +2,7 @@ name: Mocking Spongebob
source: http://knowyourmeme.com/memes/mocking-spongebob
text:
- color: white
style: none
style: default
anchor_x: 0.0
anchor_y: 0.0
angle: 0.0
Expand Down

0 comments on commit a5ac420

Please sign in to comment.