(self)
| 24 | } |
| 25 | |
| 26 | def run(self): |
| 27 | IteractiveWidget._next_id += 1 |
| 28 | container_id = f"reactpy-widget-{IteractiveWidget._next_id}" |
| 29 | view_id = get_normalized_example_name( |
| 30 | self.arguments[0], |
| 31 | # only used if example name starts with "/" |
| 32 | self.get_source_info()[0], |
| 33 | ) |
| 34 | return [ |
| 35 | raw( |
| 36 | "", |
| 37 | f""" |
| 38 | <div> |
| 39 | <div |
| 40 | id="{container_id}" |
| 41 | class="interactive widget-container" |
| 42 | style="margin-bottom: {self.options.get("margin", 0)}px;" |
| 43 | /> |
| 44 | <script type="module"> |
| 45 | import {{ mountWidgetExample }} from "{_REACTPY_STATIC_HOST}/_static/custom.js"; |
| 46 | mountWidgetExample( |
| 47 | "{container_id}", |
| 48 | "{view_id}", |
| 49 | "{_REACTPY_EXAMPLE_HOST}", |
| 50 | {"true" if "activate-button" in self.options else "false"}, |
| 51 | ); |
| 52 | </script> |
| 53 | </div> |
| 54 | """, |
| 55 | format="html", |
| 56 | ) |
| 57 | ] |
| 58 | |
| 59 | |
| 60 | def setup(app: Sphinx) -> None: |
nothing calls this directly
no test coverage detected