|
wxMaxima
|
The building blocks of the Typst export (GH #2687). More...
#include <wx/string.h>Go to the source code of this file.
Functions | |
| wxString | wxm::typst::String (const wxString &text) |
| A Typst string literal: "text", with backslashes, quotes and newlines escaped. | |
| wxString | wxm::typst::MathText (const wxString &text) |
| A piece of text in maths: bare if Typst reads it as what it shows, else a string. | |
| bool | wxm::typst::IsAtom (const wxString &math) |
| True if Typst reads this piece of maths as one unit. | |
| bool | wxm::typst::IsParenGroup (const wxString &math) |
| True if math is one group in round parentheses from start to end. | |
| wxString | wxm::typst::Script (const wxString &math) |
| Makes a piece of maths usable as a script: x^Script(...) | |
| wxString | wxm::typst::Arg (const wxString &math) |
| Makes a piece of maths usable as an argument of a function like sqrt() | |
| wxString | wxm::typst::Attach (const wxString &base, const wxString &sup, const wxString &sub={}, const wxString &preSup={}, const wxString &preSub={}) |
| A base with scripts attached. | |
| wxString | wxm::typst::Join (const wxString &a, const wxString &b) |
| Two pieces of maths, separated by a space if both are there. | |
| wxString | wxm::typst::Markup (const wxString &text, bool keepBullets=false) |
| Escapes text for Typst markup (prose, not maths) | |
| wxString | wxm::typst::RawBlock (const wxString &code, const wxString &lang={}) |
| A raw (verbatim) block, fenced with more backticks than the code contains. | |
The building blocks of the Typst export (GH #2687).
Typst's maths syntax looks like LaTeX's with the backslashes taken out, but it reads differently in a few places that an exporter has to get right, and that each cell's ToTypst() would otherwise have to get right on its own:
GUI-free, so test_TypstMarkup can pin it directly.
| wxString wxm::typst::Arg | ( | const wxString & | math | ) |
Makes a piece of maths usable as an argument of a function like sqrt()
Escapes the commas and semicolons that are not inside a bracket, a string or a function call of their own, as those would separate arguments.
| wxString wxm::typst::Attach | ( | const wxString & | base, |
| const wxString & | sup, | ||
| const wxString & | sub = {}, |
||
| const wxString & | preSup = {}, |
||
| const wxString & | preSub = {} |
||
| ) |
A base with scripts attached.
| base | The base |
| sup | The superscript, or empty |
| sub | The subscript, or empty |
| preSup | A superscript in front of the base, or empty |
| preSub | A subscript in front of the base, or empty |
Written as base_sub^sup where that is enough, as attach() where the base is more than one unit or there are scripts in front.
| bool wxm::typst::IsAtom | ( | const wxString & | math | ) |
True if Typst reads this piece of maths as one unit.
A single character (or escaped character), a number, a name like pi or dots.h, a string, or a group in matching delimiters from start to end.
| wxString wxm::typst::Markup | ( | const wxString & | text, |
| bool | keepBullets = false |
||
| ) |
Escapes text for Typst markup (prose, not maths)
| text | The text |
| keepBullets | Leave a line's leading "* " alone, so the markdown pass that follows can still see the bullet. |
| wxString wxm::typst::MathText | ( | const wxString & | text | ) |
| wxString wxm::typst::RawBlock | ( | const wxString & | code, |
| const wxString & | lang = {} |
||
| ) |
A raw (verbatim) block, fenced with more backticks than the code contains.
| code | The text |
| lang | The language tag, or empty |
| wxString wxm::typst::Script | ( | const wxString & | math | ) |
Makes a piece of maths usable as a script: x^Script(...)
Atoms stay as they are, anything else is put in parentheses – which Typst then removes again, so a parenthesized group gets a second pair.