content)
-def renderIcon(icon_path: str | None) -> bytes | None:
- if icon_path is None:
- return None
- return (
- br'\includegraphics[width=\glowiconsize,height=\glowiconsize,keepaspectratio]{%s}' %
- icon_path.encode('UTF-8'))
-
-
class Layout(ABC):
@abstractmethod
self._texifier = texifier
def renderChunk(self, chunk: Chunk) -> bytes:
- icon = renderIcon(chunk.icon)
- meta = [icon] if icon else []
+ meta = []
+ if chunk.icon:
+ meta += [br'\glowicon{%s}' % chunk.icon.encode('UTF-8')]
meta += [self._texifier.texify(x)
for x in [chunk.character, chunk.screen_name, chunk.author]
if x is not None]
self._texifier = texifier
def renderChunk(self, chunk: Chunk) -> bytes:
- icon = renderIcon(chunk.icon)
meta = [
chunk.character,
chunk.screen_name,
\strut
''' % (
- icon if icon else b'',
+ br'\glowicon{%s}' % chunk.icon.encode('UTF-8') if chunk.icon else b'',
br'\\*'.join(self._texifier.texify(x) for x in meta if x is not None),
self._texifier.texify(chunk.content))
spec.texout.write(br'''\begin{document}
\newcommand{\href}[2]{#2\footnote{\detokenize{#1}}}
\def\glowiconsize{%fmm}
+\newcommand{\glowicon}[1]{\includegraphics[
+ width=\glowiconsize,height=\glowiconsize,keepaspectratio
+]{#1}}
''' % spec.icon_size)
url = flatURL(spec.url)
spec.log('Fetching HTML...\r')