You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
503 B

from panflute import Div,Span,Para
from util import *
from typing import List
class Command:
pass
class InlineCommand(Span, Command):
def replaceSelf(self, content: List[Element]) -> Span:
try:
return Span(*content)
except TypeError:
if len(content) == 1 and isinstance(content[0], Para):
return Span(*content[0].content)
else:
return Div(*content)
pass
class MultilineCommand(Div, Command):
def replaceSelf(self, content: List[Element]) -> Div:
return Div(*content)
pass