Browse Source

PandocProcessor nyní předělává i NBSP.

katex-socket
Jan Černohorský 1 year ago
parent
commit
20c1ba29a2
  1. 7
      src/formatitko/pandoc_processor.py

7
src/formatitko/pandoc_processor.py

@ -2,14 +2,12 @@ from .nop_processor import NOPProcessor
from panflute import Div, Span, Null, Str, Plain, Quoted from panflute import Div, Span, Null, Str, Plain, Quoted
from .context import Group, InlineGroup, BlockGroup from .context import Group, InlineGroup, BlockGroup
from .elements import FQuoted from .elements import FQuoted
from .whitespace import NBSP
from .nop_processor import ELCl from .nop_processor import ELCl
from typing import Callable from typing import Callable
import sys import sys
def eprint(*args, **kwargs):
print(*args, **kwargs, file=sys.stderr)
class PandocProcessor(NOPProcessor): class PandocProcessor(NOPProcessor):
def get_posttransformers(self) -> list[Callable[[ELCl],ELCl]]: def get_posttransformers(self) -> list[Callable[[ELCl],ELCl]]:
@ -38,3 +36,6 @@ class PandocProcessor(NOPProcessor):
def transform_FQuoted(self, e: FQuoted) -> Quoted: def transform_FQuoted(self, e: FQuoted) -> Quoted:
return Quoted(*e.content) return Quoted(*e.content)
def transform_NBSP(self, e: NBSP) -> Str:
return Str(" ") # Unicode nbsp

Loading…
Cancel
Save