docs(src): Improve rendering of quotation marks
I have used a unicode lookalike for the single quote, as the normal latex way to include it is not supported by katex (`\textquotesingle`).
This commit is contained in:
parent
9be2b973f0
commit
7dd5da97f6
13
README.md
13
README.md
|
@ -24,6 +24,19 @@ If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
> A very simple programming language, used to map functions to commands
|
> A very simple programming language, used to map functions to commands
|
||||||
|
|
||||||
|
## Docs
|
||||||
|
If you want to generate the docs locally use this command, as they need KaTeX:
|
||||||
|
```sh
|
||||||
|
# Generate documentation for the dependencies
|
||||||
|
cargo doc
|
||||||
|
|
||||||
|
# Generate the documentation for this crate with the KaTeX header.
|
||||||
|
RUSTDOCFLAGS="--html-in-header ./docs/docs-header.html" cargo doc --no-deps
|
||||||
|
```
|
||||||
|
|
||||||
|
`docs.rs` already does this automatically because of the attribute in the `Cargo.toml`
|
||||||
|
file.
|
||||||
|
|
||||||
## Licence
|
## Licence
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
|
|
@ -47,19 +47,27 @@ If not, see <https://www.gnu.org/licenses/>.
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script>
|
<script>
|
||||||
|
// Workaround for rustdoc's "smart" quotation mark replacement feature
|
||||||
|
function normalize_quotes(math) {
|
||||||
|
// const orig = math;
|
||||||
|
|
||||||
|
math = math.replace(/”/g, "\"");
|
||||||
|
math = math.replace(/“/g, "\"");
|
||||||
|
|
||||||
|
math = math.replace(/’/g, "'");
|
||||||
|
math = math.replace(/‘/g, "'");
|
||||||
|
// console.log(`[\n${orig}\n] -> [\n${math}\n].`);
|
||||||
|
return math;
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
renderMathInElement(document.body, {
|
renderMathInElement(document.body, {
|
||||||
delimiters: [
|
delimiters: [
|
||||||
{ left: "$$", right: "$$", display: true },
|
{ left: "\\(", right: "\\)", display: false},
|
||||||
{ left: "\\(", right: "\\)", display: false },
|
{ left: "$", right: "$", display: false},
|
||||||
{ left: "$", right: "$", display: false },
|
{ left: "\\[", right: "\\]", display: true},
|
||||||
{ left: "\\[", right: "\\]", display: true },
|
],
|
||||||
]
|
preProcess: normalize_quotes,
|
||||||
// FIXME(@soispha): This removes the quotes completely <2023-10-31>
|
|
||||||
// macros: {
|
|
||||||
// "”": "\\noexpand ”",
|
|
||||||
// "“": "\\noexpand “",
|
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -34,18 +34,20 @@
|
||||||
//!
|
//!
|
||||||
//! Correctly spoken, the Language, containing all valid command names, is just the Kleene closure
|
//! Correctly spoken, the Language, containing all valid command names, is just the Kleene closure
|
||||||
//! over an Alphabet $\Sigma$, which contains all alphanumeric characters:
|
//! over an Alphabet $\Sigma$, which contains all alphanumeric characters:
|
||||||
//! $$ \Sigma_{cmd} = \\{x | 0 \leqslant x \leqslant 9\\} \cup \\{x | "a" \leqslant x \leqslant "z"\\} \cup \\{x | "A" \leqslant x \leqslant "Z"\\} \cup \\{"\\_", "\text{-}", "."\\} $$
|
//! \\[ \Sigma_{cmd} = \\{x | 0 \leqslant x \leqslant 9\\} \cup \\{x | "\text{a}" \leqslant x \leqslant "\text{z}"\\} \cup \\{x | "\text{A}" \leqslant x \leqslant "\text{Z}"\\} \cup \\{"\text{\\_}", "\text{-}", "."\\} \\]
|
||||||
//!
|
//!
|
||||||
//! ## Argument
|
//! ## Argument
|
||||||
//! Arguments constructed from the same alphabet as the commands, but can contain additional chars
|
//! Arguments constructed from the same alphabet as the commands, but can contain additional chars
|
||||||
//! listed in the [trinitry.pest](../../../src/trinitry.pest) file.
|
#![doc = concat!("listed in the [trinitry.pest](https://docs.rs/crate/trinitry/", env!("CARGO_PKG_VERSION"), "/source/src/trinitry.pest) file.")]
|
||||||
//! $$ \Sigma_{args} = \Sigma_{cmd} \cup{} \\{\\dots{}\\} $$
|
//! \\[ \Sigma_{args} = \Sigma_{cmd} \cup{} \\{\\dots{}\\} \\]
|
||||||
//!
|
//!
|
||||||
//! Besides the extra chars outlined above the arguments can also contain
|
//! Besides the extra chars outlined above the arguments can also contain
|
||||||
//! spaces and quotes, if they are quoted. Quoted args are either double quoted, and can thus
|
//! spaces and quotes, if they are quoted. Quoted args are either double quoted, and can thus
|
||||||
//! contain single quotes, or single quoted, and can contain double quotes.
|
//! contain single quotes, or single quoted, and can contain double quotes.
|
||||||
//! $$ \Sigma_{args-double-quoted} = \Sigma_{args} \cup \\{"\\text{\\texttt{'}}", "\\ "} $$
|
//! \\[
|
||||||
//! $$ \Sigma_{args-single-quoted} = \Sigma_{args} \cup \\{"\\text{\\texttt{"}}", "\\ "} $$
|
//! \Sigma_{args-double-quoted} = \Sigma_{args} \cup \\{"\texttt{ꞌ}", "\\ "\\} \\\\
|
||||||
|
//! \Sigma_{args-single-quoted} = \Sigma_{args} \cup \\{"\texttt{"}", "\\ "\\}
|
||||||
|
//! \\]
|
||||||
//!
|
//!
|
||||||
//! # Examples
|
//! # Examples
|
||||||
//! ## Command
|
//! ## Command
|
||||||
|
|
Loading…
Reference in New Issue