Compare commits

..

No commits in common. "fb80c61139a5b22a88cdf677421e8278acf1aca0" and "41f51bf6fe0db8beb0907a479f333db65459224b" have entirely different histories.

4 changed files with 16 additions and 92 deletions

View file

@ -76,18 +76,9 @@
\fncount=1
\def\fnmark{\superscript{\the\fncount}}
\def\fn#1{\footnote\fnmark{#1}\advance\fncount by 1}
\def\section#1#2{
\vfil\eject{\parskip1em\settextsize{20}\bf #1\kern 1em #2}
\addtoc\tocsection{#1}{}{#2}
}
\def\subsection#1#2{
{\parskip1em\settextsize{18}\bf #1\kern 1em #2}
\addtoc\tocsubsection{#1}{}{#2}
}
\def\subsubsection#1#2{
{\parskip1em\settextsize{16}\bf #1\kern 1em #2}
\addtoc\tocsubsubsection{#1}{}{#2}
}
\def\section#1#2{\vfil\eject{\parskip1em\settextsize{20}\bf #1\kern 1em #2}}
\def\subsection#1#2{{\parskip1em\settextsize{18}\bf #1\kern 1em #2}}
\def\subsubsection#1#2{{\parskip1em\settextsize{16}\bf #1\kern 1em #2}}
\def\subsubsubsection#1#2{{\parskip1em\settextsize{14}\bf #1\kern 1em #2}}
\def\subsubsubsubsection#1#2{{\parskip1em\settextsize{12}\bf #1\kern 1em #2}}
\def\subsubsubsubsubsection#1#2{{\parskip1em\settextsize{10}\bi #1\kern 1em #2}}
@ -200,17 +191,3 @@
}}}
}}
% Obsah a odkazy
\newwrite\tocfile
\immediate\openout\tocfile=toc-new.aux
% Voláme: \addtoc\tocmacro{number}{asterisks}{title}
\long\def\addtoc#1#2#3#4{
\edef\brum{
\write\tocfile{\string#1{\noexpand\the\noexpand\count0}{#2}{#3}{#4}}
}
\brum
}

View file

@ -1,23 +0,0 @@
{
\def\pagelink#1{#1}
\def\toclink#1#2{%
#2
}
\def\stdskip{\vskip 3pt}
\def\tocsection#1#2#3#4{
\line{\settextsize{14}\bf\hbox to 2em{#2\hfil}#4~\hfil\pagelink{#1}}\stdskip
}
\def\tocsubsection#1#2#3#4{
\line{\bf\hskip 1.5cm \hbox to 3em{#2\hfil}#4~\hfil\pagelink{#1}}\stdskip
}
\def\tocsubsubsection#1#2#3#4{
\line{\bf\hskip 3cm \hbox to 4em{#2\hfil}#4~\hfil\pagelink{#1}}\stdskip
}
\def\tocpicture#1#2#3#4{}
\vskip 1cm
\input toc.aux
}

View file

@ -1,18 +0,0 @@
{
\def\pagelink#1{#1}
\def\toclink#1#2{%
#2
}
\def\stdskip{\vskip 3pt}
\def\tocsection#1#2#3#4{}
\def\tocsubsection#1#2#3#4{}
\def\tocsubsubsection#1#2#3#4{}
\def\tocpicture#1#2#3#4{
\line{\hbox to 2em{#2\hfil}#4~\hfil\pagelink{#1}}\stdskip
}
\vskip 1cm
\input toc.aux
}

View file

@ -27,25 +27,19 @@ class UCWTexGenerator(OutputGenerator):
super().__init__(output_file, *args, **kwargs)
def escape_special_chars(self, text: str) -> str:
if '\\' in text:
print("ESCAPE", text)
out = ""
for char in text:
out += {
'&': r"\&",
'%': r"\%",
'$': r"\$",
'#': r"\#",
'_': r"\_",
'{': r"\{",
'}': r"\}",
'~': r"\textasciitilde{}",
'^': r"\textasciicircum{}",
'\\': r"\textbackslash{}",
' ': r"~",
'': r"",
}.get(char, char)
return out
text = text.replace("&", r"\&")
text = text.replace("%", r"\%")
text = text.replace("$", r"\$")
text = text.replace("#", r"\#")
text = text.replace("_", r"\_")
text = text.replace("{", r"\{")
text = text.replace("}", r"\}")
text = text.replace("~", r"\textasciitilde{}")
text = text.replace("^", r"\textasciicircum{}")
text = text.replace("\\", r"\textbackslash{}")
text = text.replace(" ", "~") # We use unicode no-break spaces to force nbsp in output
text = text.replace("", "")
return text
def generate(self, e: Union[Element, ListContainer]):
if hasattr(e, "attributes") and "only" in e.attributes and e.attributes["only"] != "tex":
@ -170,12 +164,6 @@ class UCWTexGenerator(OutputGenerator):
if 'number' in e.attributes:
self.writeln(f"Obrázek {e.attributes['number']}:")
self.generate(e.caption)
if 'number' in e.attributes:
self.writeln(r"\addtoc\tocpicture{"+str(e.attributes['number'])+"}{}{")
self.indent_more()
self.generate(e.caption.content)
self.indent_less()
self.writeln("}")
self.indent_less()
self.writeln(r"}{}")
self.ensure_empty(2)