chiark / gitweb /
m.images: initial test.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 02:24:22 +0000 (03:24 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 02:35:31 +0000 (03:35 +0100)
doc/plugins/images-test.rst
doxygen/test/contents_image/tiny.png
pelican-plugins/m/test/images/flowers.jpg [new symlink]
pelican-plugins/m/test/images/page.html [new file with mode: 0644]
pelican-plugins/m/test/images/page.rst [new file with mode: 0644]
pelican-plugins/m/test/images/ship.jpg [new symlink]
pelican-plugins/m/test/images/tiny.png [moved from doc/static/tiny.png with 100% similarity]
pelican-plugins/m/test/test_images.py [new file with mode: 0644]

index e3c49f47ea36f2b5ab2f8802b6563d321ddea065..cea68ab8c4e4653902f7aac29b90df10694656a6 100644 (file)
@@ -81,9 +81,3 @@ Image grid, inflated:
 
         {filename}/static/flowers.jpg
         {filename}/static/ship.jpg
-
-Image grid with a PNG file:
-
-.. image-grid::
-
-    {filename}/static/tiny.png
index d154db2738cb997c088f8d698cc01cc04333d0ce..1034d03d3926f8488482d2a742d5cdc2acd308b7 120000 (symlink)
@@ -1 +1 @@
-../../../doc/static/tiny.png
\ No newline at end of file
+../../../pelican-plugins/m/test/images/tiny.png
\ No newline at end of file
diff --git a/pelican-plugins/m/test/images/flowers.jpg b/pelican-plugins/m/test/images/flowers.jpg
new file mode 120000 (symlink)
index 0000000..2742124
--- /dev/null
@@ -0,0 +1 @@
+../../../../doc/static/flowers.jpg
\ No newline at end of file
diff --git a/pelican-plugins/m/test/images/page.html b/pelican-plugins/m/test/images/page.html
new file mode 100644 (file)
index 0000000..40fc9b2
--- /dev/null
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>m.images | 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.images" />
+  <meta name="twitter:title" content="m.images" />
+  <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.images</h1>
+<!-- content -->
+<p>Image:</p>
+<img class="m-image" src="./ship.jpg" />
+<p>Image with link:</p>
+<div class="m-image">
+<a href="./ship.jpg"><img src="./ship.jpg" /></a>
+</div>
+<p>Image, class on top, custom alt:</p>
+<img alt="A Ship" class="m-image m-fullwidth" src="./ship.jpg" />
+<p>Image with link, class on top:</p>
+<div class="m-image m-fullwidth">
+<a href="./ship.jpg"><img src="./ship.jpg" /></a>
+</div>
+<p>Figure:</p>
+<figure class="m-figure">
+<img src="./ship.jpg" />
+<figcaption>A Ship</figcaption>
+<span>
+Yes.</span>
+</figure>
+<p>Figure with link and only a caption:</p>
+<figure class="m-figure">
+<a href="./ship.jpg"><img src="./ship.jpg" /></a>
+<figcaption>A Ship</figcaption>
+</figure>
+<p>Figure with link and class on top:</p>
+<figure class="m-fullwidth m-figure">
+<a href="./ship.jpg"><img src="./ship.jpg" /></a>
+<figcaption>A Ship</figcaption>
+</figure>
+<p>Image grid:</p>
+<div class="m-imagegrid m-container-inflate">
+<div>
+<figure style="width: 69.127%">
+<a href="./ship.jpg"><img src="./ship.jpg" /><figcaption>F9.0, 1/250 s, ISO 100</figcaption>
+</a>
+</figure>
+<figure style="width: 30.873%">
+<a href="./flowers.jpg"><img src="./flowers.jpg" /><figcaption>F2.8, 1/1600 s, ISO 100</figcaption>
+</a>
+</figure>
+</div>
+<div>
+<figure style="width: 30.873%">
+<a href="./flowers.jpg"><img src="./flowers.jpg" /><figcaption>F2.8, 1/1600 s, ISO 100</figcaption>
+</a>
+</figure>
+<figure style="width: 69.127%">
+<a href="./ship.jpg"><img src="./ship.jpg" /><figcaption>F9.0, 1/250 s, ISO 100</figcaption>
+</a>
+</figure>
+</div>
+</div>
+<p>Image grid with a PNG file:</p>
+<div class="m-imagegrid m-container-inflate">
+<div>
+<figure style="width: 100.000%">
+<a href="./tiny.png"><img src="./tiny.png" /><div>
+</div>
+</a>
+</figure>
+</div>
+</div>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/pelican-plugins/m/test/images/page.rst b/pelican-plugins/m/test/images/page.rst
new file mode 100644 (file)
index 0000000..2cc494f
--- /dev/null
@@ -0,0 +1,64 @@
+m.images
+########
+
+:summary: no.
+
+Image:
+
+.. image:: {filename}/ship.jpg
+
+Image with link:
+
+.. image:: {filename}/ship.jpg
+    :target: {filename}/ship.jpg
+
+Image, class on top, custom alt:
+
+.. image:: {filename}/ship.jpg
+    :class: m-fullwidth
+    :alt: A Ship
+
+Image with link, class on top:
+
+.. image:: {filename}/ship.jpg
+    :target: {filename}/ship.jpg
+    :class: m-fullwidth
+
+Figure:
+
+.. figure:: {filename}/ship.jpg
+
+    A Ship
+
+    Yes.
+
+Figure with link and only a caption:
+
+.. figure:: {filename}/ship.jpg
+    :target: {filename}/ship.jpg
+
+    A Ship
+
+Figure with link and class on top:
+
+.. figure:: {filename}/ship.jpg
+    :target: {filename}/ship.jpg
+    :figclass: m-fullwidth
+
+    A Ship
+
+Image grid:
+
+.. image-grid::
+
+    {filename}/ship.jpg
+    {filename}/flowers.jpg
+
+    {filename}/flowers.jpg
+    {filename}/ship.jpg
+
+Image grid with a PNG file:
+
+.. image-grid::
+
+    {filename}/tiny.png
diff --git a/pelican-plugins/m/test/images/ship.jpg b/pelican-plugins/m/test/images/ship.jpg
new file mode 120000 (symlink)
index 0000000..3103a99
--- /dev/null
@@ -0,0 +1 @@
+../../../../doc/static/ship.jpg
\ No newline at end of file
diff --git a/pelican-plugins/m/test/test_images.py b/pelican-plugins/m/test/test_images.py
new file mode 100644 (file)
index 0000000..778c02b
--- /dev/null
@@ -0,0 +1,13 @@
+from m.test import PluginTestCase
+
+class Images(PluginTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, '', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'PLUGINS': ['m.htmlsanity', 'm.images'],
+            'STATIC_PATHS': ['tiny.png', 'ship.jpg', 'flowers.jpg']
+        })
+
+        self.assertEqual(*self.actual_expected_contents('page.html'))