Compare commits

...

4 Commits

  1. 9
      src/formatitko/formatitko.py
  2. 3
      src/formatitko/html_generator.py
  3. 4
      src/formatitko/tex/formatitko.tex
  4. 5
      src/formatitko/tex_generator.py

9
src/formatitko/formatitko.py

@ -2,9 +2,11 @@
import argparse import argparse
import sys import sys
import os
import tempfile import tempfile
import subprocess import subprocess
import shutil import shutil
from pathlib import Path
# Import local files # Import local files
from .util import import_md from .util import import_md
@ -112,7 +114,12 @@ def main():
else: else:
filename = args.output_tex filename = args.output_tex
outdir = tempfile.TemporaryDirectory(prefix="formatitko") outdir = tempfile.TemporaryDirectory(prefix="formatitko")
subprocess.run(["pdfcsplain", "-halt-on-error", "-output-directory="+outdir.name, "-jobname=formatitko", filename], check=True)
env = os.environ.copy()
d = Path("/".join(__file__.split("/")[:-1]))
env["TEXINPUTS"]=".:"+str(d/"tex")+":"+env.get("TEXINPUTS", "")
subprocess.run(["luatex", "-halt-on-error", "-output-directory="+outdir.name, "-jobname=formatitko", filename], check=True, env=env)
shutil.move(outdir.name+"/formatitko.pdf", args.output_pdf) shutil.move(outdir.name+"/formatitko.pdf", args.output_pdf)
if args.deps is not None: if args.deps is not None:

3
src/formatitko/html_generator.py

@ -344,6 +344,9 @@ class HTMLGenerator(OutputGenerator):
def generate_DefinitionList(self, e: DefinitionList): def generate_DefinitionList(self, e: DefinitionList):
self.writeln("<!-- FIXME: DefinitionLists not implemented -->") self.writeln("<!-- FIXME: DefinitionLists not implemented -->")
def generate_SmallCaps(self, e: SmallCaps):
self.generate_simple_tag(e, attributes=self.common_attributes(e) | {"style": "font-variant: small-caps;"})
class StandaloneHTMLGenerator(HTMLGenerator): class StandaloneHTMLGenerator(HTMLGenerator):
def generate_Doc(self, e: Doc): def generate_Doc(self, e: Doc):

4
src/formatitko/tex/formatitko.tex

@ -71,8 +71,8 @@
}} }}
\def\superscript#1{\leavevmode\raise3pt\hbox{\fiverm#1}} \def\superscript#1{$^{\hbox{#1}}$}
\def\subscript#1{\leavevmode\lower1pt\hbox{\fiverm#1}} \def\subscript#1{$_{\hbox{#1}}$}
\newcount\fncount \newcount\fncount
\fncount=1 \fncount=1
\def\fnmark{\superscript{\the\fncount}} \def\fnmark{\superscript{\the\fncount}}

5
src/formatitko/tex_generator.py

@ -381,3 +381,8 @@ class UCWTexGenerator(OutputGenerator):
def generate_Strikeout(self, e: Strikeout): def generate_Strikeout(self, e: Strikeout):
self.writeln("% FIXME: Strikeouts not implemented") self.writeln("% FIXME: Strikeouts not implemented")
def generate_SmallCaps(self, e: Strikeout):
self.write(r"{\csc{}")
self.generate(e.content)
self.write(r"}")

Loading…
Cancel
Save