Initial commit

This commit is contained in:
2023-11-19 10:42:13 +01:00
parent 3586127c15
commit 77e68a05a2
26 changed files with 1757 additions and 7 deletions

10
spec/fixtures/404.html vendored Normal file
View File

@ -0,0 +1,10 @@
---
layout: default
title: "404: Page not found"
permalink: 404.html
---
<div class="page">
<h1 class="page-title">404: Page not found</h1>
<p class="lead">Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. <a href="{{ site.baseurl | prepend: site.url }}">Head back home</a> to try finding it again.</p>
</div>

24
spec/fixtures/_config.yml vendored Normal file
View File

@ -0,0 +1,24 @@
markdown: redcarpet
highlighter: pygments
title: Example.com
tagline: "Example!"
description: ""
url: https://example.com
paginate: 10
category_dir: /
category_title_prefix: ""
permalink: :categories/:title.html
timezone: Australia/Perth
author:
name: "Example"
email: "example@example.com"
menu:
- {
url: "https://www.github.com/example/",
name: "GitHub",
nofollow: true,
newwindow: true,
}
plugins:
- jekyll-minifier
- jekyll-paginate

24
spec/fixtures/_includes/sidebar.html vendored Normal file
View File

@ -0,0 +1,24 @@
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">
<div class="sidebar" id="sidebar">
<div class="sidebar-item">
<p>{{ site.description }}</p>
</div>
<nav class="sidebar-nav">
<a class="sidebar-nav-item{% if page.url == site.baseurl %} active{% endif %}" href="{{ site.baseurl | prepend: site.url }}">Home</a>
{% assign pages_list = site.pages | sort:"url" %}
{% for node in pages_list %}
{% if node.title != null %}
{% if node.layout == "page" %}
<a class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="{{ node.url | prepend: site.baseurl | prepend: site.url }}">{{ node.title | capitalize }}</a>
{% endif %}
{% endif %}
{% endfor %}
{% assign urls_list = site.menu | sort:"url" %}
{% for node in urls_list %}
<a class="sidebar-nav-item" href="{{ node.url }}"{% if node.nofollow == true %} rel="nofollow"{% endif %}{% if node.newwindow == true %} target="_blank"{% endif %}>{{ node.name }}</a>
{% endfor %}
</nav>
</div>

View File

@ -0,0 +1,13 @@
---
layout: page
---
<div class="page-content wc-container">
<table>
{% for post in site.categories[page.category] %}
<tr>
<td><i class="icon-clock"></i><time datetime="{{post.date|date:"%F"}}">{{post.date|date:"%b %d, %Y"}}</time></td>
<td><a href="{{ post.url | prepend: site.baseurl | prepend: site.url }}">{{ post.title }}</a></td>
</tr>
{% endfor %}
</table>
</div>

64
spec/fixtures/_layouts/default.html vendored Normal file
View File

@ -0,0 +1,64 @@
---
layout: null
---
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>
{% if page.title == "Home" %}
{{ site.title }} &middot; {{ site.tagline }}
{% else %}
{% if page.title != "" %}{{ page.title }} &middot; {% endif %}{{ site.title }}
{% endif %}
</title>
<link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous">
<!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]-->
<link rel="stylesheet" href="{{ site.baseurl | prepend: site.url }}/assets/css/style.css">
<link rel="alternate" type="application/atom+xml" title="Example.com" href="{{ site.baseurl | prepend: site.url }}/atom.xml">
<script type="text/javascript" src="{{ site.baseurl | prepend: site.url }}/assets/js/script.js"></script>
</head>
<body class="layout-reverse sidebar-overlay">
{% include sidebar.html %}
<div class="wrap">
<div class="masthead">
<div class="container">
<h3 class="masthead-title">
<a href="/" title="Home">Example.com</a>
<small>Example!</small>
</h3>
</div>
</div>
<div class="container content">
{{ content }}
</div>
</div>
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
<footer class="footer">
<div class="container">
<p class="text-muted text-center">&copy; Copyright {{ site.time | date: '%Y' }} Example. All rights reserved.</p>
</div>
</footer>
<script>
(function(document) {
var toggle = document.querySelector('.sidebar-toggle');
var sidebar = document.querySelector('#sidebar');
var checkbox = document.querySelector('#sidebar-checkbox');
document.addEventListener('click', function(e) {
var target = e.target;
if(!checkbox.checked ||
sidebar.contains(target) ||
(target === checkbox || target === toggle)) return;
checkbox.checked = false;
}, false);
})(document);
</script>
</body>
</html>

8
spec/fixtures/_layouts/page.html vendored Normal file
View File

@ -0,0 +1,8 @@
---
layout: default
---
<div class="page">
<h1 class="page-title">{{ page.title | capitalize }}</h1>
{{ content }}
</div>

25
spec/fixtures/_layouts/post.html vendored Normal file
View File

@ -0,0 +1,25 @@
---
layout: default
---
<div class="post">
<h1 class="post-title">{{ page.title }}</h1>
<span class="post-date">{{ page.date | date_to_string }}</span>
{{ content }}
</div>
<div class="related">
<h2>Related Posts</h2>
<ul class="related-posts">
{% for post in site.related_posts limit:3 %}
<li>
<h3>
<a href="{{ post.url | prepend: site.baseurl | prepend: site.url }}">
{{ post.title }}
<small>{{ post.date | date_to_string }}</small>
</a>
</h3>
</li>
{% endfor %}
</ul>
</div>

View File

@ -0,0 +1,240 @@
# encoding: utf-8
#
# Jekyll category page generator.
# http://recursive-design.com/projects/jekyll-plugins/
#
# Version: 0.2.4 (201210160037)
#
# Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
#
# A generator that creates category pages for jekyll sites.
#
# To use it, simply drop this script into the _plugins directory of your Jekyll site. You should
# also create a file called 'category_index.html' in the _layouts directory of your jekyll site
# with the following contents (note: you should remove the leading '# ' characters):
#
# ================================== COPY BELOW THIS LINE ==================================
# ---
# layout: default
# ---
#
# <h1 class="category">{{ page.title }}</h1>
# <ul class="posts">
# {% for post in site.categories[page.category] %}
# <div>{{ post.date | date_to_html_string }}</div>
# <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
# <div class="categories">Filed under {{ post.categories | category_links }}</div>
# {% endfor %}
# </ul>
# ================================== COPY ABOVE THIS LINE ==================================
#
# You can alter the _layout_ setting if you wish to use an alternate layout, and obviously you
# can change the HTML above as you see fit.
#
# When you compile your jekyll site, this plugin will loop through the list of categories in your
# site, and use the layout above to generate a page for each one with a list of links to the
# individual posts.
#
# You can also (optionally) generate an atom.xml feed for each category. To do this, copy
# the category_feed.xml file to the _includes/custom directory of your own project
# (https://github.com/recurser/jekyll-plugins/blob/master/_includes/custom/category_feed.xml).
# You'll also need to copy the octopress_filters.rb file into the _plugins directory of your
# project as the category_feed.xml requires a couple of extra filters
# (https://github.com/recurser/jekyll-plugins/blob/master/_plugins/octopress_filters.rb).
#
# Included filters :
# - category_links: Outputs the list of categories as comma-separated <a> links.
# - date_to_html_string: Outputs the post.date as formatted html, with hooks for CSS styling.
#
# Available _config.yml settings :
# - category_dir: The subfolder to build category pages in (default is 'categories').
# - category_title_prefix: The string used before the category name in the page title (default is
# 'Category: ').
module Jekyll
# The CategoryIndex class creates a single category page for the specified category.
class CategoryPage < Page
# Initializes a new CategoryIndex.
#
# +template_path+ is the path to the layout template to use.
# +site+ is the Jekyll Site instance.
# +base+ is the String path to the <source>.
# +category_dir+ is the String path between <source> and the category folder.
# +category+ is the category currently being processed.
def initialize(template_path, name, site, base, category_dir, category)
@site = site
@base = base
@dir = category_dir
@name = name
self.process(name)
if File.exist?(template_path)
@perform_render = true
template_dir = File.dirname(template_path)
template = File.basename(template_path)
# Read the YAML data from the layout page.
self.read_yaml(template_dir, template)
self.data['category'] = category
# Set the title for this page.
title_prefix = site.config['category_title_prefix'] || 'Category: '
self.data['title'] = "#{title_prefix}#{category}"
# Set the meta-description for this page.
meta_description_prefix = site.config['category_meta_description_prefix'] || 'Category: '
self.data['description'] = "#{meta_description_prefix}#{category}"
else
@perform_render = false
end
end
def render?
@perform_render
end
end
# The CategoryIndex class creates a single category page for the specified category.
class CategoryIndex < CategoryPage
# Initializes a new CategoryIndex.
#
# +site+ is the Jekyll Site instance.
# +base+ is the String path to the <source>.
# +category_dir+ is the String path between <source> and the category folder.
# +category+ is the category currently being processed.
def initialize(site, base, category_dir, category)
template_path = File.join(base, '_layouts', 'category_index.html')
super(template_path, 'index.html', site, base, category_dir, category)
end
end
# The CategoryFeed class creates an Atom feed for the specified category.
class CategoryFeed < CategoryPage
# Initializes a new CategoryFeed.
#
# +site+ is the Jekyll Site instance.
# +base+ is the String path to the <source>.
# +category_dir+ is the String path between <source> and the category folder.
# +category+ is the category currently being processed.
def initialize(site, base, category_dir, category)
template_path = File.join(base, '_includes', 'custom', 'category_feed.xml')
super(template_path, 'atom.xml', site, base, category_dir, category)
# Set the correct feed URL.
self.data['feed_url'] = "#{category_dir}/#{name}" if render?
end
end
# The Site class is a built-in Jekyll class with access to global site config information.
class Site
# Creates an instance of CategoryIndex for each category page, renders it, and
# writes the output to a file.
#
# +category+ is the category currently being processed.
def write_category_index(category)
target_dir = GenerateCategories.category_dir(self.config['category_dir'], category)
index = CategoryIndex.new(self, self.source, target_dir, category)
if index.render?
index.render(self.layouts, site_payload)
index.write(self.dest)
# Record the fact that this pages has been added, otherwise Site::cleanup will remove it.
self.pages << index
end
# Create an Atom-feed for each index.
feed = CategoryFeed.new(self, self.source, target_dir, category)
if feed.render?
feed.render(self.layouts, site_payload)
feed.write(self.dest)
# Record the fact that this pages has been added, otherwise Site::cleanup will remove it.
self.pages << feed
end
end
# Loops through the list of category pages and processes each one.
def write_category_indexes
if self.layouts.key? 'category_index'
self.categories.keys.each do |category|
self.write_category_index(category)
end
# Throw an exception if the layout couldn't be found.
else
throw "No 'category_index' layout found."
end
end
end
# Jekyll hook - the generate method is called by jekyll, and generates all of the category pages.
class GenerateCategories < Generator
safe true
priority :low
CATEGORY_DIR = 'categories'
def generate(site)
site.write_category_indexes
end
# Processes the given dir and removes leading and trailing slashes. Falls
# back on the default if no dir is provided.
def self.category_dir(base_dir, category)
base_dir = (base_dir || CATEGORY_DIR).gsub(/^\/*(.*)\/*$/, '\1')
category = category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase
File.join(base_dir, category)
end
end
# Adds some extra filters used during the category creation process.
module Filters
# Outputs a list of categories as comma-separated <a> links. This is used
# to output the category list for each post on a category page.
#
# +categories+ is the list of categories to format.
#
# Returns string
def category_links(categories)
base_dir = @context.registers[:site].config['category_dir']
categories = categories.sort!.map do |category|
category_dir = GenerateCategories.category_dir(base_dir, category)
# Make sure the category directory begins with a slash.
category_dir = "/#{category_dir}" unless category_dir =~ /^\//
"<a class='category' href='#{category_dir}/'>#{category}</a>"
end
case categories.length
when 0
""
when 1
categories[0].to_s
else
categories.join(', ')
end
end
# Outputs the post.date as formatted html, with hooks for CSS styling.
#
# +date+ is the date object to format as HTML.
#
# Returns string
def date_to_html_string(date)
result = '<span class="month">' + date.strftime('%b').upcase + '</span> '
result += date.strftime('<span class="day">%d</span> ')
result += date.strftime('<span class="year">%Y</span> ')
result
end
end
end

View File

@ -0,0 +1,9 @@
---
layout: post
title: "Test Review 1"
date: 03/04/2012 00:00:00
description: Test Review 1
categories: reviews
---
Test Review 1

View File

@ -0,0 +1,9 @@
---
layout: post
title: "Test Review 2"
date: 03/04/2013 00:00:00
description: Test Review 2
categories: reviews
---
Test Review 2

View File

@ -0,0 +1,9 @@
---
layout: post
title: "Random"
date: 01/01/2015 00:00:00
description: Random!
categories: random
---
Random!

36
spec/fixtures/assets/css/style.css vendored Normal file
View File

@ -0,0 +1,36 @@
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #f5f5f5;
}
.footer .container .text-muted {
margin: 20px 0;
}
#brandServiceList li>a {
background-color:#fff !important;
}
a.outlink {
text-decoration: none;
font-color: #000;
}
.list-nobullet {
list-style-type: none;
}
#logo {
display: inline-block;
height: 100px;
}

4
spec/fixtures/assets/js/script.js vendored Normal file
View File

@ -0,0 +1,4 @@
var sampleFunction = function() {
console.log('This is sample.');
};
sampleFunction();

28
spec/fixtures/atom.xml vendored Normal file
View File

@ -0,0 +1,28 @@
---
title : Atom Feed
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text" xml:lang="en">{{ site.title }}</title>
<link type="application/atom+xml" href="{{ site.baseurl | prepend: site.url }}/atom.xml" rel="self"/>
<link href="{{ site.baseurl | prepend: site.url }}/"/>
<updated>{{ site.time | date: "%Y-%m-%dT%H:%M:%SZ" }}</updated>
<id>{{ site.baseurl | prepend: site.url }}/</id>
<author>
<name>{{ site.author.name }}</name>
<email>{{ site.author.email }}</email>
</author>
<rights type="text">Copyright © {{ site.time | date: "%Y" }} {{ site.author.name }}. All Rights Reserved.</rights>
{% for post in site.posts limit:10 %}
<entry>
<title>{{ post.title | xml_escape }}</title>
<link rel="alternate" type="text/html" href="{{ post.url | prepend: site.baseurl | prepend: site.url }}" />
<published>{{ post.date | date: "%Y-%m-%dT%H:%M:%SZ" }}</published>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ post.url | prepend: site.baseurl | prepend: site.url }}</id>
<content type="html"><![CDATA[ {{ post.content | markdownify }} ]]></content>
</entry>
{% endfor %}
</feed>

45
spec/fixtures/index.html vendored Normal file
View File

@ -0,0 +1,45 @@
---
layout: default
title: Home
---
<div class="posts">
{% for post in paginator.posts %}
<div class="post">
<h1 class="post-title">
<a href="{{ post.url | prepend: site.baseurl | prepend: site.url }}">
{{ post.title }}
</a>
</h1>
<span class="post-date">{{ post.date | date_to_string }}</span>
<p>
{{ post.excerpt }}
</p>
<p>
<a href="{{ post.url | prepend: site.baseurl | prepend: site.url }}" title="{{ post.title }}">
Read More
</a>
</p>
</div>
{% endfor %}
</div>
<div class="pagination">
{% if paginator.next_page %}
<a class="pagination-item older" href="{{ site.baseurl | prepend: site.url }}page{{paginator.next_page}}">Older</a>
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if paginator.previous_page %}
{% if paginator.page == 2 %}
<a class="pagination-item newer" href="{{ site.baseurl | prepend: site.url }}">Newer</a>
{% else %}
<a class="pagination-item newer" href="{{ site.baseurl | prepend: site.url }}page{{paginator.previous_page}}">Newer</a>
{% endif %}
{% else %}
<span class="pagination-item newer">Newer</span>
{% endif %}
</div>