2025.12.23 17:30:33 (cachyos.cmoser.eu)
This commit is contained in:
@@ -334,6 +334,7 @@ def render_table_data(tag_name:str,value,options,parent,context):
|
||||
class_attr = f"class=\"{" ".join(classes)}\"" if classes else ""
|
||||
return f"<td {class_attr} {" ".join(extra_attributes)}>{value}</td>"
|
||||
|
||||
|
||||
def render_youtube_video(tag_name: str, value, options, parent, context):
|
||||
if tag_name not in options:
|
||||
return ""
|
||||
@@ -345,8 +346,11 @@ def render_youtube_video(tag_name: str, value, options, parent, context):
|
||||
|
||||
if settings.USE_BOOTSTRAP:
|
||||
styles = []
|
||||
classes = ["w-100"]
|
||||
div_classes = ["my-1"]
|
||||
classes = ["embed-responsive-item", "w-100"]
|
||||
div_classes = [
|
||||
"embed-responsive",
|
||||
"my-1",
|
||||
]
|
||||
div_styles = []
|
||||
else:
|
||||
styles = ["max-width:100%;"]
|
||||
@@ -385,9 +389,9 @@ def render_youtube_video(tag_name: str, value, options, parent, context):
|
||||
styles.append(f"height:{_h};")
|
||||
else:
|
||||
if _h.endswith('%'):
|
||||
_h= _h[:-1]
|
||||
_h = _h[:-1]
|
||||
if _h.isdigit():
|
||||
_h=int(_w)
|
||||
_h = int(_w)
|
||||
if _h > 100:
|
||||
_h = 100
|
||||
if settings.USE_BOOTSTRAP:
|
||||
@@ -405,15 +409,15 @@ def render_youtube_video(tag_name: str, value, options, parent, context):
|
||||
if "position" in options:
|
||||
pos = options['position']
|
||||
if settings.USE_BOOTSTRAP:
|
||||
if pos == "left" or pos=="start":
|
||||
div_classes += ["float-start","me-2"]
|
||||
if pos == "left" or pos == "start":
|
||||
div_classes += ["float-start", "me-2"]
|
||||
#classes += ["float-start","me-2"]
|
||||
elif pos == "right" or pos == "end":
|
||||
div_classes += ["float-end","ms-2"]
|
||||
#classes += ["float-end","ms-2"]
|
||||
div_classes += ["float-end", "ms-2"]
|
||||
#classes += ["float-end", "ms-2"]
|
||||
elif pos == "center":
|
||||
div_classes += ["mx-auto","d-block"]
|
||||
#classes += ["mx-auto","d-block"]
|
||||
div_classes += ["mx-auto", "d-block"]
|
||||
#classes += ["mx-auto", "d-block"]
|
||||
|
||||
if styles:
|
||||
style = f"style=\"{"".join(styles)}\""
|
||||
@@ -425,6 +429,8 @@ def render_youtube_video(tag_name: str, value, options, parent, context):
|
||||
else:
|
||||
div_style = ""
|
||||
if settings.USE_BOOTSTRAP:
|
||||
return f'<div class=""{' '.join(div_classes)}" {div_style}><iframe class={" ".join(classes)}" src="https://www.youtube.com/embed/{options[tag_name]}" allowfullscreen></iframe></div>'
|
||||
return f"""<div class=""{' '.join(div_classes)}" {div_style}>
|
||||
<iframe class={" ".join(classes)}" src="https://www.youtube.com/embed/{options[tag_name]}?rel=0" allowfullscreen></iframe>
|
||||
</div>"""
|
||||
else:
|
||||
return f'<div {div_style}><iframe src="https://www.youtube.com/embed/{options[tag_name]}?rel=0" allowfullscreen></iframe></div>'
|
||||
return f'<div {div_style}><iframe src="https://www.youtube.com/embed/{options[tag_name]}?rel=0" allowfullscreen></iframe></div>'
|
||||
|
||||
Reference in New Issue
Block a user