Skip to content

Commit 34b60ec

Browse files
pedritomelenasolexandr-konovalov
authored andcommitted
stop using Base64String
1 parent b1801b3 commit 34b60ec

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

gap/JupyterUtil.gi

+8-21
Original file line numberDiff line numberDiff line change
@@ -89,35 +89,22 @@ function(tikz)
8989

9090
else
9191
ltx := Concatenation( "pdf2svg ", Concatenation( fn, ".pdf" ), " ",
92-
svgfile);
92+
svgfile, "; base64 ", svgfile," >> ", b64file );
9393
fi;
9494
Exec( ltx );
9595
if not( IsExistingFile( svgfile ) ) then
9696
tojupyter := rec( json := true, name := "stdout",
9797
data := "No svg was created; pdf2svg is installed in your system?", metadata := rec());
9898
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
9999
fi;
100-
if ARCH_IS_MAC_OS_X() then
101-
stream := InputTextFile( b64file );
102-
if stream <> fail then
103-
svgdata := ReadLine( stream );
104-
CloseStream( stream );
105-
else
106-
tojupyter := rec( json := true, name := "stdout",
107-
data := Concatenation( "Unable to render ", tikz ), metadata := rec() );
108-
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
109-
fi;
100+
stream := InputTextFile( b64file );
101+
if stream <> fail then
102+
svgdata := ReadAll( stream );
103+
CloseStream( stream );
110104
else
111-
stream := InputTextFile( svgfile );
112-
if stream <> fail then
113-
svgdata := ReadAll( stream );
114-
svgdata:= SubstitutionSublist(Base64String(svgdata),"\n","");
115-
CloseStream( stream );
116-
else
117-
tojupyter := rec( json := true, name := "stdout",
118-
data := Concatenation( "Unable to render ", tikz ), metadata := rec() );
119-
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
120-
fi;
105+
tojupyter := rec( json := true, name := "stdout",
106+
data := Concatenation( "Unable to render ", tikz ), metadata := rec() );
107+
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
121108
fi;
122109

123110
img:=Concatenation("<img src='data:image/svg+xml;base64,", svgdata,"'>");

0 commit comments

Comments
 (0)