chiark / gitweb /
m.code: initial test.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 01:22:53 +0000 (02:22 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 02:03:32 +0000 (03:03 +0100)
pelican-plugins/m/test/code/console.ansi [new symlink]
pelican-plugins/m/test/code/page.html [new file with mode: 0644]
pelican-plugins/m/test/code/page.rst [new file with mode: 0644]
pelican-plugins/m/test/test_code.py [new file with mode: 0644]

diff --git a/pelican-plugins/m/test/code/console.ansi b/pelican-plugins/m/test/code/console.ansi
new file mode 120000 (symlink)
index 0000000..003cf1e
--- /dev/null
@@ -0,0 +1 @@
+../../../../doc/plugins/math-and-code-console.ansi
\ No newline at end of file
diff --git a/pelican-plugins/m/test/code/page.html b/pelican-plugins/m/test/code/page.html
new file mode 100644 (file)
index 0000000..e437108
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>m.code | A Pelican Blog</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,400i,600%7CSource+Sans+Pro:400,400i,600,600i" />
+  <link rel="stylesheet" href="static/m-dark.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+  <meta property="og:title" content="m.code" />
+  <meta name="twitter:title" content="m.code" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <meta property="og:description" content="no." />
+  <meta name="twitter:description" content="no." />
+  <meta name="twitter:card" content="summary" />
+  <meta property="og:type" content="website" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+    </div>
+  </div>
+</nav></header>
+<main>
+<article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>m.code</h1>
+<!-- content -->
+<pre class="m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span></pre>
+<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+<span class="hll">    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
+<p>Inline code is here: <code class="cpp m-code"><span class="k">constexpr</span></code></p>
+<pre class="m-console">!<span class="g g-AnsiBlue">[</span><span class="g g-AnsiBrightWhite">mosra@don-perverzo </span><span class="g g-AnsiWhite">m.css</span><span class="g g-AnsiBlue">]</span><span class="g g-AnsiBrightCyan">$ </span>ls
+CONTRIBUTING.rst  CREDITS.rst  <span class="g g-AnsiBrightBlue">doc</span>      <span class="g g-AnsiBrightBlue">pelican-plugins</span>  README.rst
+COPYING           <span class="g g-AnsiBrightBlue">css</span>          <span class="g g-AnsiBrightBlue">doxygen</span>  <span class="g g-AnsiBrightBlue">pelican-theme</span>    <span class="g g-AnsiBrightBlue">site</span></pre>
+<pre class="m-code">// this language is not highlighted</pre>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/pelican-plugins/m/test/code/page.rst b/pelican-plugins/m/test/code/page.rst
new file mode 100644 (file)
index 0000000..8aed59c
--- /dev/null
@@ -0,0 +1,30 @@
+m.code
+######
+
+:summary: no.
+
+.. role:: cpp(code)
+    :language: c++
+
+.. code:: c++
+
+    int main() {
+        return 0;
+    }
+
+.. code:: c++
+    :class: m-inverted
+    :hl_lines: 2
+
+    int main() {
+        return 1;
+    }
+
+Inline code is here: :cpp:`constexpr`
+
+.. include:: console.ansi
+    :code: ansi
+
+.. code:: whatthefuck
+
+    // this language is not highlighted
diff --git a/pelican-plugins/m/test/test_code.py b/pelican-plugins/m/test/test_code.py
new file mode 100644 (file)
index 0000000..15deccd
--- /dev/null
@@ -0,0 +1,12 @@
+from m.test import PluginTestCase
+
+class Abbr(PluginTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, '', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'PLUGINS': ['m.htmlsanity', 'm.code']
+        })
+
+        self.assertEqual(*self.actual_expected_contents('page.html'))