From: Vladimír Vondruš Date: Mon, 11 Dec 2017 02:23:59 +0000 (+0100) Subject: m.math: initial test. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=2298600adb1c8f06cd12eaa5a08ffa2456f3d698;p=blog.git m.math: initial test. --- diff --git a/doc/plugins/math-and-code-test.rst b/doc/plugins/math-and-code-test.rst deleted file mode 100644 index 06f22ae6..00000000 --- a/doc/plugins/math-and-code-test.rst +++ /dev/null @@ -1,42 +0,0 @@ -.. - This file is part of m.css. - - Copyright © 2017 Vladimír VondruÅ¡ - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -.. - -Test -#### - -:save_as: plugins/math-and-code/test/index.html -:breadcrumb: {filename}/plugins.rst Pelican plugins - {filename}/plugins/math-and-code.rst Math and code - -.. role:: tex(code) - :language: latex - -Properly align *huge* formulas vertically on a line: :math:`\hat q^{-1} = \frac{\hat q^*}{|\hat q|^2}` -and make sure there's enough space for all the complex :math:`W` things between -the lines :math:`W = \sum_{i=0}^{n} \frac{w_i}{h_i}` because :math:`Y = \sum_{i=0}^{n} B` - -The :tex:`\\cfrac` thing doesn't align well: :math:`W = \sum_{i=0}^{n} \cfrac{w_i}{h_i}` - -Huh, apparently backslashes have to be escaped in things like this: -:tex:`\frac` diff --git a/pelican-plugins/m/test/math/page.html b/pelican-plugins/m/test/math/page.html new file mode 100644 index 00000000..57f0a552 --- /dev/null +++ b/pelican-plugins/m/test/math/page.html @@ -0,0 +1,217 @@ + + + + + m.math | A Pelican Blog + + + + + + + + + + + + + +
+
+
+
+
+
+

m.math

+ +

Inline colored math +LaTeX Math + +a^2 + + + + + + + + + + and colored math block:

+
+ +LaTeX Math + +a^2 + b^2 = c^2 + + + + + + + + + + + + + + + + + + + +
+

Properly align huge formulas vertically on a line: + +LaTeX Math + +\hat q^{-1} = \frac{\hat q^*}{|\hat q|^2} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +and make sure there's enough space for all the complex +LaTeX Math + +W + + + + + + + + things between +the lines +LaTeX Math + +W = \sum_{i=0}^{n} \frac{w_i}{h_i} + + + + + + + + + + + + + + + + + + + + + + + + + + + + because + +LaTeX Math + +Y = \sum_{i=0}^{n} B + + + + + + + + + + + + + + + + + + + + + +

+

The \cfrac thing doesn't align well: +LaTeX Math + +W = \sum_{i=0}^{n} \cfrac{w_i}{h_i} + + + + + + + + + + + + + + + + + + + + + + + + + + +

+

Huh, apparently backslashes have to be escaped in things like this: +frac

+ +
+
+
+
+
+ + diff --git a/pelican-plugins/m/test/math/page.rst b/pelican-plugins/m/test/math/page.rst new file mode 100644 index 00000000..c920d1d0 --- /dev/null +++ b/pelican-plugins/m/test/math/page.rst @@ -0,0 +1,27 @@ +m.math +###### + +:summary: no. + +.. role:: tex(code) + :language: tex +.. role:: math-primary(math) + :class: m-primary + +Inline colored math :math-primary:`a^2` and colored math block: + +.. math:: + :class: m-success + + a^2 + b^2 = c^2 + +Properly align *huge* formulas vertically on a line: +:math:`\hat q^{-1} = \frac{\hat q^*}{|\hat q|^2}` +and make sure there's enough space for all the complex :math:`W` things between +the lines :math:`W = \sum_{i=0}^{n} \frac{w_i}{h_i}` because +:math:`Y = \sum_{i=0}^{n} B` + +The :tex:`\\cfrac` thing doesn't align well: :math:`W = \sum_{i=0}^{n} \cfrac{w_i}{h_i}` + +Huh, apparently backslashes have to be escaped in things like this: +:tex:`\frac` diff --git a/pelican-plugins/m/test/test_math.py b/pelican-plugins/m/test/test_math.py new file mode 100644 index 00000000..91894afa --- /dev/null +++ b/pelican-plugins/m/test/test_math.py @@ -0,0 +1,12 @@ +from m.test import PluginTestCase + +class Math(PluginTestCase): + def __init__(self, *args, **kwargs): + super().__init__(__file__, '', *args, **kwargs) + + def test(self): + self.run_pelican({ + 'PLUGINS': ['m.htmlsanity', 'm.math'] + }) + + self.assertEqual(*self.actual_expected_contents('page.html'))