~xigoi/xidoc

ab399f9909ec14922f783dfbffba087ece91dcca — Adam Blažek 2 months ago 3400952
Set comprehension
3 files changed, 5 insertions(+), 2 deletions(-)

M docs/commands.html
M docs/commands.xd
M src/xidocpkg/commands/math.nim
M docs/commands.html => docs/commands.html +1 -0
@@ 358,6 358,7 @@ M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s">
<tr><td><code class="language-xidoc"><span class="token punctuation">[</span><span class="token tag">.</span> \frac{p}{q}<span class="token punctuation">]</span></code></td><td><xd-block-math><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo fence="true">(</mo><mfrac><mi>p</mi><mi>q</mi></mfrac><mo fence="true">)</mo></mrow><annotation encoding="application/x-tex">{\left(\frac{p}{q}\right)}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.40003em;vertical-align:-0.95003em;"></span><span class="mord"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1075599999999999em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804400000000001em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">)</span></span></span></span></span></span></span></span></xd-block-math></td></tr>
<tr><td><code class="language-xidoc"><span class="token punctuation">[</span><span class="token tag">()</span> \frac{p}{q}<span class="token punctuation">]</span></code></td><td><xd-block-math><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo fence="true">[</mo><mfrac><mi>p</mi><mi>q</mi></mfrac><mo fence="true">]</mo></mrow><annotation encoding="application/x-tex">{\left[\frac{p}{q}\right]}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.40003em;vertical-align:-0.95003em;"></span><span class="mord"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">[</span></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1075599999999999em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804400000000001em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">]</span></span></span></span></span></span></span></span></xd-block-math></td></tr>
<tr><td><code class="language-xidoc"><span class="token punctuation">[</span><span class="token tag">{}</span> \frac{p}{q}<span class="token punctuation">]</span></code></td><td><xd-block-math><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo fence="true">{</mo><mfrac><mi>p</mi><mi>q</mi></mfrac><mo fence="true">}</mo></mrow><annotation encoding="application/x-tex">{\left\{\frac{p}{q}\right\}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.40003em;vertical-align:-0.95003em;"></span><span class="mord"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">{</span></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1075599999999999em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804400000000001em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">}</span></span></span></span></span></span></span></span></xd-block-math></td></tr>
<tr><td><code class="language-xidoc"><span class="token punctuation">[</span><span class="token tag">{}</span> x \in \R<span class="token punctuation">;</span> x^2 &lt; 2<span class="token punctuation">]</span></code></td><td><xd-block-math><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo fence="true">{</mo><mi>x</mi><mo>∈</mo><mi mathvariant="double-struck">R</mi><mtext> </mtext><mo fence="true" lspace="0.05em" rspace="0.05em">|</mo><mtext> </mtext><msup><mi>x</mi><mn>2</mn></msup><mo>&lt;</mo><mn>2</mn><mo fence="true">}</mo></mrow><annotation encoding="application/x-tex">{\left\{x \in \R\,\middle|\,x^2 &lt; 2\right\}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2141179999999998em;vertical-align:-0.35001em;"></span><span class="mord"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size1">{</span></span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord mathbb">R</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span><span class="delimsizing mult"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.86199em;"><span style="top:-2.2559899999999997em;"><span class="pstrut" style="height:2.606em;"></span><span class="delimsizinginner delim-size1"><span>∣</span></span></span><span style="top:-2.85399em;"><span class="pstrut" style="height:2.606em;"></span><span style="height:0.016em;width:0.333em;"><svg xmlns="http://www.w3.org/2000/svg" width='0.333em' height='0.016em' style='width:0.333em' viewBox='0 0 333 16' preserveAspectRatio='xMinYMin'><path d='M145 0 H188 V16 H145z M145 0 H188 V16 H145z'/></svg></span></span><span style="top:-2.86199em;"><span class="pstrut" style="height:2.606em;"></span><span class="delimsizinginner delim-size1"><span>∣</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.35000999999999993em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641079999999999em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">&lt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord">2</span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size1">}</span></span></span></span></span></span></span></span></xd-block-math></td></tr>
<tr><td><code class="language-xidoc"><span class="token punctuation">[</span><span class="token tag">&lt;></span> \frac{p}{q}<span class="token punctuation">]</span></code></td><td><xd-block-math><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo fence="true">⟨</mo><mfrac><mi>p</mi><mi>q</mi></mfrac><mo fence="true">⟩</mo></mrow><annotation encoding="application/x-tex">{\left\langle \frac{p}{q}\right\rangle}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.40003em;vertical-align:-0.95003em;"></span><span class="mord"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">⟨</span></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1075599999999999em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804400000000001em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">⟩</span></span></span></span></span></span></span></span></xd-block-math></td></tr>
<tr><td><code class="language-xidoc"><span class="token punctuation">[</span><span class="token tag">|</span> \frac{p}{q}<span class="token punctuation">]</span></code></td><td><xd-block-math><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo fence="true">∣</mo><mfrac><mi>p</mi><mi>q</mi></mfrac><mo fence="true">∣</mo></mrow><annotation encoding="application/x-tex">{\left\lvert \frac{p}{q}\right\rvert}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.41202em;vertical-align:-0.9500199999999999em;"></span><span class="mord"><span class="minner"><span class="mopen"><span class="delimsizing mult"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.462em;"><span style="top:-2.266em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∣</span></span></span><span style="top:-2.864em;"><span class="pstrut" style="height:3.21602em;"></span><span style="height:1.2160199999999999em;width:0.333em;"><svg xmlns="http://www.w3.org/2000/svg" width='0.333em' height='1.2160199999999999em' style='width:0.333em' viewBox='0 0 333 1216' preserveAspectRatio='xMinYMin'><path d='M145 0 H188 V1216 H145z M145 0 H188 V1216 H145z'/></svg></span></span><span style="top:-4.07202em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∣</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.9500199999999999em;"><span></span></span></span></span></span></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1075599999999999em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804400000000001em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose"><span class="delimsizing mult"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.462em;"><span style="top:-2.266em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∣</span></span></span><span style="top:-2.864em;"><span class="pstrut" style="height:3.21602em;"></span><span style="height:1.2160199999999999em;width:0.333em;"><svg xmlns="http://www.w3.org/2000/svg" width='0.333em' height='1.2160199999999999em' style='width:0.333em' viewBox='0 0 333 1216' preserveAspectRatio='xMinYMin'><path d='M145 0 H188 V1216 H145z M145 0 H188 V1216 H145z'/></svg></span></span><span style="top:-4.07202em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∣</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.9500199999999999em;"><span></span></span></span></span></span></span></span></span></span></span></span></span></xd-block-math></td></tr>
<tr><td><code class="language-xidoc"><span class="token punctuation">[</span><span class="token tag">||</span> \frac{p}{q}<span class="token punctuation">]</span></code></td><td><xd-block-math><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo fence="true">∥</mo><mfrac><mi>p</mi><mi>q</mi></mfrac><mo fence="true">∥</mo></mrow><annotation encoding="application/x-tex">{\left\lVert \frac{p}{q}\right\rVert}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.41202em;vertical-align:-0.9500199999999999em;"></span><span class="mord"><span class="minner"><span class="mopen"><span class="delimsizing mult"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.462em;"><span style="top:-2.266em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∥</span></span></span><span style="top:-2.864em;"><span class="pstrut" style="height:3.21602em;"></span><span style="height:1.2160199999999999em;width:0.556em;"><svg xmlns="http://www.w3.org/2000/svg" width='0.556em' height='1.2160199999999999em' style='width:0.556em' viewBox='0 0 556 1216' preserveAspectRatio='xMinYMin'><path d='M145 0 H188 V1216 H145z M145 0 H188 V1216 H145zM367 0 H410 V1216 H367z M367 0 H410 V1216 H367z'/></svg></span></span><span style="top:-4.07202em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∥</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.9500199999999999em;"><span></span></span></span></span></span></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1075599999999999em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804400000000001em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose"><span class="delimsizing mult"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.462em;"><span style="top:-2.266em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∥</span></span></span><span style="top:-2.864em;"><span class="pstrut" style="height:3.21602em;"></span><span style="height:1.2160199999999999em;width:0.556em;"><svg xmlns="http://www.w3.org/2000/svg" width='0.556em' height='1.2160199999999999em' style='width:0.556em' viewBox='0 0 556 1216' preserveAspectRatio='xMinYMin'><path d='M145 0 H188 V1216 H145z M145 0 H188 V1216 H145zM367 0 H410 V1216 H367z M367 0 H410 V1216 H367z'/></svg></span></span><span style="top:-4.07202em;"><span class="pstrut" style="height:3.21602em;"></span><span class="delimsizinginner delim-size1"><span>∥</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.9500199999999999em;"><span></span></span></span></span></span></span></span></span></span></span></span></span></xd-block-math></td></tr>

M docs/commands.xd => docs/commands.xd +1 -0
@@ 568,6 568,7 @@ const factorial = (n) => {
    [math-cmd .; \frac{p}{q}]
    [math-cmd (); \frac{p}{q}]
    [math-cmd {}; \frac{p}{q}]
    [math-cmd {}; x \in \R[;] x^2 < 2]
    [math-cmd <>; \frac{p}{q}]
    [math-cmd |; \frac{p}{q}]
    [math-cmd ||; \frac{p}{q}]

M src/xidocpkg/commands/math.nim => src/xidocpkg/commands/math.nim +3 -2
@@ 4,6 4,7 @@ import ../error
import ../jsinterpret
import ../types
import ./utils
import aspartame
import matext
import std/options
import std/sets


@@ 27,8 28,8 @@ commands mathCommands:
    "{\\left($1\\right)}" % arg
  proc bracketsCmd(arg: !String): String {.command: "()".} =
    "{\\left[$1\\right]}" % arg
  proc bracesCmd(arg: !String): String {.command: "{}".} =
    "{\\left\\{$1\\right\\}}" % arg
  proc bracesCmd(x: !String, y: ?String): String {.command: "{}".} =
    "{\\left\\{$1\\right\\}}" % (x & ifSome(y, "\\,\\middle|\\," & y, ""))
  proc anglesCmd(arg: !String): String {.command: "<>".} =
    "{\\left\\langle $1\\right\\rangle}" % arg
  proc pipeCmd(arg: !String): String {.command: "|".} =