Update python_pptx/python_pptx.py
Browse files- python_pptx/python_pptx.py +8 -14
python_pptx/python_pptx.py
CHANGED
@@ -6,6 +6,7 @@ from pptx import Presentation
|
|
6 |
from pptx.util import Inches, Pt
|
7 |
from pptx.dml.color import RGBColor
|
8 |
from pptx.enum.text import PP_ALIGN
|
|
|
9 |
|
10 |
class PresentationGenerator:
|
11 |
def __init__(self):
|
@@ -22,7 +23,6 @@ class PresentationGenerator:
|
|
22 |
slides = []
|
23 |
current_slide = None
|
24 |
lines = content.split('\n')
|
25 |
-
|
26 |
for line in lines:
|
27 |
line = line.strip()
|
28 |
if line == "#Debut Slide Titre#":
|
@@ -51,6 +51,13 @@ class PresentationGenerator:
|
|
51 |
|
52 |
return slides
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
def create_presentation(self, slides):
|
55 |
prs = Presentation()
|
56 |
|
@@ -95,16 +102,3 @@ class PresentationGenerator:
|
|
95 |
p.font.color.rgb = self.default_theme_colors["text" if style == 'text' else 'subtitle']
|
96 |
|
97 |
return prs
|
98 |
-
|
99 |
-
def convert_markdown_links(self, text):
|
100 |
-
import re
|
101 |
-
# Convert Markdown links to hyperlinks
|
102 |
-
pattern = r'\[([^\]]+)\]\((https?://[^\)]+)\)'
|
103 |
-
repl = r'\1'
|
104 |
-
text = re.sub(pattern, repl, text)
|
105 |
-
return text
|
106 |
-
|
107 |
-
def hex_to_rgb(self, hex_color):
|
108 |
-
# Convert hex color to RGB tuple
|
109 |
-
hex_color = hex_color.lstrip('#')
|
110 |
-
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
|
|
|
6 |
from pptx.util import Inches, Pt
|
7 |
from pptx.dml.color import RGBColor
|
8 |
from pptx.enum.text import PP_ALIGN
|
9 |
+
import re
|
10 |
|
11 |
class PresentationGenerator:
|
12 |
def __init__(self):
|
|
|
23 |
slides = []
|
24 |
current_slide = None
|
25 |
lines = content.split('\n')
|
|
|
26 |
for line in lines:
|
27 |
line = line.strip()
|
28 |
if line == "#Debut Slide Titre#":
|
|
|
51 |
|
52 |
return slides
|
53 |
|
54 |
+
def convert_markdown_links(self, text):
|
55 |
+
# Convert Markdown links to hyperlinks
|
56 |
+
pattern = r'\[([^\]]+)\]\((https?://[^\)]+)\)'
|
57 |
+
repl = r'\1'
|
58 |
+
text = re.sub(pattern, repl, text)
|
59 |
+
return text
|
60 |
+
|
61 |
def create_presentation(self, slides):
|
62 |
prs = Presentation()
|
63 |
|
|
|
102 |
p.font.color.rgb = self.default_theme_colors["text" if style == 'text' else 'subtitle']
|
103 |
|
104 |
return prs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|