8#include "nlohmann/json.hpp"
116 class DTree :
public tree<DataCell> {
119 DTree(
const iterator&);
138 strip_code=
false, std::string title=
"");
140 const std::string& preamble_string,
141 bool for_embedding=
false,
bool strip_code=
false, std::string title=
"");
151 std::string
export_as_LaTeX(
const DTree& doc,
const std::string& image_file_base,
bool for_embedding=
false);
153 const std::string& preamble_string,
const std::string& image_file_base,
154 int& image_num,
bool for_embedding);
168 nlohmann::json
ipynb2cnb(
const nlohmann::json&);
172 nlohmann::json
cnb2ipynb(
const nlohmann::json&);
Definition DataCell.hh:116
DTree()
Definition DataCell.cc:31
bool hide_input_cells
Definition DataCell.hh:121
Each cell is identified by a serial number 'id' which is used to keep track of it across network call...
Definition DataCell.hh:53
uint64_t id
Definition DataCell.hh:57
bool operator<(const id_t &other) const
Definition DataCell.cc:41
bool created_by_client
Definition DataCell.hh:58
id_t()
Definition DataCell.cc:48
CellType cell_type
Definition DataCell.hh:76
bool running
Indicator whether this cell is currently being evaluated by the server.
Definition DataCell.hh:102
std::set< std::string > variables_referenced
List of all variables referenced in this cell.
Definition DataCell.hh:110
bool ignore_on_import
Flag indicating whether this cell should be ignored in case the notebook is imported.
Definition DataCell.hh:96
CellType
Cells are labelled with the data type of its contents, which is stored in a textural representation b...
Definition DataCell.hh:34
@ python
input : editor cell for code in python
Definition DataCell.hh:36
bool hidden
Flag indicating whether this cell should be hidden from view.
Definition DataCell.hh:90
id_t id() const
Return the cell ID. This is essentially a random UUID.
Definition DataCell.cc:580
id_t serial_number
Definition DataCell.hh:113
bool sensitive
Definition DataCell.hh:91
DataCell(CellType t=CellType::python, const std::string &str="", bool hidden=false)
Standard constructor, generates a new unique id for this DataCell.
Definition DataCell.cc:54
std::string textbuf
Textual representation of the cell content.
Definition DataCell.hh:83
Functions to handle the exchange properties of two or more symbols in a product.
Definition Adjform.cc:83
void LaTeX_recurse(const DTree &doc, DTree::iterator it, std::ostringstream &str, const std::string &preamble_string, const std::string &image_file_base, int &image_num, bool for_embedding)
Definition DataCell.cc:608
nlohmann::json cnb2ipynb(const nlohmann::json &)
Convert the JSON of a Cadabra notebook to a Jupyter notebook.
Definition DataCell.cc:860
std::string export_as_HTML(const DTree &doc, bool for_embedding=false, bool strip_code=false, std::string title="")
Export a document to a single self-contained HTML file containing inline CSS.
Definition DataCell.cc:84
std::string export_as_python(const DTree &doc)
Export a document to a python-like file (converting text cells to comments and python cells to python...
Definition DataCell.cc:759
nlohmann::json ipynb2cnb(const nlohmann::json &)
Replace all occurrences of a substring in the original string.
Definition DataCell.cc:800
void JSON_deserialise(const std::string &, DTree &)
Load a document from .cnb format, i.e. the inverse of the above.
Definition DataCell.cc:427
std::string latex_to_html(const std::string &)
Convert various LaTeX constructions to HTML-with-Mathjax, e.g.
Definition DataCell.cc:102
void JSON_in_recurse(DTree &doc, DTree::iterator loc, const nlohmann::json &cells)
Definition DataCell.cc:466
std::string export_as_LaTeX(const DTree &doc, const std::string &image_file_base, bool for_embedding=false)
Export a document to a single self-contained LaTeX file, with the exception of images which get saved...
Definition DataCell.cc:585
void JSON_recurse(const DTree &, DTree::iterator, nlohmann::json &)
Definition DataCell.cc:347
void python_recurse(const DTree &doc, DTree::iterator it, std::ostringstream &str)
Definition DataCell.cc:767
void HTML_recurse(const DTree &doc, DTree::iterator it, std::ostringstream &str, const std::string &preamble_string, bool for_embedding=false, bool strip_code=false, std::string title="")
Definition DataCell.cc:193
std::string JSON_serialise(const DTree &)
Serialise a document into .cj format, which is a JSON version of the document tree.
Definition DataCell.cc:336