feature: add photos

This commit is contained in:
Prof. Dr. Matthias Jung DL9MJ
2025-05-13 23:25:09 +02:00
parent 0a7b885702
commit 0236f65bce
3 changed files with 50 additions and 8 deletions
+13 -3
View File
@@ -1,11 +1,11 @@
from mistletoe.latex_renderer import LaTeXRenderer
from renderer.picture import Picture
from .comment import BlockComment
from .dash import Dash
from .halfwidth_spaces import HalfwidthSpaces
from .nonbreaking_spaces import NonbreakingSpaces, NonbreakingSpacesDots
from .photo import Photo
from .picture import Picture
from .question import Question
from .quote import Quote
from .tag import Tag
@@ -24,7 +24,8 @@ class FiftyOhmLaTeXRenderer(LaTeXRenderer):
NonbreakingSpaces,
NonbreakingSpacesDots,
Question,
Picture
Picture,
Photo
)
self.question_renderer = question_renderer
@@ -103,4 +104,13 @@ class FiftyOhmLaTeXRenderer(LaTeXRenderer):
\label{{{ref}}}"""
def render_picture(self, token) :
return self.render_picture_helper(token.id, token.ref, token.text, token.number)
@staticmethod
def render_photo_helper(id, ref, text, number):
return rf"""\includegraphics[width=1.0\linewidth]{{photo/{id}}}
\captionof{{figure}}{{{text}}}
\label{{{ref}}}"""
def render_photo(self, token) :
return self.render_picture_helper(token.id, token.ref, token.text, token.number)