Skip to content

Commit

Permalink
Fix chapter on numerical evaluation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasper Peeters committed Jun 15, 2024
1 parent 6fa6ed6 commit 991469f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 54 deletions.
4 changes: 2 additions & 2 deletions config/buildbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ function runbuild {
# Parameters: VM name, package type, local ssh port, folder name on web server.

runbuild "Mint_21" ".deb" 7035 mint21
runbuild "Mint_20" ".deb" 7026 mint20
# runbuild "Mint_20" ".deb" 7026 mint20
runbuild "Ubuntu_22.04" ".deb" 7033 ubuntu2204
runbuild "Ubuntu_20.04" ".deb" 7030 ubuntu2004
# runbuild "Ubuntu_20.04" ".deb" 7030 ubuntu2004
#runbuild "Ubuntu_18.04" ".deb" 7017 ubuntu1804
#runbuild "Fedora_28" ".rpm" 7020 fedora28
#runbuild "Fedora_29" ".rpm" 7025 fedora29
Expand Down
15 changes: 11 additions & 4 deletions core/DataCell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void cadabra::HTML_recurse(const DTree& doc, DTree::iterator it, std::ostringstr
str << "<div class='image_png'><img src='data:image/png;base64,";
break;
case DataCell::CellType::image_svg:
str << "<div class='image_svg'><img src='data:image/svg,";
str << "<div class='image_svg'><img src='data:image/svg+xml;base64,";
break;
case DataCell::CellType::input_form:
str << "<div class='input_form'>";
Expand All @@ -229,7 +229,7 @@ void cadabra::HTML_recurse(const DTree& doc, DTree::iterator it, std::ostringstr
if(it->textbuf.size()>0) {
if(it->cell_type==DataCell::CellType::image_png)
str << it->textbuf;
if(it->cell_type==DataCell::CellType::image_svg)
else if(it->cell_type==DataCell::CellType::image_svg)
str << it->textbuf;
else if(it->cell_type!=DataCell::CellType::document && it->cell_type!=DataCell::CellType::latex) {
std::string out;
Expand Down Expand Up @@ -607,8 +607,15 @@ void cadabra::LaTeX_recurse(const DTree& doc, DTree::iterator it, std::ostringst
else if(it->cell_type==DataCell::CellType::image_svg) {
// Images have to be saved to disk as separate files as
// LaTeX has no concept of images embedded in the .tex file.
std::ofstream out(image_file_base+std::to_string(image_num)+".svg");
out << it->textbuf;
std::string basename=image_file_base+std::to_string(image_num);
std::ofstream out(basename+".svg");
out << base64_decode(it->textbuf);
out.close();
// Convert to pdf, otherwise LaTeX cannot include it.
// inkscape t.svg --export-pdf=t.pdf
int res = system((std::string("inkscape ")+basename+std::string(".svg --export-pdf=")+basename+std::string(".pdf")).c_str());
if(res!=0)
throw std::logic_error("DataCell::LaTeX_recurse: failed to run 'convert' to convert svg to pdf.");
++image_num;
}
else {
Expand Down
Loading

0 comments on commit 991469f

Please sign in to comment.