Browse Source

add extended sitemap

master
Schoenberger, Philipp 6 years ago
parent
commit
954435d1eb
  1. 23
      content/blog/03_quadrocopter_en.md
  2. 9
      content/blog/04_quadrocopter_en.md
  3. 16
      pelicanconf.py
  4. 288
      plugins/extended-sitemap/__init__.py
  5. 81
      plugins/extended-sitemap/sitemap-stylesheet.xsl
  6. 264
      plugins/extended-sitemap/tests/__init__.py
  7. 64
      plugins/extended-sitemap/tests/content/articles/article1.md
  8. 63
      plugins/extended-sitemap/tests/content/articles/article2.md
  9. 64
      plugins/extended-sitemap/tests/content/articles/article3.md
  10. 83
      plugins/extended-sitemap/tests/content/pages/page1.md
  11. 80
      plugins/extended-sitemap/tests/content/pages/page2.md
  12. 20
      plugins/extended-sitemap/tests/content/pages/page3.md
  13. 13
      plugins/extended-sitemap/tests/content/pages/page4.md
  14. 117
      plugins/extended-sitemap/tests/expected/test_sitemap_structure.xml
  15. 117
      plugins/extended-sitemap/tests/expected/test_sitemap_structure_custom_article_url.xml
  16. 117
      plugins/extended-sitemap/tests/expected/test_sitemap_structure_direct_templates_1.xml
  17. 117
      plugins/extended-sitemap/tests/expected/test_sitemap_structure_direct_templates_2.xml
  18. 117
      plugins/extended-sitemap/tests/expected/test_sitemap_structure_subpath.xml
  19. 18
      plugins/lightgallery/lightgallery.py

23
content/blog/03_quadrocopter_en.md

@ -25,17 +25,19 @@ The following motors where selected by taking the recomendations of the frame in
motorsize 1408
motorr 4000KV
The motor size of brushless motors for quadrocpters are regulary indicated by a 4-digit number
The motor size of brushless motors for quad copters are regularly indicated by a 4-digit number
The first two digits represent the stator width or diameter while the second ones represent the hight.
The values types are in mm
In general the motor size have quite a infulence of the flight caracteristics.
In general the motor size have quite a influence of the flight characteristics.
A taller motor most likely result in more power at the upper Throttle/RPM and a wider motor
would result in a higher torque at low throttle.
Since i wanted to use motors with a actual datasheet or at least a messurement how much amps
would be drawn by them with a certain propellor i took the [T-Motor F20II F20 II 1408 3750KV](https://www.banggood.com/T-Motor-F20II-F20-II-1406-3750KV-Brushless-Motor-2-4S-For-130-140-150-FPV-Racing-Frame-p-1154351.html)
Since I wanted to use motors with a actual data sheet or at least a test measurement how much thrust and
amps would be drawn with certain types of propeller I did take a look at the [T-Motor F20II F20 II 1408 3750KV](https://www.banggood.com/T-Motor-F20II-F20-II-1406-3750KV-Brushless-Motor-2-4S-For-130-140-150-FPV-Racing-Frame-p-1154351.html)
The where the ones which had a lot of thrust with XXXg when they are mounted with 3040 propeller types.
T
[lightgallery
/images/quad/motor.jpg, T-Motor F20II F20 II 1408 3750KV;
@ -44,8 +46,17 @@ would be drawn by them with a certain propellor i took the [T-Motor F20II F20 II
/images/quad/motor_datasheet3.jpg, T-Motor F20II F20 II load specification with diferent propellor sizes;
lightgalleryend]
At this point the Motors and Frame where clear. The next step was to choose a propellor type.
For this I selected a tri bladed one with close to the 3040 size. The size for
At this point the Motors and Frame where clear. The next step was to choose a propeller type.
For this I selected the tri bladed one with close to the 3040 size. The only ones which are quite near to this are the Geprc 3042
The Number of the Propellors are also representing the size nearly as the motor identification number.
The first two digits are the diameter in inch and the second two ones are representing the pitch of the propeller.
The Pitch is sometimes misunderstood to degrees of the propellor blade.
The actual meaning of it is the forward movement of he propellor if it's rotating 360 degrees
So in this case of a 3042 the diameter is 3 inch and the propellor is moving 4.2 inches forward in case it does one rotation.
You can imagin the higher the pitch is the more air is moved and the more thrust it should generate. Sideeffect of the higher pitch is
a higher amp draw throught
part list:

9
content/blog/04_quadrocopter_en.md

@ -1,9 +0,0 @@
title: quadrocopter2
date: 2019-05-20
author: Philipp Schönberger
tags: bataflight, quadrocopter, fpv
category: projects
Here you can view the.. latest projects i've started.

16
pelicanconf.py

@ -137,7 +137,7 @@ DEFAULT_CATEGORY = 'uncategorized'
# DEFAULT_PAGINATION = 10
PLUGIN_PATHS = ['plugins', ]
PLUGINS = ['lightgallery', 'i18n_subsites', 'sitemap']
PLUGINS = ['lightgallery', 'i18n_subsites', 'extended-sitemap']
SITEMAP = {
'format': 'xml',
@ -152,6 +152,20 @@ SITEMAP = {
'pages': 'weekly'
}
}
EXTENDED_SITEMAP_PLUGIN = {
'priorities': {
'index': 1.0,
'articles': 0.8,
'pages': 0.5,
'others': 0.4
},
'changefrequencies': {
'index': 'daily',
'articles': 'weekly',
'pages': 'monthly',
'others': 'monthly',
}
}
GITHUB_SOURCE_PATH = "wooot"

288
plugins/extended-sitemap/__init__.py

@ -0,0 +1,288 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import logging
import os
import sys
from codecs import open as codecs_open
from pelican import signals
from pytz import timezone
logger = logging.getLogger(__name__)
if sys.version_info >= (3, 0):
from urllib.parse import urljoin
else:
from urlparse import urljoin
class ConfigurationError(Exception):
"""
Exception class for wrong configurations.
"""
pass
class SitemapGenerator(object):
"""
Class for generating a sitemap.xml.
"""
xml_wrap = """<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="%(SITEURL)ssitemap-stylesheet.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
%(urls)s
</urlset>"""
template_url = """<url>
{}
</url>"""
settings_default = {
'priorities': {
'index': 1.0,
'articles': 0.8,
'pages': 0.5,
'others': 0.4
},
'changefrequencies': {
'index': 'daily',
'articles': 'weekly',
'pages': 'monthly',
'others': 'monthly',
}
}
def __init__(self, context, settings, path, theme, output_path, **kwargs):
"""
Initializes the generator class.
:param context: the generated context, mix of settings and transformed content
:type context: dict
:param settings: the pelican project settings
:type settings: dict
:param path: the path to the content files
:type path: str
:param theme: the path to the theme
:type theme: str
:param output_path: the path where the generated output is put
:type output_path: str
:param kwargs: additional keyword arguments
:type kwargs: dict
"""
self.pelican_settings = settings
self.path_content = path
self.path_output = output_path
self.context = context
if settings.get('TIMEZONE', None) is None:
raise ConfigurationError('Please specify the TIMEZONE setting!')
self.timezone = timezone(settings.get('TIMEZONE'))
self.url_site = settings.get('SITEURL')
# Pelican strips off trailing slashes during settings initialization.
# The later used urljoin function strips of path elements not ending with a trailing slash,
# a slash is added here if it is not already present
if not self.url_site.endswith('/'):
self.url_site += '/'
self.settings = settings.get('EXTENDED_SITEMAP_PLUGIN', self.settings_default)
def generate_output(self, writer):
"""
Generates the sitemap file and the stylesheet file and puts them into the content dir.
:param writer: the writer instance
:type writer: pelican.writers.Writer
"""
# write xml stylesheet
with codecs_open(os.path.join(os.path.dirname(__file__), 'sitemap-stylesheet.xsl'), 'r', encoding='utf-8') as fd_origin:
with codecs_open(os.path.join(self.path_output, 'sitemap-stylesheet.xsl'), 'w', encoding='utf-8') as fd_destination:
xsl = fd_origin.read()
# replace some template markers
# TODO use pelican template magic
xsl = xsl.replace('{{ SITENAME }}', self.context.get('SITENAME'))
fd_destination.write(xsl)
# will contain the url nodes as text
urls = ''
# get all articles sorted by time
articles_sorted = sorted(self.context['articles'], key=self.__get_date_key, reverse=True)
# get all pages with date/modified date
pages_with_date = list(
filter(
lambda p: getattr(p, 'modified', False) or getattr(p, 'date', False),
self.context.get('pages')
)
)
pages_with_date_sorted = sorted(pages_with_date, key=self.__get_date_key, reverse=True)
# get all pages without date
pages_without_date = list(
filter(
lambda p: getattr(p, 'modified', None) is None and getattr(p, 'date', None) is None,
self.context.get('pages')
)
)
pages_without_date_sorted = sorted(pages_without_date, key=self.__get_title_key, reverse=False)
# join them, first date sorted, then title sorted
pages_sorted = pages_with_date_sorted + pages_without_date_sorted
# the landing page
if 'index' in self.context.get('DIRECT_TEMPLATES'):
# assume that the index page has changed with the most current article or page
# use the first article or page if no articles
index_reference = None
if len(articles_sorted) > 0:
index_reference = articles_sorted[0]
elif len(pages_sorted) > 0:
index_reference = pages_sorted[0]
if index_reference is not None:
urls += self.__create_url_node_for_content(
index_reference,
'index',
url=self.url_site,
)
# process articles
for article in articles_sorted:
urls += self.__create_url_node_for_content(
article,
'articles',
url=urljoin(self.url_site, article.url)
)
# process pages
for page in pages_sorted:
urls += self.__create_url_node_for_content(
page,
'pages',
url=urljoin(self.url_site, page.url)
)
# process category pages
if self.context.get('CATEGORY_URL'):
urls += self.__process_url_wrapper_elements(self.context.get('categories'))
# process tag pages
if self.context.get('TAG_URL'):
urls += self.__process_url_wrapper_elements(sorted(self.context.get('tags'), key=lambda x: x[0].name))
# process author pages
if self.context.get('AUTHOR_URL'):
urls += self.__process_url_wrapper_elements(self.context.get('authors'))
# handle all DIRECT_TEMPLATES but "index"
for direct_template in list(filter(lambda p: p != 'index', self.context.get('DIRECT_TEMPLATES'))):
# we assume the modification date of the last article as modification date for the listings of
# categories, authors and archives (all values of DIRECT_TEMPLATES but "index")
modification_time = getattr(articles_sorted[0], 'modified', getattr(articles_sorted[0], 'date', None))
url = self.__get_direct_template_url(direct_template)
urls += self.__create_url_node_for_content(None, 'others', url, modification_time)
# write the final sitemap file
with codecs_open(os.path.join(self.path_output, 'sitemap.xml'), 'w', encoding='utf-8') as fd:
fd.write(self.xml_wrap % {
'SITEURL': self.url_site,
'urls': urls
})
def __get_direct_template_url(self, name):
"""
Returns the URL for the given DIRECT_TEMPLATE name.
Resolution order is:
1. ${DIRECT_TEMPLATE}_URL (custom property, no Pelican default)
2. ${DIRECT_TEMPLATE}_SAVE_AS
3. Default path
:param name: name of the direct template
:return: str
"""
name_upper = name.upper()
url = self.pelican_settings.get(
'{}_URL'.format(name_upper),
self.pelican_settings.get(
'{}_SAVE_AS'.format(name_upper),
'{}.html'.format(name)
)
)
return urljoin(self.url_site, url)
def __process_url_wrapper_elements(self, elements):
"""
Creates the url nodes for pelican.urlwrappers.Category and pelican.urlwrappers.Tag.
:param elements: list of wrapper elements
:type elements: list
:return: the processes urls as HTML
:rtype: str
"""
urls = ''
for url_wrapper, articles in elements:
urls += self.__create_url_node_for_content(
url_wrapper,
'others',
url=urljoin(self.url_site, url_wrapper.url),
modification_time=self.__get_date_key(sorted(articles, key=self.__get_date_key, reverse=True)[0])
)
return urls
def __create_url_node_for_content(self, content, content_type, url=None, modification_time=None):
"""
Creates the required <url> node for the sitemap xml.
:param content: the content class to handle
:type content: pelican.contents.Content | None
:param content_type: the type of the given content to match settings.EXTENDED_SITEMAP_PLUGIN
:type content_type; str
:param url; if given, the URL to use instead of the url of the content instance
:type url: str
:param modification_time: the modification time of the url, will be used instead of content date if given
:type modification_time: datetime.datetime | None
:returns: the text node
:rtype: str
"""
loc = url
if loc is None:
loc = urljoin(self.url_site, self.context.get('ARTICLE_URL').format(**content.url_format))
lastmod = None
if modification_time is not None:
lastmod = modification_time.strftime('%Y-%m-%d')
else:
if content is not None:
if getattr(content, 'modified', None) is not None:
lastmod = getattr(content, 'modified').strftime('%Y-%m-%d')
elif getattr(content, 'date', None) is not None:
lastmod = getattr(content, 'date').strftime('%Y-%m-%d')
output = "<loc>{}</loc>".format(loc)
if lastmod is not None:
output += "\n<lastmod>{}</lastmod>".format(lastmod)
output += "\n<changefreq>{}</changefreq>".format(self.settings.get('changefrequencies').get(content_type))
output += "\n<priority>{:.2f}</priority>".format(self.settings.get('priorities').get(content_type))
return self.template_url.format(output)
@staticmethod
def __get_date_key(obj):
return getattr(obj, 'modified', None) or obj.date
@staticmethod
def __get_title_key(obj):
return getattr(obj, 'title')
def get_generators(generators):
"""
Returns the generators of this plugin,
:param generators: current generators
:type generators: pelican.Pelican
:returns: the sitemap generator type
:rtype: type
"""
return SitemapGenerator
def register():
"""
Registers the sitemap generator.
"""
signals.get_generators.connect(get_generators)

81
plugins/extended-sitemap/sitemap-stylesheet.xsl

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Sitemap for {{ SITENAME }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
background: #fff;
color: #333;
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
p {
margin: 0;
}
table {
margin-top: 20px;
}
table tr.odd {
background-color: #eee;
}
table tr th {
font-size: 11px;
text-align: left;
}
table tr td {
font-size: 11px;
padding-right: 20px;
}
</style>
</head>
<body>
<h1>XML Sitemap for {{ SITENAME }}</h1>
<p>Generated by <a href="https://pypi.python.org/pypi/pelican-extended-sitemap">extended-sitemap plugin</a> for <a href="http://docs.getpelican.com/">Pelican</a>.</p>
<p>More about sitemaps can be found on <a href="http://sitemaps.org">sitemaps.org</a></p>
<p>URLs contained in this sitemap: <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/></p>
<table cellspacing="0">
<thead>
<tr>
<th>URL</th>
<th>Priority</th>
<th>Change Frequency</th>
<th>Last Change</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="sitemap:urlset/sitemap:url">
<tr>
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">odd</xsl:attribute>
</xsl:if>
<td>
<xsl:variable name="url">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a href="{$url}"><xsl:value-of select="sitemap:loc"/></a>
</td>
<td>
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
</td>
<td>
<xsl:value-of select="sitemap:changefreq"/>
</td>
<td>
<xsl:value-of select="sitemap:lastmod"/>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

264
plugins/extended-sitemap/tests/__init__.py

@ -0,0 +1,264 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import filecmp
import locale
import os
import re
import subprocess
import sys
import unittest
from extended_sitemap import ConfigurationError
from functools import wraps
from tempfile import mkdtemp
from pelican import Pelican
from pelican.settings import read_settings
from six import StringIO
# used paths
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
CONTENT_DIR = os.path.abspath(os.path.join(CURRENT_DIR, 'content'))
EXPECTED_DIR = os.path.abspath(os.path.join(CURRENT_DIR, 'expected'))
OUTPUT_PATH = os.path.abspath(os.path.join(CURRENT_DIR, 'output'))
def isplit(s, sep=None):
"""Behaves like str.split but returns a generator instead of a list.
>>> list(isplit('\tUse the force\n')) == '\tUse the force\n'.split()
True
>>> list(isplit('\tUse the force\n')) == ['Use', 'the', 'force']
True
>>> (list(isplit('\tUse the force\n', "e"))
== '\tUse the force\n'.split("e"))
True
>>> list(isplit('Use the force', "e")) == 'Use the force'.split("e")
True
>>> list(isplit('Use the force', "e")) == ['Us', ' th', ' forc', '']
True
"""
sep, hardsep = r'\s+' if sep is None else re.escape(sep), sep is not None
exp, pos, l = re.compile(sep), 0, len(s)
while True:
m = exp.search(s, pos)
if not m:
if pos < l or hardsep:
# ^ mimic "split()": ''.split() returns []
yield s[pos:]
break
start = m.start()
if pos < start or hardsep:
# ^ mimic "split()": includes trailing empty string
yield s[pos:start]
pos = m.end()
def mute(returns_output=False):
"""Decorate a function that prints to stdout, intercepting the output.
If "returns_output" is True, the function will return a generator
yielding the printed lines instead of the return values.
The decorator literally hijack sys.stdout during each function
execution, so be careful with what you apply it to.
>>> def numbers():
print "42"
print "1984"
...
>>> numbers()
42
1984
>>> mute()(numbers)()
>>> list(mute(True)(numbers)())
['42', '1984']
"""
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
saved_stdout = sys.stdout
sys.stdout = StringIO()
try:
out = func(*args, **kwargs)
if returns_output:
out = isplit(sys.stdout.getvalue().strip())
finally:
sys.stdout = saved_stdout
return out
return wrapper
return decorator
class FileComparisonTest(unittest.TestCase):
"""
Unittest class with possibility to assert equal file contents.
"""
def assertFileContentEquals(self, path_file_expected, path_file_test):
"""
Asserts the file contents to be equal.
:param path_file_expected: path to the file with the expected content
:type path_file_expected: str
:param path_file_test: path to the file to test
:type path_file_test: str
"""
if not filecmp.cmp(path_file_expected, path_file_test):
msg_fail = 'File content of %(filename)s does not match expected content!' % {'filename': path_file_test}
# if there is git and git diff works for both files, append the file diff to the fail message
try:
out, err = subprocess.Popen(
['git', 'diff', '--minimal', '--no-color', '--no-ext-diff', '--exit-code', '-w', path_file_expected, path_file_test],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
).communicate()
if len(err) == 0:
msg_fail += '\n\n' + out.decode('utf-8')
except OSError:
# if there is no git, just don't output the diff
pass
self.fail(msg_fail)
class ExtendedSitemapTest(FileComparisonTest):
def setUp(self):
self.path_temp = mkdtemp(prefix='extended_sitemap_tests.')
self.path_cache = mkdtemp(prefix='extended_sitemap_cache.')
# default minimal configuration for pelican in test context
self.settings_default = {
'PAGE_DIR': os.path.join(CONTENT_DIR, 'pages'),
'ARTICLE_DIR': os.path.join(CONTENT_DIR, 'articles'),
'PATH': CONTENT_DIR,
'OUTPUT_PATH': self.path_temp,
'CACHE_PATH': self.path_cache,
'LOCALE': locale.normalize('en_US'),
'SITEURL': 'http://example.com',
'PLUGIN_PATH': os.path.join(CURRENT_DIR, '..'),
'PLUGINS': ['extended_sitemap'],
}
def __execute_pelican(self, settings_override=None):
"""
Executes pelican. Uses the minimal config of self.settings_default (that will fail!) merged with the given additional settings.
:param settings_override: dictionary with pelican setting values to set
:type settings_override: dict
"""
if not settings_override:
settings_override = {}
settings = self.settings_default.copy()
settings.update(settings_override)
pelican_settings = read_settings(
path=None,
override=settings
)
pelican = Pelican(settings=pelican_settings)
pelican.run()
def test_timezone_missing(self):
"""
As the TIMEZONE settings is necessary to create timezone based date value, ensure the configuration exception is raised if it is not configured.
"""
self.assertRaises(ConfigurationError, self.__execute_pelican)
def test_sitemap_structure(self):
"""
Tests basic structure of generated sitemap.
"""
self.__execute_pelican(
settings_override={
'TIMEZONE': 'Europe/Berlin',
}
)
self.assertFileContentEquals(
os.path.join(EXPECTED_DIR, 'test_sitemap_structure.xml'),
os.path.join(self.path_temp, 'sitemap.xml')
)
def test_sitemap_structure_subpaths(self):
"""
Tests basic structure of generated sitemap with subpath in domain.
"""
# issue #2
self.__execute_pelican(
settings_override={
'TIMEZONE': 'Europe/Berlin',
'SITEURL': 'http://example.com/subpath',
}
)
self.assertFileContentEquals(
os.path.join(EXPECTED_DIR, 'test_sitemap_structure_subpath.xml'),
os.path.join(self.path_temp, 'sitemap.xml')
)
def test_sitemap_structure_custom_article_url(self):
"""
Tests basic structure of generated sitemap with customized ARTICLE_URL and ARTICLE_SAVE_AS settings.
"""
# issue #2
self.__execute_pelican(
settings_override={
'TIMEZONE': 'Europe/Berlin',
'ARTICLE_URL': 'customarticles/{date:%Y}/{date:%b}/{date:%d}/{slug}/',
'ARTICLE_SAVE_AS': '{slug}.custom.html',
}
)
self.assertFileContentEquals(
os.path.join(EXPECTED_DIR, 'test_sitemap_structure_custom_article_url.xml'),
os.path.join(self.path_temp, 'sitemap.xml')
)
def test_sitemap_structure_with_custom_direct_templates_filenames(self):
"""
Tests sitemap structure with custom %s_SAVE_AS values for DIRECT_TEMPLATES.
Source: https://github.com/dArignac/pelican-extended-sitemap/issues/14
"""
self.__execute_pelican(
settings_override={
'TIMEZONE': 'Europe/Berlin',
'TAGS_SAVE_AS': 'abc/tags.html',
'CATEGORIES_SAVE_AS': 'cats/meow/something.txt',
'AUTHORS_SAVE_AS': 'those-writers.html',
'ARCHIVES_SAVE_AS': 'our-curated-library.html',
}
)
self.assertFileContentEquals(
os.path.join(EXPECTED_DIR, 'test_sitemap_structure_direct_templates_1.xml'),
os.path.join(self.path_temp, 'sitemap.xml')
)
def test_sitemap_structure_with_custom_direct_templates_urls(self):
"""
Tests sitemap structure with custom %s_URL values for DIRECT_TEMPLATES.
Source: https://github.com/dArignac/pelican-extended-sitemap/issues/15
"""
self.__execute_pelican(
settings_override={
'TIMEZONE': 'Europe/Berlin',
'TAGS_URL': 'abc/tags',
'CATEGORIES_URL': 'cats/meow',
'AUTHORS_URL': 'authors/all',
'ARCHIVES_URL': 'lib/the-archive/list/',
# also define the SAVE_AS to test correct resolution sorting
'TAGS_SAVE_AS': 'abc/tags.html',
'CATEGORIES_SAVE_AS': 'cats/meow/something.txt',
'AUTHORS_SAVE_AS': 'those-writers.html',
'ARCHIVES_SAVE_AS': 'our-curated-library.html',
}
)
self.assertFileContentEquals(
os.path.join(EXPECTED_DIR, 'test_sitemap_structure_direct_templates_2.xml'),
os.path.join(self.path_temp, 'sitemap.xml')
)

64
plugins/extended-sitemap/tests/content/articles/article1.md

@ -0,0 +1,64 @@
Title: Article One
Date: 2007-11-19 21:16
Author: Dexter
Category: Sample Category 1
Tags: tag0, tag1
Slug: article-one
# Morientibus virum
## Natura auctor ne Medea summum inter motu
Lorem markdownum urbis dedisset tyranni debebit, remorata harpen volatilis
tellus, imperet quid quaedam [te](http://imgur.com/) signa curis. Sole pro vis,
nil iras lentae greges sine. Ad ducat.
*Huic arsit*. Secum et *iuga* et mitis hoc orbem horror, at? Turba Rhodosque et
lacer tamen nobis media viae datque umbras ardua spectare. Reliquit de fixo
coniuge rettulit dat: manent memorabile natus alte fuit pressus, illo ad duratur
ponunt dedit.
> Ultimus prior mater, obstipuit convulso circumlita deorum nec, tremulis,
> conlectae. Manifesta solis, facturus in [humi](http://www.wtfpl.net/) signa
> vidi: sint. Temptat doluit, *medium*, nos erat: utque *suo alta* longoque
> astris addiderat mutabile.
## Clymene optima huic est sanguine caelique malae
Et thymo adulter, orbem nutritaque undam puellae perluitur in post primo meritum
canes illo! Macies ego telique debet, operum oculi?
var ppl = printer_unicode_bitmap;
mail *= autoresponderVlePower;
if (696041 + bridgeUddi) {
agp += 275126;
plain_ad_dot += input;
} else {
sourceHypertextReciprocal(bridge_hdd_left(io_ppl), mp);
t_crossplatform *= pdf_client_management;
}
Eris munire, sed Phoebi **caelum senserat**, turris caput auxiliaribus novos
altissima? [Fatus diu](http://zeus.ugent.be/) parte perdere texta adsensere
aspergine adiecit revolvor recto in coniugis uterque trepidare harum summa.
Istis quae morientia tu silentia illas quacumque quendam! Non in non ex *locat
qui*, cum carminaque celerique Pyrame Iphinoum et! Tenuit carminaque cornua,
contudit fictilibus socialis Haemonia **faciat ferunt**; fores leves non
multisque.
- Alta amet et circumstant tenus placidam nemorumque
- Illic illa aut
- Frontem sua
- Quod sed suo addidit corpusque enim habitat
- Crimen ad transit
Stridula per suam, ferendo et refert ille, Acheronte? Vetat saevit, isse fortes
ullo tellus refert deorum dedit petendo longa non imago premebat traiecti.
Firmas [echidnis hiatu oculosque](http://www.thesecretofinvisibility.com/)
Ausoniae procul, in fuit excussit aureus, si quod in canistris et stellis *et*.
Rector iudicium pectore subitarum, **deum nobis virga** mitissima communis.
[Fatus diu]: http://zeus.ugent.be/
[echidnis hiatu oculosque]: http://www.thesecretofinvisibility.com/
[humi]: http://www.wtfpl.net/
[te]: http://imgur.com/

63
plugins/extended-sitemap/tests/content/articles/article2.md

@ -0,0 +1,63 @@
Title: Article Two
Date: 2011-01-30 18:00
Author: Johnny
Category: Sample Category 2
Tags: tag1, tag2
Slug: article-two
# Huic veros narrata dictis
## Vani omnes gener arceat quicquam et caelo
Lorem markdownum incerto dicta auctoribus, sanguine ille nostri in sanguine quam
est ut letalem deorum: quarum. In extrema versos protinus aetas. Tremit
prosternite malo ut tardata saucia et quem ultima? Sunt non tantus, illi per,
**hortaturque** illa tibi. Tigres precatur fulvae, pietas quam vulnus nec
*negat* devicto aera facere.
push_hover(worm_defragment(wampDac, up / 36));
design_primary_default /= ole;
if (-3) {
jfs += extranet + 37;
} else {
white.web += 3 / leopardSystem * 1;
name_cyberbullying_host -= osi;
}
driveProgramPerl += -2 + 1 + graymail;
In patriaque aversa: et nostris coepi animans retinere surgit? Arethusa **utque
ut** vulnere oppositoque salutem erat tremescere fores clamare exstinctum supra:
frustra circumspice fecisse. Scylla meae **illo dato** permanet in
[cum](http://www.wedrinkwater.com/), quo Canentem, deo. Recurvam cauda
**fatisque totidem** durisque precatur Salamis vellera manusque. Ne nec mutatus
madidos oculis, Iris [habet](http://eelslap.com/) patet quondam: [deus
ille](http://seenly.com/) homini vera; est una merito non.
## Nunc est genetrix
Tanta infans, origo percutit templis differt rumpere! Saturno molibar vestigia
sua eandem procorum, infelix enses iussit peiora longa Regi depositum; dum
pronus toto munere ille.
Gelido contra quod veneratur secum? Cum putet imum ora ignoscite, odorant,
exactum adde Atalanta parvae nequeat, venerantur nuntia Caras pugnat. Novitate
et iniquis ruricolam quadrupedes et moenia proceres et totaeque delapsus
Medusaei posset, hoc bis quoque est crepitantibus. Malorum amores nymphe moves
**caput** nec, nos a rapitur pariter.
- Saevus Minos potiuntur delapsa virisque adparentia belli
- Nervosus edita Idaeumque legit subiectum nec
- Hac quidquid lacrimaeque eodem
- Undas ferens
- Curvis deiectoque excusare sagittas illic
Hunc inritans Phylius est quam **genuit** praecepta ad tempora. Pars parenti.
Quae quo urbis haec tumulos, a tincta hi parte habebat; di inque, modo licet.
Diversa servata penna certe et, actorum aras feram [me mori
satis](http://news.ycombinator.com/). An sine, comminus.
[cum]: http://www.wedrinkwater.com/
[deus ille]: http://seenly.com/
[habet]: http://eelslap.com/
[me mori satis]: http://news.ycombinator.com/

64
plugins/extended-sitemap/tests/content/articles/article3.md

@ -0,0 +1,64 @@
Title: Article Three
Date: 2014-05-21 13:49
Modified: 2014-06-01 10:12
Author: Miri
Category: Sample Category 3
Tags: tag3, tag4
Slug: article-three
# Ipsi mutato nec Clyton suspiria ex
## Honores iuventae
Lorem markdownum puerilibus annis, illa Iphis Proximus discordia favet huic:
cum. Nec alta lecto arma Delonque: ac dixit lacrimis sit faciat, arcem lignum
Ithaceque?
## Sic pisce Dicta si
Parenti suasit, est pomi poposcerit cera. Superis cruentum grandine *crescunt
fatebitur non* iacta celsum; vindicta Echion, adest? Bis ita non, in mandata
totiens differt trepido fervet.
Causa percutit hostem ferax geminique cognoverat virga, vir et idem, disiunxisse
in letalis stillanti. Fatentem in flenda Charybdin simulacra locis nec vertice
prima esse Plena dum! Collis ferro, est mihi edaci pius laberis ut curribus
corpus distinguunt callem gelidumque aranea semper? O mens Idaei rerum an tunc,
baculisque inpar **tempusque redditur**. Arte en essent tamen homines inplent
orantem perstat?
## Et et mitissimus amor
Metuque solvit in medio peremptum nubila verti circumdata decus. Suo an morae
omnia **locum**: ecce patrem ostendit invita [restabat](http://zombo.com/); in
minus; nisi frustra. Animi patrem sui irascere tori ignavi, nec tuta thalamosque
quisque, tum. Bis nec arator coniecto luctu, multi est **lumina sui** rogaberis
regis.
ugc.eps(process_lossless_freeware(hover), sourceLeftRemote + internic / -1,
computer);
if (gigoRemote) {
fsb = appleWebmaster(system, architecture + boot_mini, mnemonicUsbGigo);
menu = 5;
terminal_ad_matrix(download);
}
card.filePciSubdirectory(readme(user, 2) + 1);
## Temone ego
Cupido minus saepe genas pedes Echion rudem, cognovit timorem, utile consuescit
prius. Regum nec puer Bactrius non novercam humi contingere: superatae gravis.
Quae inde luctus aristas, aut te vellera ignara ipsa ruptosque decus Nabataeaque
invisa, exstinctum? Si quos umeri ab *inque Cypriae* Clymene quod famulasque
odore nobilis de.
1. Alas cadunt rore artes amans fulmen
2. Et non nunc urbes segetis in animosque
3. Propinquos medio agit
Conatur saepe, detrahe manusque! Ut adde, lina Aesacon anhelitus stravimus
saepe! Cauda profundo: sibi et forti tempora! Ego Medusaei; acre **iter**, annos
lumina dubioque clipeoque at orbem: illis regia pleno cutis comitem Cytherea.
[restabat]: http://zombo.com/

83
plugins/extended-sitemap/tests/content/pages/page1.md

@ -0,0 +1,83 @@
Title: Page One
Date: 2007-11-13 13:57
Author: Gilvan
Slug: page-one
# Ita e subsunt audet in expulit
## Veneno ducumque et crimine atque
Lorem markdownum. Iubeoque [in](http://zeus.ugent.be/) locuta tulit, quaeque ego
animi, et fatebor!
var username_scalable = circuit_clock(faviconMemoryRuntime);
if (dbms_insertion.barProgramCodec(http + logic, snapshot(-3), san)) {
bookmark_tiff = gatewayCross.input_bsod(url_batch_rt, cyberspace(
supercomputerStorage, modeOspf, twain_express_snapshot),
browserOlap.balance(-5, margin));
vpn_console_matrix -= tigerWhoisReal;
} else {
p = seo_mainframe_keywords(iterationBus / 880060);
express_isa_desktop += sdsl + errorUsername;
mac += redundancy + clone * jpeg_cd;
}
mail += icmpGammaTypeface;
if (interactive > grayscaleIrqBsod) {
digital_traceroute_raw.pcb(sidebar_virtual_third, tag_koffice,
thick_mail_drive / 2);
} else {
viral_class += adsl;
key(phpBarAssociation, lion);
}
virtualizationVeronicaCharacter.protocol(recursive.supercomputer_raw(
trojan_storage, imapParallelHyperlink));
Fungi rustice iubet inlimis notam dextram nymphaeque nec, **ille Asterien
favent** fuit, esset. Cum ferre, regnum pharetra luet probatis et Somnus
Pallantias enim. Communes coniugis laetitiae huius ergo vulnera per, et reliquit
solvo pulchraque erat. Haberent terga. Ire Phrygiis canum [crimina
in](http://www.uselessaccount.com/) clauso munera corpora portasque perque
tauros, amorem sacraque.
definition_applet_gigabyte -= function_chip_expansion.bcc(87) +
processMegabitControl.sdram(uri, flash_pppoe + alertFullPci,
client_upnp);
parseInstall -= dialog - base + 3;
ring_ddr(passive(lossy, 1 + -3, pointProgrammingP + openServicesSample),
drop + 3, cloneActive);
menu_pharming = app;
matrixVci(model * aluLosslessTunneling);
## Aliis auro promissi sibila
Nunc claro, quae Sybarin somnis. Modo ortus demptos nostrae at herba, parabat.
Factoque dixit levarit tenet dubitat genitor modico! Ad male inter.
Nec germanaeque qui ore una spectat pectore, in ora amplexus prehensis in. Tenus
Danaam haec! Dea costis tacitaque cultique frater.
spreadsheet.transfer(remoteFileParameter, cifsCacheTopology);
primary_ttl_terminal.pda(duplex_rtf);
if (directoryServiceDv) {
internalCopyrightRss(driverCopyright, 81, start);
quadCms = favicon_disk - guid;
} else {
streaming_gateway(lamp_import, pmu_hsf_thumbnail, lock_ppi + data);
unixMini += 1 + kibibyteListservNoc + bar_spoofing_qwerty;
}
if (zebibyteKilobyte < target_atm) {
cpsScrollTag(gif_namespace_sdk(kerning_network_drive, gateway_printer,
37), leaderboardExtension);
}
var web_samba = gate(wepModem, recordUpMemory.dma(push_kbps_protector -
firewire_cc_winsock, api - windows_forum, hardBatchVolume), 3);
Causas quis superos in aura *sit sunt excutit* quidem, tanti, bracchia, sed
poenae animus sustineat. Fallitis et mandata ferat laniarat aethera. Ecquid vero
Canentem ignis quatiens per modo aetatis, et florem
[tenderet](http://www.wtfpl.net/). Ecce qua ulla et forcipe, qui Perseus, Dauno,
somno! Ferus aves caput procul dextra.
[crimina in]: http://www.uselessaccount.com/
[in]: http://zeus.ugent.be/
[tenderet]: http://www.wtfpl.net/

80
plugins/extended-sitemap/tests/content/pages/page2.md

@ -0,0 +1,80 @@
Title: Page Two
Date: 2013-12-10 16:15
Modified: 2014-01-12 07:00
Author: Tabrett
Slug: page-two
# Positaeque luctibus
## Dote postes et horror auxiliumque tenebras haerentem
Lorem markdownum **humiles**, est aetas adgreditur domui tegmina flammis ore
excussis; est nemus Typhoea ferat. Adsensere fontis et ille tauri tibi nam
Proreus namque armis veniat [plumae ab](http://gifctrl.com/) est est in *totidem
caput nil* Corythus? Hamato sine undis agitante velut partim vulnera
[ire](http://imgur.com/) sit ora perfudit di latus scilicet terunt.
if (rippingProtectorVertical == textCell) {
jspPop.eDriveAdd.moodle_voip_pram(metafileNull);
malwareIpUnfriend += tableDebugCpu(oop);
} else {
service.os_ansi_backup = tweet + 3 + sequence_dns / smishing_office_sms;
hardLeak = webmail / dcimMarketing;
}
var flowchartForumXml = botnet;
alignmentJpegService += t(basic);
if (menu) {
standbySpooling.mountainWord(ioCopyCross(ccd, dongle_ipad, dualPage),
mampTextScreenshot(engine, metafile), mailFile);
node_key_exif.twitter_system_pinterest *= hard_input_type;
media = index.basic(read_lun_panel, bannerBitrateWi);
} else {
io.leak = 4;
wrap_point -= 1;
}
## Timoli aristis
Frequens Ilios temerarius rursus mugitibus captiva ubi nimbos non alas fila,
nulla venientem Minos et. Petitis verba mortis ducimus, quo sinus habet.
## Sic tu dumque adnuit imagine quidem
Presso regno! Hoc militis, aemulus! Custos tulit desit pugnae velocius proterit,
manibus vocantia socio ire memor gramen *montibus*. Dedere me referat pugnet.
## Nec temporis
Abiit tulerat forma laudaret; ilicet verus potius solutis viderat, dilacerant
*lapis*, et quid. Verendam ecce Cinyphiumque promptas hac nulla subegit incinxit
percusso. Pro suspiria enim, cape Astraei factus luctus alimentaque copia! Iove
vitae, ante de amnes nigri; **undas** quam tristia potiar, et **vagantem**,
insula memor egit.
if (coreCodeConstant) {
recursionCyberbullyingSoft.diskMashupSql /= raySwappable.torrent(ip);
} else {
wave_native_social(dcim_system_hard, fpu_token, variable_memory);
}
cmosLayout(5 + numberSampleBit * operationTrojan, reality_io_definition, 5);
edutainment(joystickSecondaryBar);
## Crura utentem
Lumina expers, equidem, ira fera rigidum sanguinis [magna
percurrens](http://www.lipsum.com/) sibi bracchia? Si mitto ad domum **valens**
infectaque *corpore*. **Ab** meos dicit illo utroque [discidium magnos
glaebis](http://zombo.com/); nec Iove renoventur; ille. Leto relinquent aperti
capiebat Cereris vocavit?
> Mora tunc nolim. Duabus magos si Cleonae tauri incaluit **peteret Meleagre**,
> in flores manus novit herbas, ea. Virginis sibi qui adhaeret Lapitheia
> quantum!
Praeceps ut a magni, haec herbas? Deos veribus cui. Si des vestigia sed pectoris
stellas, vellet **Calliroe maerenti tetigit** conspectior valle.
[discidium magnos glaebis]: http://zombo.com/
[ire]: http://imgur.com/
[magna percurrens]: http://www.lipsum.com/
[plumae ab]: http://gifctrl.com/

20
plugins/extended-sitemap/tests/content/pages/page3.md

@ -0,0 +1,20 @@
Title: X - a page without date and modified date
Author: Wisdom
Slug: page-three
# Celatur pace pervius
Cum quae, vulnere magni Faunine telum, et illum negare extremum demunt dat
obstitit pressos. Pindo inmissos, praesaga nostri vero: chordas mutataeque
metuitque aequora; sub nisi, nec exstante in *virgine*! Tenet in in in sed nec
dum *pectora augerem* vernat bitumen quoniam *illa nec* gentes bracchia Phrygum.
- Inoosque Ausonias igne
- Non non
- Victor saepe
- Ad pectus et pectora futura
Idem sui quam ereptaque steriles vestra artesque dederunt in infuso, precari,
quae omnia, me. Quis incerti Pygmaeae, et sit solidoque saetaeque sacra modo;
corymbis committe tantos? Rerum veri caede, cuius clamat sed cunctis; lac
statque carmen. Est **tota Dianae** diem: ergo ingeniis, quas figitque!

13
plugins/extended-sitemap/tests/content/pages/page4.md

@ -0,0 +1,13 @@
Title: Some other page without date
Author: Wisdom
Slug: page-four
# Deme negat accingitur victi
## Vulgi hostibus de cecidit dedit mea Thebae
Lorem markdownum, nunc Phoebo turba et solida certe non pars recta ignoto,
incubuit procedit lacrimis leones, suos. Agros esse genitor excipit scindit,
sine, te sensit ad illinc. Erat Peleusque ponat multa: dixit misce Lelegeides
super convellere, gravi. Quas campus maxima clipei me quot *quae* deus, insuper
et ille nec, custodia flumine!

117
plugins/extended-sitemap/tests/expected/test_sitemap_structure.xml

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://example.com/sitemap-stylesheet.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://example.com/</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>daily</changefreq>
<priority>1.00</priority>
</url><url>
<loc>http://example.com/article-three.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/article-two.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/article-one.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/pages/page-two.html</loc>
<lastmod>2014-01-12</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-one.html</loc>
<lastmod>2007-11-13</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-four.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-three.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/category/sample-category-1.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag0.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag1.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag4.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/dexter.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/johnny.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/miri.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tags.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/categories.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/authors.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/archives.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url>
</urlset>

117
plugins/extended-sitemap/tests/expected/test_sitemap_structure_custom_article_url.xml

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://example.com/sitemap-stylesheet.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://example.com/</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>daily</changefreq>
<priority>1.00</priority>
</url><url>
<loc>http://example.com/customarticles/2014/May/21/article-three/</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/customarticles/2011/Jan/30/article-two/</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/customarticles/2007/Nov/19/article-one/</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/pages/page-two.html</loc>
<lastmod>2014-01-12</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-one.html</loc>
<lastmod>2007-11-13</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-four.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-three.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/category/sample-category-1.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag0.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag1.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag4.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/dexter.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/johnny.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/miri.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tags.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/categories.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/authors.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/archives.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url>
</urlset>

117
plugins/extended-sitemap/tests/expected/test_sitemap_structure_direct_templates_1.xml

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://example.com/sitemap-stylesheet.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://example.com/</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>daily</changefreq>
<priority>1.00</priority>
</url><url>
<loc>http://example.com/article-three.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/article-two.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/article-one.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/pages/page-two.html</loc>
<lastmod>2014-01-12</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-one.html</loc>
<lastmod>2007-11-13</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-four.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-three.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/category/sample-category-1.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag0.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag1.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag4.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/dexter.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/johnny.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/miri.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/abc/tags.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/cats/meow/something.txt</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/those-writers.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/our-curated-library.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url>
</urlset>

117
plugins/extended-sitemap/tests/expected/test_sitemap_structure_direct_templates_2.xml

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://example.com/sitemap-stylesheet.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://example.com/</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>daily</changefreq>
<priority>1.00</priority>
</url><url>
<loc>http://example.com/article-three.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/article-two.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/article-one.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/pages/page-two.html</loc>
<lastmod>2014-01-12</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-one.html</loc>
<lastmod>2007-11-13</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-four.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/pages/page-three.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/category/sample-category-1.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/category/sample-category-3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag0.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag1.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/tag/tag4.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/dexter.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/johnny.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/author/miri.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/abc/tags</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/cats/meow</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/authors/all</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/lib/the-archive/list/</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url>
</urlset>

117
plugins/extended-sitemap/tests/expected/test_sitemap_structure_subpath.xml

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://example.com/subpath/sitemap-stylesheet.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://example.com/subpath/</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>daily</changefreq>
<priority>1.00</priority>
</url><url>
<loc>http://example.com/subpath/article-three.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/subpath/article-two.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/subpath/article-one.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url><url>
<loc>http://example.com/subpath/pages/page-two.html</loc>
<lastmod>2014-01-12</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/subpath/pages/page-one.html</loc>
<lastmod>2007-11-13</lastmod>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/subpath/pages/page-four.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/subpath/pages/page-three.html</loc>
<changefreq>monthly</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://example.com/subpath/category/sample-category-1.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/category/sample-category-2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/category/sample-category-3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/tag/tag0.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/tag/tag1.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/tag/tag2.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/tag/tag3.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/tag/tag4.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/author/dexter.html</loc>
<lastmod>2007-11-19</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/author/johnny.html</loc>
<lastmod>2011-01-30</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/author/miri.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/tags.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/categories.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/authors.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url><url>
<loc>http://example.com/subpath/archives.html</loc>
<lastmod>2014-06-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.40</priority>
</url>
</urlset>

18
plugins/lightgallery/lightgallery.py

@ -17,7 +17,6 @@ def process_content(article):
page, using the local bib file if specified or the global one otherwise.
"""
content = article._content
logger.info("start\n\n")
content = "" + content
i = content.count("[lightgallery")
@ -32,7 +31,7 @@ def process_content(article):
m = find_between(content, '[lightgallery', 'lightgalleryend]')
imgs = m.split(';')
logger.info("" + article.title + "\n")
logger.debug("" + article.title + "\n")
imgs_text = ""
for i in imgs:
cont = i.split(',')
@ -45,7 +44,6 @@ def process_content(article):
if (len(cont) > 1):
img_text = "<h4>" + cont[1] + "</h4>"
logger.info("t\'" + img_url + "\'a\'" + img_text + "\'\n")
zoom_url = "/theme/images/zoom.png"
imgs_text += "<li "
@ -87,10 +85,9 @@ def process_content(article):
replace_text += imgs_text
replace_text += "</ul>"
replace_text += "</div>"
logger.info("" + replace_text + "\n")
content = content.replace('[lightgallery' + m + 'lightgalleryend]', replace_text)
article._content = content
logger.info("end\n\n")
logger.debug("end\n\n")
pass
@ -108,8 +105,6 @@ def find_between(s, first, last):
def add_gallery(generators):
logger.info("add_gallery\n\n")
# Process the articles and pages
for generator in generators:
if isinstance(generator, ArticlesGenerator):
@ -127,28 +122,23 @@ def create_scaled_image(org_path, new_path, resize_width):
from resizeimage import resizeimage
import os
logger.info("gen " + new_path + "from " + org_path + " size " + str(resize_width) + "\n")
logger.debug("gen " + new_path + "from " + org_path + " size " + str(resize_width) + "\n")
exists = os.path.isfile(new_path)
if exists:
logger.info("skip nothing to do\n")
return ""
dir_path = str(Path(new_path).parent)
exists = os.path.isdir(dir_path)
if not exists:
logger.info("create dir " + dir_path)
os.mkdir(dir_path)
logger.info("convert \n")
img = PIL.Image.open(org_path)
width, height = img.size
logger.info("" + str(width) + "\n")
if (width > resize_width):
img = resizeimage.resize_width(img, resize_width)
img.save(new_path, img.format)
img.close()
logger.info("done \n")
def create_exif_print(img_path):
@ -163,7 +153,7 @@ def create_exif_print(img_path):
exif = img._getexif()
img.close()
logger.info("######### exif " + img_path + "\n")
logger.debug("######### exif " + img_path + "\n")
if exif is None:
return ""

Loading…
Cancel
Save