chiark / gitweb /
theme: test page rendering.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 10 Dec 2017 14:44:14 +0000 (15:44 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 01:48:25 +0000 (02:48 +0100)
23 files changed:
doc/pelican/theme-test.rst [deleted file]
doc/static/dummy.css [deleted file]
pelican-theme/test/__init__.py
pelican-theme/test/page/page.html [new file with mode: 0644]
pelican-theme/test/page/page.rst [new file with mode: 0644]
pelican-theme/test/page_breadcrumb/page.html [new file with mode: 0644]
pelican-theme/test/page_breadcrumb/page.rst [new file with mode: 0644]
pelican-theme/test/page_breadcrumb/subpage.html [new file with mode: 0644]
pelican-theme/test/page_breadcrumb/subpage.rst [new file with mode: 0644]
pelican-theme/test/page_extra_css/page.html [new file with mode: 0644]
pelican-theme/test/page_extra_css/page.rst [new file with mode: 0644]
pelican-theme/test/page_header_footer/page.html [new file with mode: 0644]
pelican-theme/test/page_header_footer/page.rst [new file with mode: 0644]
pelican-theme/test/page_landing/hide-navbar-brand.html [new file with mode: 0644]
pelican-theme/test/page_landing/hide-navbar-brand.rst [new file with mode: 0644]
pelican-theme/test/page_landing/page.html [new file with mode: 0644]
pelican-theme/test/page_landing/page.rst [new file with mode: 0644]
pelican-theme/test/page_landing/ship.jpg [new symlink]
pelican-theme/test/page_minimal/page.html [new file with mode: 0644]
pelican-theme/test/page_minimal/page.rst [new file with mode: 0644]
pelican-theme/test/page_title_sitename_alias/page.html [new file with mode: 0644]
pelican-theme/test/page_title_sitename_alias/page.rst [new file with mode: 0644]
pelican-theme/test/test_page.py [new file with mode: 0644]

diff --git a/doc/pelican/theme-test.rst b/doc/pelican/theme-test.rst
deleted file mode 100644 (file)
index 7a88781..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-..
-    This file is part of m.css.
-
-    Copyright © 2017 Vladimír Vondruš <mosra@centrum.cz>
-
-    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: pelican/theme/test/index.html
-:breadcrumb: {filename}/pelican.rst Pelican
-             {filename}/pelican/theme.rst Theme
-:css: {filename}/static/dummy.css
-      {filename}/static/dummy.css
-:summary: um
-:highlight: pelican/theme
-:header:
-    .. note-warning::
-
-        This is a page header with an `internal link <{filename}/pelican.rst>`_.
-        This shouldn't be wrapped in a ``<p>``.
-:footer:
-    .. note-danger::
-
-        This is a page footer with an `internal link <{filename}/pelican.rst>`_.
-        This shouldn't be wrapped in a ``<p>``.
-
-This page should have a breadcrumb, summary in a meta tag, header and a footer
-and also two additional links to ``/static/dummy.css``. It should also
-highlight the Pelican Theme menu item in the top navbar.
diff --git a/doc/static/dummy.css b/doc/static/dummy.css
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
index 80f8d95d7cc18ddf94808013420a181cbf4963c0..7264c1ceb9d979c2dd780d8ede071718f71c2822 100644 (file)
@@ -59,6 +59,18 @@ class BaseTestCase(MinimalTestCase):
         }
         MinimalTestCase.run_pelican(self, {**implicit_settings, **settings})
 
+class PageTestCase(BaseTestCase):
+    def run_pelican(self, settings):
+        implicit_settings = {
+            'M_FINE_PRINT': None,
+            'PAGE_PATHS': ['.'],
+            'PAGE_SAVE_AS': '{slug}.html',
+            'PAGE_URL': '{slug}.html',
+            'ARTICLE_PATHS': ['articles'], # doesn't exist
+            'DIRECT_TEMPLATES': []
+        }
+        BaseTestCase.run_pelican(self, {**implicit_settings, **settings})
+
 class BlogTestCase(BaseTestCase):
     def run_pelican(self, settings):
         implicit_settings = {
diff --git a/pelican-theme/test/page/page.html b/pelican-theme/test/page/page.html
new file mode 100644 (file)
index 0000000..a98294e
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page | 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 name="description" content="Page description for the fake SEO believers." />
+  <meta property="og:title" content="A page" />
+  <meta name="twitter:title" content="A page" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <meta property="og:description" content="Page description for the social people." />
+  <meta name="twitter:description" content="Page description for the social people." />
+  <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>A page</h1>
+<!-- content -->
+<p>Page content for those who actually read.</p>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
\ No newline at end of file
diff --git a/pelican-theme/test/page/page.rst b/pelican-theme/test/page/page.rst
new file mode 100644 (file)
index 0000000..07c0f6c
--- /dev/null
@@ -0,0 +1,7 @@
+A page
+######
+
+:description: Page description for the fake SEO believers.
+:summary: Page description for the social people.
+
+Page content for those who actually read.
diff --git a/pelican-theme/test/page_breadcrumb/page.html b/pelican-theme/test/page_breadcrumb/page.html
new file mode 100644 (file)
index 0000000..7ce0eeb
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>Index page &raquo; A page | 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="A page" />
+  <meta name="twitter:title" content="A page" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <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>
+          <span class="m-breadcrumb">
+            <a href="./index.html">Index page</a> &raquo;
+          </span>
+          A page
+        </h1>
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/page_breadcrumb/page.rst b/pelican-theme/test/page_breadcrumb/page.rst
new file mode 100644 (file)
index 0000000..019f792
--- /dev/null
@@ -0,0 +1,5 @@
+A page
+######
+
+:breadcrumb:
+    {index} Index page
diff --git a/pelican-theme/test/page_breadcrumb/subpage.html b/pelican-theme/test/page_breadcrumb/subpage.html
new file mode 100644 (file)
index 0000000..27bb5f1
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>Index page &raquo; A page &raquo; Subpage | 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="Subpage" />
+  <meta name="twitter:title" content="Subpage" />
+  <meta property="og:url" content="subpage.html" />
+  <meta name="twitter:url" content="subpage.html" />
+  <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>
+          <span class="m-breadcrumb">
+            <a href="./index.html">Index page</a> &raquo;
+            <a href="./page.html">A page</a> &raquo;
+          </span>
+          Subpage
+        </h1>
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/page_breadcrumb/subpage.rst b/pelican-theme/test/page_breadcrumb/subpage.rst
new file mode 100644 (file)
index 0000000..1378044
--- /dev/null
@@ -0,0 +1,6 @@
+Subpage
+#######
+
+:breadcrumb:
+    {index} Index page
+    {filename}/page.rst A page
diff --git a/pelican-theme/test/page_extra_css/page.html b/pelican-theme/test/page_extra_css/page.html
new file mode 100644 (file)
index 0000000..024393d
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page | 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" />
+  <link rel="stylesheet" href="static/m-debug.css" />
+  <link rel="stylesheet" href="static/m-grid.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+  <meta property="og:title" content="A page" />
+  <meta name="twitter:title" content="A page" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <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>A page</h1>
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/page_extra_css/page.rst b/pelican-theme/test/page_extra_css/page.rst
new file mode 100644 (file)
index 0000000..0a1d86c
--- /dev/null
@@ -0,0 +1,5 @@
+A page
+######
+
+:css: static/m-debug.css
+      static/m-grid.css
diff --git a/pelican-theme/test/page_header_footer/page.html b/pelican-theme/test/page_header_footer/page.html
new file mode 100644 (file)
index 0000000..701f8cf
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page | 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="A page" />
+  <meta name="twitter:title" content="A page" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <meta property="og:description" content="Page content." />
+  <meta name="twitter:description" content="Page content." />
+  <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>
+<div class="m-container m-container-inflatable">
+  <div class="m-row">
+    <div class="m-col-l-10 m-push-l-1 m-nopadb">
+<!-- header -->
+<p>Page header. With multiple lines.
+Linking to <a href="./page.html">self</a>.</p>
+<!-- /header -->
+    </div>
+  </div>
+</div>
+<article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>A page</h1>
+<!-- content -->
+<p>Page content.</p>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+<div class="m-container m-container-inflatable">
+  <div class="m-row">
+    <div class="m-col-l-10 m-push-l-1 m-nopadt">
+<!-- footer -->
+<p>Page footer. Linking to <a href="./page.html">self</a>.</p>
+<!-- /footer -->
+    </div>
+  </div>
+</div>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/page_header_footer/page.rst b/pelican-theme/test/page_header_footer/page.rst
new file mode 100644 (file)
index 0000000..d0592a4
--- /dev/null
@@ -0,0 +1,8 @@
+A page
+######
+
+:header: Page header. With multiple lines.
+    Linking to `self <{filename}/page.rst>`_.
+:footer: Page footer. Linking to `self <{filename}/page.rst>`_.
+
+Page content.
diff --git a/pelican-theme/test/page_landing/hide-navbar-brand.html b/pelican-theme/test/page_landing/hide-navbar-brand.html
new file mode 100644 (file)
index 0000000..9d69015
--- /dev/null
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page | 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="A page" />
+  <meta name="twitter:title" content="A page" />
+  <meta property="og:url" content="hide-navbar-brand.html" />
+  <meta name="twitter:url" content="hide-navbar-brand.html" />
+  <meta property="og:description" content="Page text." />
+  <meta name="twitter:description" content="Page text." />
+  <meta property="og:image" content="./ship.jpg" />
+  <meta name="twitter:card" content="summary_large_image" />
+  <meta name="twitter:image" content="./ship.jpg" />
+  <meta property="og:type" content="website" />
+</head>
+<body>
+<header><nav id="navigation" class="m-navbar-landing">
+  <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 m-navbar-brand-hidden">A Pelican Blog</a>
+    </div>
+  </div>
+</nav></header>
+<main>
+<article>
+  <div id="m-landing-image" style="background-image: url('./ship.jpg');">
+    <div id="m-landing-cover">
+      <div class="m-container">
+<!-- landing -->
+<div class="m-row">
+<div class="m-col-m-6 m-push-m-3">
+Landing text.</div>
+</div>
+<!-- /landing -->
+      </div>
+    </div>
+  </div>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+<!-- content -->
+<p>Page text.</p>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/page_landing/hide-navbar-brand.rst b/pelican-theme/test/page_landing/hide-navbar-brand.rst
new file mode 100644 (file)
index 0000000..3ff5ab2
--- /dev/null
@@ -0,0 +1,13 @@
+A page
+######
+
+:cover: {filename}/ship.jpg
+:hide_navbar_brand: True
+:landing:
+    .. container:: m-row
+
+        .. container:: m-col-m-6 m-push-m-3
+
+            Landing text.
+
+Page text.
diff --git a/pelican-theme/test/page_landing/page.html b/pelican-theme/test/page_landing/page.html
new file mode 100644 (file)
index 0000000..3c7a3ab
--- /dev/null
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page title that displays only in title | 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="A page title that displays only in title" />
+  <meta name="twitter:title" content="A page title that displays only in title" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <meta property="og:description" content="Some page text." />
+  <meta name="twitter:description" content="Some page text." />
+  <meta property="og:image" content="./ship.jpg" />
+  <meta name="twitter:card" content="summary_large_image" />
+  <meta name="twitter:image" content="./ship.jpg" />
+  <meta property="og:type" content="website" />
+</head>
+<body>
+<header><nav id="navigation" class="m-navbar-landing">
+  <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 id="m-landing-image" style="background-image: url('./ship.jpg');">
+    <div id="m-landing-cover">
+      <div class="m-container">
+<!-- landing -->
+<div class="m-row">
+<div class="m-col-l-6 m-push-l-1 m-col-m-7 m-nopadb">
+<h1>A page title that displays on page</h1><p>Some text. Linking <a href="./page.html">to self</a>.</p>
+</div>
+</div>
+<!-- /landing -->
+      </div>
+    </div>
+  </div>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+<!-- content -->
+<p>Some page text.</p>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+<div class="m-container m-container-inflatable">
+  <div class="m-row">
+    <div class="m-col-l-10 m-push-l-1 m-nopadt">
+<!-- footer -->
+This is visible on the bottom.
+<!-- /footer -->
+    </div>
+  </div>
+</div>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/page_landing/page.rst b/pelican-theme/test/page_landing/page.rst
new file mode 100644 (file)
index 0000000..42d07b7
--- /dev/null
@@ -0,0 +1,18 @@
+A page title that displays only in title
+########################################
+
+:cover: {filename}/ship.jpg
+:header: This shouldn't be visible anywhere.
+:footer: This is visible on the bottom.
+:landing:
+    .. container:: m-row
+
+        .. container:: m-col-l-6 m-push-l-1 m-col-m-7 m-nopadb
+
+            .. raw:: html
+
+                <h1>A page title that displays on page</h1>
+
+            Some text. Linking `to self <{filename}/page.rst>`_.
+
+Some page text.
diff --git a/pelican-theme/test/page_landing/ship.jpg b/pelican-theme/test/page_landing/ship.jpg
new file mode 120000 (symlink)
index 0000000..d4469e3
--- /dev/null
@@ -0,0 +1 @@
+../../../doc/static/ship.jpg
\ No newline at end of file
diff --git a/pelican-theme/test/page_minimal/page.html b/pelican-theme/test/page_minimal/page.html
new file mode 100644 (file)
index 0000000..c73ad4c
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page | 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="A page" />
+  <meta name="twitter:title" content="A page" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <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>A page</h1>
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
\ No newline at end of file
diff --git a/pelican-theme/test/page_minimal/page.rst b/pelican-theme/test/page_minimal/page.rst
new file mode 100644 (file)
index 0000000..58c8b8c
--- /dev/null
@@ -0,0 +1,2 @@
+A page
+######
diff --git a/pelican-theme/test/page_title_sitename_alias/page.html b/pelican-theme/test/page_title_sitename_alias/page.html
new file mode 100644 (file)
index 0000000..1d4e3ba
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>Site name</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="Site name" />
+  <meta name="twitter:title" content="Site name" />
+  <meta property="og:url" content="page.html" />
+  <meta name="twitter:url" content="page.html" />
+  <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">Site name</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>Site name</h1>
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/page_title_sitename_alias/page.rst b/pelican-theme/test/page_title_sitename_alias/page.rst
new file mode 100644 (file)
index 0000000..4f7e2b2
--- /dev/null
@@ -0,0 +1,2 @@
+Site name
+#########
diff --git a/pelican-theme/test/test_page.py b/pelican-theme/test/test_page.py
new file mode 100644 (file)
index 0000000..070a49d
--- /dev/null
@@ -0,0 +1,85 @@
+from test import PageTestCase
+
+class Page(PageTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, '', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'FORMATTED_FIELDS': ['summary', 'description']
+        })
+
+        # The content and summary meta tag shouldn't be there at all
+        self.assertEqual(*self.actual_expected_contents('page.html'))
+
+class Minimal(PageTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'minimal', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({})
+
+        # The content and summary meta tag shouldn't be there at all
+        self.assertEqual(*self.actual_expected_contents('page.html'))
+
+class Breadcrumb(PageTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'breadcrumb', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({})
+
+        # Internal links should work and guide the user from one page to
+        # another
+        self.assertEqual(*self.actual_expected_contents('page.html'))
+        self.assertEqual(*self.actual_expected_contents('subpage.html'))
+
+class ExtraCss(PageTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'extra_css', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({})
+
+        # The page should contain two extra CSS links
+        self.assertEqual(*self.actual_expected_contents('page.html'))
+
+class HeaderFooter(PageTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'header_footer', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'FORMATTED_FIELDS': ['header', 'footer']
+        })
+
+        # The header and footer should have the links expanded
+        self.assertEqual(*self.actual_expected_contents('page.html'))
+
+class Landing(PageTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'landing', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'STATIC_PATHS': ['ship.jpg'],
+            'FORMATTED_FIELDS': ['landing']
+        })
+
+        # The landing field should have the links expanded, header should not
+        # be shown, footer should be. Navbar brand should be hidden in the
+        # second case.
+        self.assertEqual(*self.actual_expected_contents('page.html'))
+        self.assertEqual(*self.actual_expected_contents('hide-navbar-brand.html'))
+
+class TitleSitenameAlias(PageTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'title_sitename_alias', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'SITENAME': "Site name"
+        })
+
+        # The page title should be just one name, not both
+        self.assertEqual(*self.actual_expected_contents('page.html'))