Skip to content

Commit

Permalink
stop using Base64String
Browse files Browse the repository at this point in the history
  • Loading branch information
pedritomelenas authored and olexandr-konovalov committed Aug 29, 2024
1 parent b1801b3 commit 34b60ec
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions gap/JupyterUtil.gi
Original file line number Diff line number Diff line change
Expand Up @@ -89,35 +89,22 @@ function(tikz)

else
ltx := Concatenation( "pdf2svg ", Concatenation( fn, ".pdf" ), " ",
svgfile);
svgfile, "; base64 ", svgfile," >> ", b64file );
fi;
Exec( ltx );
if not( IsExistingFile( svgfile ) ) then
tojupyter := rec( json := true, name := "stdout",
data := "No svg was created; pdf2svg is installed in your system?", metadata := rec());
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
fi;
if ARCH_IS_MAC_OS_X() then
stream := InputTextFile( b64file );
if stream <> fail then
svgdata := ReadLine( stream );
CloseStream( stream );
else
tojupyter := rec( json := true, name := "stdout",
data := Concatenation( "Unable to render ", tikz ), metadata := rec() );
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
fi;
stream := InputTextFile( b64file );
if stream <> fail then
svgdata := ReadAll( stream );
CloseStream( stream );
else
stream := InputTextFile( svgfile );
if stream <> fail then
svgdata := ReadAll( stream );
svgdata:= SubstitutionSublist(Base64String(svgdata),"\n","");
CloseStream( stream );
else
tojupyter := rec( json := true, name := "stdout",
data := Concatenation( "Unable to render ", tikz ), metadata := rec() );
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
fi;
tojupyter := rec( json := true, name := "stdout",
data := Concatenation( "Unable to render ", tikz ), metadata := rec() );
return JupyterRenderable(tojupyter.data, tojupyter.metadata);
fi;

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

0 comments on commit 34b60ec

Please sign in to comment.