Skip to content

Commit d9274ef

Browse files
committed
feat(renderer.py): add title render
1 parent f444ab4 commit d9274ef

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

vrdu/renderer.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,19 @@ def __init__(self) -> None:
6969
self.texts = defaultdict(list)
7070

7171
def enclose_title(self, data, color="red") -> None:
72-
# TODO: add title rendering
73-
pass
72+
for item in data:
73+
if not isinstance(item, dict):
74+
continue
75+
76+
env = find_env(item, ["title"])
77+
if env is None:
78+
continue
79+
80+
self.texts["Title"].append(item[env])
81+
title_text = item[env][len(env) + 2 : -1]
82+
item[env] = (
83+
"\\" + env + "{" + r"\textcolor{" + color + "}{" + title_text + "}}"
84+
)
7485

7586
def enclose_section(self, data, color="red") -> None:
7687
"""

0 commit comments

Comments
 (0)