File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -65,28 +65,28 @@ def metaext(src):
6565def sanitize_meta (value : str ) -> str :
6666 """Sanitize a metadata value for safe LaTeX insertion."""
6767 if value is None :
68- return ""
69-
68+ return ""
69+
7070 sanitized = value .strip ()
7171 if sanitized .startswith (('"' , "'" )) and sanitized .endswith (('"' , "'" )):
7272 sanitized = sanitized [1 :- 1 ]
73-
73+
7474 replacements = {
75- "\\ " : r"\\ textbackslash{}" ,
76- "{" : r"\\ {" ,
77- "}" : r"\\ }" ,
78- "$" : r"\\ $" ,
79- "&" : r"\\ &" ,
80- "#" : r"\\ #" ,
81- "_" : r"\\ _" ,
82- "%" : r"\\ %" ,
83- "^" : r"\\ textasciicircum{}" ,
84- "~" : r"\\ textasciitilde{}" ,
75+ "\\ " : r"\textbackslash{}" ,
76+ "{" : r"\{" ,
77+ "}" : r"\}" ,
78+ "$" : r"\$" ,
79+ "&" : r"\&" ,
80+ "#" : r"\#" ,
81+ "_" : r"\_" ,
82+ "%" : r"\%" ,
83+ "^" : r"\textasciicircum{}" ,
84+ "~" : r"\textasciitilde{}" ,
8585 }
86-
86+
8787 for needle , replacement in replacements .items ():
8888 sanitized = sanitized .replace (needle , replacement )
89-
89+
9090 return sanitized
9191
9292def metainj (dst ):
You can’t perform that action at this time.
0 commit comments