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 sys
import os
import tempfile
import subprocess
import shutil
from pathlib import Path
# Import local files
from .util import import_md
@ -112,7 +114,12 @@ def main():
else:
filename = args.output_tex
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)
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):
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):
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\subscript#1{\leavevmode\lower1pt\hbox{\fiverm#1}}
\def\superscript#1{$^{\hbox{#1}}$}
\def\subscript#1{$_{\hbox{#1}}$}
\newcount\fncount
\fncount=1
\def\fnmark{\superscript{\the\fncount}}

5
src/formatitko/tex_generator.py

@ -381,3 +381,8 @@ class UCWTexGenerator(OutputGenerator):
def generate_Strikeout(self, e: Strikeout):
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