Jan Černohorský
2 years ago
6 changed files with 77 additions and 20 deletions
@ -1,5 +1,7 @@ |
|||||
from panflute import Element |
from panflute import Element, Span |
||||
|
from command_wrappers import * |
||||
|
|
||||
class commands: |
def nop(e: Element) -> Element: |
||||
def woah(e: Element) -> Element: |
|
||||
return e |
return e |
||||
|
|
||||
|
opendatatask = basicTextCommand("Toto je praktická open-data úloha. V [odevzdávátku](https://ksp.mff.cuni.cz/h/odevzdavatko/) si necháte vygenerovat vstupy a odevzdáte příslušné výstupy. Záleží jen na vás, jak výstupy vyrobíte.") |
||||
|
@ -0,0 +1,10 @@ |
|||||
|
from typing import Callable |
||||
|
from panflute import Element, Span, convert_text |
||||
|
|
||||
|
def basicTextCommand(s: str) -> Callable: |
||||
|
content = convert_text(s)[0].content |
||||
|
def f(e: Element) -> Element: |
||||
|
element = Span() |
||||
|
element.content = content |
||||
|
return element |
||||
|
return f |
@ -1,7 +1,10 @@ |
|||||
from panflute import Element |
from panflute import Element |
||||
|
import re |
||||
|
|
||||
def replaceEl(e: Element, r: Element) -> Element: |
def replaceEl(e: Element, r: Element) -> Element: |
||||
e.parent.content[e.index] = r |
parent = e.parent |
||||
|
parent.content[e.index] = r |
||||
|
r.parent = parent |
||||
return r |
return r |
||||
def deleteEl(e: Element): |
def deleteEl(e: Element): |
||||
del e.parent.content[e.index] |
e.classes.append("deleted") |
||||
|
Loading…
Reference in new issue