MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / get_inline_style

Method get_inline_style

utils/src/presentation.py:414–438  ·  view source on GitHub ↗

Get the inline style for the shape element. Args: style_args (StyleArg): The style arguments for HTML conversion. Returns: str: The inline style string.

(self, style_args: StyleArg)

Source from the content-addressed store, hash-verified

412 return s
413
414 def get_inline_style(self, style_args: StyleArg):
415 """
416 Get the inline style for the shape element.
417
418 Args:
419 style_args (StyleArg): The style arguments for HTML conversion.
420
421 Returns:
422 str: The inline style string.
423 """
424 id_str = f" id='{self.shape_idx}'" if style_args.element_id else ""
425 styles = []
426 if style_args.area:
427 styles.append(f"data-relative-area={self.area*100/self.slide_area:.2f}%;")
428 if style_args.size:
429 styles.append(f"width: {self.width}pt; height: {self.height}pt;")
430 if style_args.geometry:
431 styles.append(f"left: {self.left}pt; top: {self.top}pt;")
432 if style_args.font_style and self.text_frame.is_textframe:
433 font_style = get_font_style(self.text_frame.font)
434 if font_style:
435 styles.append(font_style)
436 if len(styles) != 0:
437 return id_str + " style='" + " ".join(styles) + "'"
438 return id_str
439
440
441class UnsupportedShape(ShapeElement):

Callers 6

to_htmlMethod · 0.45
to_htmlMethod · 0.45
to_htmlMethod · 0.45
to_htmlMethod · 0.45
to_htmlMethod · 0.45
to_htmlMethod · 0.45

Calls 1

get_font_styleFunction · 0.90

Tested by

no test coverage detected