from panflute import Div,Span from util import * from typing import Callable class Command: pass class InlineCommand(Span, Command): def call(self, f: Callable) -> Span: r = f(self) return replaceEl(self, Span(*r.content, identifier=r.identifier, classes=r.classes, attributes=r.attributes)) pass class MultilineCommand(Div, Command): def call(self, f: Callable) -> Div: r = f(self) return replaceEl(self, Div(*r.content, identifier=r.identifier, classes=r.classes, attributes=r.attributes)) pass