Unifikace stylu názvů proměnných, viz můj komentář v #14.
This commit is contained in:
parent
cfbe3e128d
commit
9bee635605
3 changed files with 11 additions and 11 deletions
|
@ -11,8 +11,8 @@ from .katex import KatexClient
|
||||||
from .html import html
|
from .html import html
|
||||||
from .tex import tex
|
from .tex import tex
|
||||||
from .images import ImageProcessor
|
from .images import ImageProcessor
|
||||||
from .output_generator import Output_generator
|
from .output_generator import OutputGenerator
|
||||||
from .html_generator import HTML_generator
|
from .html_generator import HTMLGenerator
|
||||||
|
|
||||||
from .mj_show import show
|
from .mj_show import show
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ def main():
|
||||||
# Generate HTML and TeX out of the transformed document
|
# Generate HTML and TeX out of the transformed document
|
||||||
#open(args.output_html, "w").write(html(doc, katexClient, imageProcessor))
|
#open(args.output_html, "w").write(html(doc, katexClient, imageProcessor))
|
||||||
#open(args.output_tex, "w").write(tex(doc, imageProcessor))
|
#open(args.output_tex, "w").write(tex(doc, imageProcessor))
|
||||||
Output_generator(sys.stdout).generate(doc)
|
OutputGenerator(sys.stdout).generate(doc)
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
print(show(doc))
|
print(show(doc))
|
||||||
|
|
|
@ -15,15 +15,15 @@ from pygments.util import ClassNotFound
|
||||||
|
|
||||||
from .whitespace import NBSP
|
from .whitespace import NBSP
|
||||||
from .context import Group
|
from .context import Group
|
||||||
from .output_generator import Output_generator
|
from .output_generator import OutputGenerator
|
||||||
from .katex import KatexClient
|
from .katex import KatexClient
|
||||||
from .images import ImageProcessor
|
from .images import ImageProcessor
|
||||||
from .util import inlinify
|
from .util import inlinify
|
||||||
|
|
||||||
class HTML_generator(Output_generator):
|
class HTMLGenerator(OutputGenerator):
|
||||||
def __init__(self, output_file, katex_client: KatexClient, image_processor:ImageProcessor, *args, **kwargs):
|
def __init__(self, output_file, katexClient: KatexClient, imageProcessor: ImageProcessor, *args, **kwargs):
|
||||||
self.katex_client = katex_client
|
self.katexClient = katexClient
|
||||||
self.image_processor = image_processor
|
self.imageProcessor = imageProcessor
|
||||||
super().__init__(output_file, *args, **kwargs)
|
super().__init__(output_file, *args, **kwargs)
|
||||||
|
|
||||||
def generate(self, e: Union[Element, ListContainer]):
|
def generate(self, e: Union[Element, ListContainer]):
|
||||||
|
|
|
@ -8,11 +8,11 @@ from .whitespace import NBSP
|
||||||
from .transform import FQuoted
|
from .transform import FQuoted
|
||||||
from .context import Group
|
from .context import Group
|
||||||
|
|
||||||
class UnknownElementException(Exception):
|
class UnknownElementError(Exception):
|
||||||
"An unknown Element has been passed to the Output_generator, probably because panflute introduced a new one."
|
"An unknown Element has been passed to the Output_generator, probably because panflute introduced a new one."
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Output_generator:
|
class OutputGenerator:
|
||||||
def __init__(self, output_file, indent_str: str="\t", initial_indent_level: int=0):
|
def __init__(self, output_file, indent_str: str="\t", initial_indent_level: int=0):
|
||||||
self.output_file = output_file
|
self.output_file = output_file
|
||||||
self.indent_str = indent_str
|
self.indent_str = indent_str
|
||||||
|
@ -85,7 +85,7 @@ class Output_generator:
|
||||||
ListItem: self.generate_ListItem
|
ListItem: self.generate_ListItem
|
||||||
}[type(e)](e)
|
}[type(e)](e)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise UnknownElementException(type(e))
|
raise UnknownElementError(type(e))
|
||||||
|
|
||||||
def generate_ListContainer(self, e: ListContainer):
|
def generate_ListContainer(self, e: ListContainer):
|
||||||
for child in e:
|
for child in e:
|
||||||
|
|
Loading…
Reference in a new issue