From a987b65bd2abe6faa37425c4f061362435125382 Mon Sep 17 00:00:00 2001 From: "M. Utku Altinkaya" Date: Wed, 25 Sep 2013 04:43:06 +0300 Subject: [PATCH 0001/1303] Watch static folders in Autoreload mode --- pelican/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pelican/__init__.py b/pelican/__init__.py index b3ffe21a..5cf89927 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -320,6 +320,9 @@ def main(): pelican.ignore_files), 'settings': file_watcher(args.settings)} + for static_path in settings.get("STATIC_PATHS", []): + watchers[static_path] = file_watcher(static_path) + try: if args.autoreload: print(' --- AutoReload Mode: Monitoring `content`, `theme` and' From 2b87eb7af63b856862d65e289fefe3f295409bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 25 Sep 2013 23:35:36 +0200 Subject: [PATCH 0002/1303] Add a caching mechnism --- pelican/__init__.py | 23 +++++++++++++++++++---- pelican/cache.py | 37 +++++++++++++++++++++++++++++++++++++ pelican/readers.py | 7 +++++++ pelican/settings.py | 4 +++- 4 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 pelican/cache.py diff --git a/pelican/__init__.py b/pelican/__init__.py index b3ffe21a..6057a31c 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -13,13 +13,16 @@ import collections from pelican import signals -from pelican.generators import (ArticlesGenerator, PagesGenerator, - StaticGenerator, SourceFileGenerator, - TemplatePagesGenerator) +from pelican.generators import ( + ArticlesGenerator, PagesGenerator, StaticGenerator, SourceFileGenerator, + TemplatePagesGenerator +) from pelican.log import init from pelican.readers import Readers from pelican.settings import read_settings -from pelican.utils import clean_output_dir, folder_watcher, file_watcher +from pelican.utils import ( + clean_output_dir, folder_watcher, file_watcher, mkdir_p +) from pelican.writers import Writer __version__ = "3.3.1.dev" @@ -48,10 +51,17 @@ class Pelican(object): self.delete_outputdir = settings['DELETE_OUTPUT_DIRECTORY'] self.output_retention = settings['OUTPUT_RETENTION'] + self.init_filesystem() self.init_path() self.init_plugins() signals.initialized.send(self) + def init_filesystem(self): + cache_dir = self.settings['CACHE_PATH'] + if self.settings['USE_CACHE'] and not os.path.exists(cache_dir): + logger.debug('Creating directory {0}'.format(cache_dir)) + mkdir_p(cache_dir) + def init_path(self): if not any(p in sys.path for p in ['', os.curdir]): logger.debug("Adding current directory to system path") @@ -261,6 +271,9 @@ def parse_arguments(): action='store_true', help="Relaunch pelican each time a modification occurs" " on the content files.") + + parser.add_argument('--cache', dest='use_cache', action='store_true', + help='Cache the file rendering between runs') return parser.parse_args() @@ -276,6 +289,8 @@ def get_config(args): config['THEME'] = abstheme if os.path.exists(abstheme) else args.theme if args.delete_outputdir is not None: config['DELETE_OUTPUT_DIRECTORY'] = args.delete_outputdir + if args.use_cache: + config['USE_CACHE'] = True # argparse returns bytes in Py2. There is no definite answer as to which # encoding argparse (or sys.argv) uses. diff --git a/pelican/cache.py b/pelican/cache.py new file mode 100644 index 00000000..8b78c6f6 --- /dev/null +++ b/pelican/cache.py @@ -0,0 +1,37 @@ +import os.path +import hashlib +import pickle +import logging + +logger = logging.getLogger(__name__) + + +class CachedReader(object): + + def __init__(self, reader, cache_path): + self._reader = reader + self._cache_path = cache_path + + def process_metadata(self, *args, **kwargs): + return self._reader.process_metadata(*args, **kwargs) + + def read(self, path): + mtime = os.stat(path).st_mtime + + m = hashlib.md5() + # We want to hash path + mtime + m.update(path) + m.update(str(mtime)) + hash_ = m.hexdigest() + + cache_file = os.path.join(self._cache_path, hash_) + if os.path.exists(cache_file): + logger.debug('reading {0} from cache'.format(path)) + with open(cache_file) as f: + content, metadata = pickle.load(f) + else: + content, metadata = self._reader.read(path) + with open(cache_file, 'w+') as f: + pickle.dump((content, metadata), f) + logger.debug('stored {0} in the cache'.format(path)) + return content, metadata diff --git a/pelican/readers.py b/pelican/readers.py index 067bbb85..f632eec8 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -35,6 +35,7 @@ except ImportError: from HTMLParser import HTMLParser from pelican import signals +from pelican.cache import CachedReader from pelican.contents import Page, Category, Tag, Author from pelican.utils import get_date, pelican_open @@ -435,6 +436,12 @@ class Readers(object): reader = self.readers[fmt] + if self.settings['USE_CACHE']: + # If we are using a cache, then the reader class should be a cached + # one. + reader = CachedReader(reader=reader, + cache_path=self.settings['CACHE_PATH']) + metadata = default_metadata( settings=self.settings, process=reader.process_metadata) metadata.update(path_metadata( diff --git a/pelican/settings.py b/pelican/settings.py index 99828935..f472ba74 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -112,6 +112,8 @@ DEFAULT_CONFIG = { 'IGNORE_FILES': ['.#*'], 'SLUG_SUBSTITUTIONS': (), 'INTRASITE_LINK_REGEX': '[{|](?P.*?)[|}]', + 'CACHE_PATH': '_pelican_cache', + 'USE_CACHE': False, } PYGMENTS_RST_OPTIONS = None @@ -121,7 +123,7 @@ def read_settings(path=None, override=None): if path: local_settings = get_settings_from_file(path) # Make the paths relative to the settings file - for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'PLUGIN_PATH']: + for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'PLUGIN_PATH', 'CACHE_PATH']: if p in local_settings and local_settings[p] is not None \ and not isabs(local_settings[p]): absp = os.path.abspath(os.path.normpath(os.path.join( From a49b744e951a810040baca27ff04fda23f973e26 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Thu, 26 Sep 2013 00:37:35 +0200 Subject: [PATCH 0003/1303] Fix tests with latest versions of smartypants. smartypants is now py3 compatible but the default settings for double quotes has been changed (http://pythonhosted.org/smartypants/changes.html). This commit: - update the typogrify test (change quotes, and add more test casesi: caps word, ellipsis) - install typogrify on travis - uses upstream version of smartypants in tox instead of dmdm's fork for py3 --- .travis.yml | 2 ++ pelican/tests/content/article.rst | 2 +- pelican/tests/test_readers.py | 13 +++++++------ tox.ini | 1 - 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1df32baa..62373e68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ before_install: - sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8 install: - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then ln -s /usr/share/asciidoc/asciidocapi.py ~/virtualenv/python2.7/lib/python2.7/site-packages/; fi + - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install typogrify ; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then pip install git+https://github.com/dmdm/typogrify.git@py3k#egg=typogrify; fi - pip install mock nose nose-cov Markdown - pip install . script: nosetests -sv --with-coverage --cover-package=pelican pelican diff --git a/pelican/tests/content/article.rst b/pelican/tests/content/article.rst index 7109c29b..793e6869 100644 --- a/pelican/tests/content/article.rst +++ b/pelican/tests/content/article.rst @@ -1,6 +1,6 @@ Article title ############# -This is some content. With some stuff to "typogrify". +THIS is some content. With some stuff to "typogrify"... Now with added support for :abbr:`TLA (three letter acronym)`. diff --git a/pelican/tests/test_readers.py b/pelican/tests/test_readers.py index b6652d03..841e3d34 100644 --- a/pelican/tests/test_readers.py +++ b/pelican/tests/test_readers.py @@ -104,8 +104,8 @@ class RstReaderTest(ReaderTest): # if nothing is specified in the settings, the content should be # unmodified page = self.read_file(path='article.rst') - expected = ('

This is some content. With some stuff to ' - '"typogrify".

\n

Now with added ' + expected = ('

THIS is some content. With some stuff to ' + '"typogrify"...

\n

Now with added ' 'support for ' 'TLA.

\n') @@ -114,10 +114,11 @@ class RstReaderTest(ReaderTest): try: # otherwise, typogrify should be applied page = self.read_file(path='article.rst', TYPOGRIFY=True) - expected = ('

This is some content. With some stuff to ' - '“typogrify”.

\n

Now with added ' - 'support for ' - 'TLA.

\n') + expected = ( + '

THIS is some content. ' + 'With some stuff to "typogrify"…

\n' + '

Now with added support for TLA.

\n') self.assertEqual(page.content, expected) except ImportError: diff --git a/tox.ini b/tox.ini index 8763c963..440216cf 100644 --- a/tox.ini +++ b/tox.ini @@ -22,6 +22,5 @@ deps = mock Markdown BeautifulSoup4 - git+https://github.com/dmdm/smartypants.git#egg=smartypants git+https://github.com/dmdm/typogrify.git@py3k#egg=typogrify lxml From cb82e486369479432624b293aa1176f11c11f074 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 4 Oct 2013 16:23:19 +0200 Subject: [PATCH 0004/1303] None, not False, in *_SAVE_AS docs. Fixes #1106. --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index b6c18fa9..82752436 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -278,7 +278,7 @@ Setting name (default value) What does it do? If you do not want one or more of the default pages to be created (e.g., you are the only author on your site and thus do not need an Authors page), - set the corresponding ``*_SAVE_AS`` setting to ``False`` to prevent the + set the corresponding ``*_SAVE_AS`` setting to ``None`` to prevent the relevant page from being generated. Timezone From 9657071301ffb7029d17a675f9544e7ec458b202 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 6 Oct 2013 15:30:14 +0200 Subject: [PATCH 0005/1303] Python 3.3 got mock --- pelican/tests/test_generators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py index f47ce7d3..e821bb86 100644 --- a/pelican/tests/test_generators.py +++ b/pelican/tests/test_generators.py @@ -3,7 +3,10 @@ from __future__ import unicode_literals import os from codecs import open -from mock import MagicMock +try: + from unittest.mock import MagicMock +except ImportError: + from mock import MagicMock from shutil import rmtree from tempfile import mkdtemp From 67d3ab8883ba072cc10da214db25dceedb0000a1 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 6 Oct 2013 16:15:43 +0200 Subject: [PATCH 0006/1303] assertEquals is deprecated in favor of assertEqual --- pelican/tests/test_contents.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 437d0228..9c894ffc 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -193,17 +193,17 @@ class TestPage(unittest.TestCase): 'link') page = Page(**args) content = page.get_content('http://notmyidea.org') - self.assertEquals(content, ('A simple test, with a ' - 'link')) + self.assertEqual(content, ('A simple test, with a ' + 'link')) # Category args['content'] = ('A simple test, with a ' 'link') page = Page(**args) content = page.get_content('http://notmyidea.org') - self.assertEquals(content, - ('A simple test, with a ' - 'link')) + self.assertEqual(content, + ('A simple test, with a ' + 'link')) def test_intrasite_link(self): # type does not take unicode in PY2 and bytes in PY3, which in @@ -222,7 +222,7 @@ class TestPage(unittest.TestCase): 'link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' 'link' @@ -234,7 +234,7 @@ class TestPage(unittest.TestCase): 'link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' 'link' @@ -247,7 +247,7 @@ class TestPage(unittest.TestCase): '?utm_whatever=234&highlight=word">link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' 'link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' ' Date: Tue, 8 Oct 2013 13:20:56 +0200 Subject: [PATCH 0008/1303] Add Tumblr and Posterous to importer description --- pelican/tools/pelican_import.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 8cc5b083..69e1f1b4 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -98,7 +98,7 @@ def decode_wp_content(content, br=True): def wp2fields(xml): - """Opens a wordpress XML file, and yield pelican fields""" + """Opens a wordpress XML file, and yield Pelican fields""" try: from bs4 import BeautifulSoup except ImportError: @@ -551,8 +551,9 @@ def fields2pelican(fields, out_markup, output_path, def main(): parser = argparse.ArgumentParser( - description="Transform feed, Wordpress or Dotclear files to reST (rst) " - "or Markdown (md) files. Be sure to have pandoc installed.", + description="Transform feed, WordPress, Tumblr, Dotclear, or Posterous " + "files into reST (rst) or Markdown (md) files. Be sure to " + "have pandoc installed.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument(dest='input', help='The input file to read') From 00150f3556b99f68ef8290bd65d1e7865d9a278e Mon Sep 17 00:00:00 2001 From: David Branner Date: Wed, 9 Oct 2013 11:53:11 -0400 Subject: [PATCH 0009/1303] xml => lxml for bs4, in pelican-import.wp2fields() --- pelican/tools/pelican_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 69e1f1b4..54a2be2f 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -109,7 +109,7 @@ def wp2fields(xml): with open(xml, encoding='utf-8') as infile: xmlfile = infile.read() - soup = BeautifulSoup(xmlfile, "xml") + soup = BeautifulSoup(xmlfile, "lxml") items = soup.rss.channel.findAll('item') for item in items: From 6dafe69ac66a9732c4bb5bbcb889bb297e9e4964 Mon Sep 17 00:00:00 2001 From: Torrance Date: Thu, 10 Oct 2013 14:29:42 +1300 Subject: [PATCH 0010/1303] Ensure headers from base.html are included. --- pelican/themes/simple/templates/article.html | 1 + 1 file changed, 1 insertion(+) diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index 5025a5e7..79124725 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% block head %} + {{ super() }} {% for keyword in article.keywords %} {% endfor %} From caa833877dc11362090c97552135668240b0b588 Mon Sep 17 00:00:00 2001 From: Adrien Oliva Date: Fri, 11 Oct 2013 15:52:47 +0200 Subject: [PATCH 0011/1303] Change StandardError to RuntimeError Since built-in exception "StandardError" does not exist in the latest python version (at least in version 3.3), use RuntimeError instead (which exists from python2.6 to python3.4) --- pelican/writers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/writers.py b/pelican/writers.py index da105929..6cf5232d 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -60,7 +60,7 @@ class Writer(object): """ if filename in self._overridden_files: if override: - raise StandardError('File %s is set to be overridden twice' + raise RuntimeError('File %s is set to be overridden twice' % filename) else: logger.info('skipping %s' % filename) @@ -69,7 +69,7 @@ class Writer(object): if override: logger.info('overwriting %s' % filename) else: - raise StandardError('File %s is to be overwritten' % filename) + raise RuntimeError('File %s is to be overwritten' % filename) if override: self._overridden_files.add(filename) self._written_files.add(filename) From 2b5db0321b021e54f8a966c1aa01a1f8f34d9ddd Mon Sep 17 00:00:00 2001 From: Jed Brown Date: Fri, 11 Oct 2013 22:28:43 -0500 Subject: [PATCH 0012/1303] docs/plugins.rst: fix signal name "page_generator_context" The old "pages_generate_context" dates from before pelican-3.2 standardization, but AFAIK, "page_generate_context" was never correct. --- docs/plugins.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 6de01d05..5e311fb6 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -80,7 +80,7 @@ article_generator_finalized article_generator invoked at the e get_generators generators invoked in Pelican.get_generator_classes, can return a Generator, or several generator in a tuple or in a list. -page_generate_context page_generator, metadata +page_generator_context page_generator, metadata page_generator_init page_generator invoked in the PagesGenerator.__init__ page_generator_finalized page_generator invoked at the end of PagesGenerator.generate_context content_object_init content_object invoked at the end of Content.__init__ (see note below) From eb6d4bb0087bcc218795625ee3bfe5a6d230dc75 Mon Sep 17 00:00:00 2001 From: zhouji Date: Tue, 15 Oct 2013 10:37:03 +0800 Subject: [PATCH 0013/1303] Preserve file metadata (esp. timestamps) when copy static files to output folder. --- pelican/generators.py | 2 +- pelican/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index d695c7c8..c55cdc37 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -573,7 +573,7 @@ class StaticGenerator(Generator): source_path = os.path.join(self.path, sc.source_path) save_as = os.path.join(self.output_path, sc.save_as) mkdir_p(os.path.dirname(save_as)) - shutil.copy(source_path, save_as) + shutil.copy2(source_path, save_as) logger.info('copying {} to {}'.format(sc.source_path, sc.save_as)) diff --git a/pelican/utils.py b/pelican/utils.py index f222f63c..4b25ec7f 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -289,7 +289,7 @@ def copy(path, source, destination, destination_path=None): else: shutil.copytree(entry_path, entry_dest) else: - shutil.copy(entry_path, destination) + shutil.copy2(entry_path, destination) if os.path.isdir(source_): @@ -299,7 +299,7 @@ def copy(path, source, destination, destination_path=None): dest_dir = os.path.dirname(destination_) if not os.path.exists(dest_dir): os.makedirs(dest_dir) - shutil.copy(source_, destination_) + shutil.copy2(source_, destination_) logger.info('copying %s to %s' % (source_, destination_)) else: logger.warning('skipped copy %s to %s' % (source_, destination_)) From 04dba17b800b7c67e43706a8a164ebf697bba10f Mon Sep 17 00:00:00 2001 From: zhouji Date: Wed, 16 Oct 2013 17:06:56 +0800 Subject: [PATCH 0014/1303] Fix #1117 Make intra-link support all url-value HTML attributes. --- pelican/contents.py | 58 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index dbc33716..39322e99 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -125,6 +125,52 @@ class Content(object): if 'summary' in metadata: self._summary = metadata['summary'] + # prepare the list of HTML tag attributes which have a URL value. + # refer: http://stackoverflow.com/questions/2725156/complete-list-of-html-tag-attributes-which-have-a-url-value + self._url_attributes = { # each item in this set is a tuple composed by tag_name, attr_name + # HTML4 tags + ('a', 'href'), + ('applet', 'codebase'), + ('area', 'href'), + ('base', 'href'), + ('blockquote', 'cite'), + ('body', 'background'), + ('del', 'cite'), + ('form', 'action'), + ('frame', 'longdesc'), + ('frame', 'src'), + ('head', 'profile'), + ('iframe', 'longdesc'), + ('iframe', 'src'), + ('img', 'longdesc'), + ('img', 'src'), + ('img', 'usemap'), + ('input', 'src'), + ('input', 'usemap'), + ('ins', 'cite'), + ('link', 'href'), + ('object', 'classid'), + ('object', 'codebase'), + ('object', 'data'), + ('object', 'usemap'), + ('q', 'cite'), + ('script', 'src'), + + # HTML5 tags + ('audio', 'src'), + ('button', 'formaction'), + ('command', 'icon'), + ('embed', 'src'), + ('html', 'manifest'), + ('input', 'formaction'), + ('source', 'src'), + ('video', 'poster'), + ('video', 'src'), + } + """:type: set of (tuple of (string, string)""" + attribute_names = set(pair[1] for pair in self._url_attributes) + self._url_attr_pattern = '|'.join(attribute_names) + signals.content_object_init.send(self) def __str__(self): @@ -189,12 +235,12 @@ class Content(object): instrasite_link_regex = self.settings['INTRASITE_LINK_REGEX'] regex = r""" - (?P<\s*[^\>]* # match tag with src and href attr - (?:href|src)\s*=) + (?P<\s*(?P[^\s\>]+)[^\>]* # match tag with all url-value attributes + (?P{1})\s*=) (?P["\']) # require value to be quoted (?P{0}(?P.*?)) # the url value - \2""".format(instrasite_link_regex) + \4""".format(instrasite_link_regex, self._url_attr_pattern) hrefs = re.compile(regex, re.X) def replacer(m): @@ -203,6 +249,12 @@ class Content(object): path = value.path origin = m.group('path') + # verify HTML tag and attribute pair to avoid miss-replacing + tag = m.group('tag') + attr = m.group('attr') + if attr != 'href' and attr != 'src' and (tag, attr) not in self._url_attributes: + return m.group(0) + # XXX Put this in a different location. if what == 'filename': if path.startswith('/'): From e538aa2cdeb4eed2df40bcf0a414c0930ab05e25 Mon Sep 17 00:00:00 2001 From: zhouji Date: Thu, 17 Oct 2013 11:33:34 +0800 Subject: [PATCH 0015/1303] Fine-tune url-value HTML attributes list. --- pelican/contents.py | 58 ++-------------------------------- pelican/tests/test_contents.py | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 55 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 39322e99..059c54a7 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -125,52 +125,6 @@ class Content(object): if 'summary' in metadata: self._summary = metadata['summary'] - # prepare the list of HTML tag attributes which have a URL value. - # refer: http://stackoverflow.com/questions/2725156/complete-list-of-html-tag-attributes-which-have-a-url-value - self._url_attributes = { # each item in this set is a tuple composed by tag_name, attr_name - # HTML4 tags - ('a', 'href'), - ('applet', 'codebase'), - ('area', 'href'), - ('base', 'href'), - ('blockquote', 'cite'), - ('body', 'background'), - ('del', 'cite'), - ('form', 'action'), - ('frame', 'longdesc'), - ('frame', 'src'), - ('head', 'profile'), - ('iframe', 'longdesc'), - ('iframe', 'src'), - ('img', 'longdesc'), - ('img', 'src'), - ('img', 'usemap'), - ('input', 'src'), - ('input', 'usemap'), - ('ins', 'cite'), - ('link', 'href'), - ('object', 'classid'), - ('object', 'codebase'), - ('object', 'data'), - ('object', 'usemap'), - ('q', 'cite'), - ('script', 'src'), - - # HTML5 tags - ('audio', 'src'), - ('button', 'formaction'), - ('command', 'icon'), - ('embed', 'src'), - ('html', 'manifest'), - ('input', 'formaction'), - ('source', 'src'), - ('video', 'poster'), - ('video', 'src'), - } - """:type: set of (tuple of (string, string)""" - attribute_names = set(pair[1] for pair in self._url_attributes) - self._url_attr_pattern = '|'.join(attribute_names) - signals.content_object_init.send(self) def __str__(self): @@ -235,12 +189,12 @@ class Content(object): instrasite_link_regex = self.settings['INTRASITE_LINK_REGEX'] regex = r""" - (?P<\s*(?P[^\s\>]+)[^\>]* # match tag with all url-value attributes - (?P{1})\s*=) + (?P<\s*[^\>]* # match tag with all url-value attributes + (?:href|src|poster|data|cite|formaction|action)\s*=) (?P["\']) # require value to be quoted (?P{0}(?P.*?)) # the url value - \4""".format(instrasite_link_regex, self._url_attr_pattern) + \2""".format(instrasite_link_regex) hrefs = re.compile(regex, re.X) def replacer(m): @@ -249,12 +203,6 @@ class Content(object): path = value.path origin = m.group('path') - # verify HTML tag and attribute pair to avoid miss-replacing - tag = m.group('tag') - attr = m.group('attr') - if attr != 'href' and attr != 'src' and (tag, attr) not in self._url_attributes: - return m.group(0) - # XXX Put this in a different location. if what == 'filename': if path.startswith('/'): diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 9c894ffc..92e61355 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -268,6 +268,61 @@ class TestPage(unittest.TestCase): '?utm_whatever=234&highlight=word#section-2">link' ) + def test_intrasite_link_more(self): + # type does not take unicode in PY2 and bytes in PY3, which in + # combination with unicode literals leads to following insane line: + cls_name = '_DummyAsset' if six.PY3 else b'_DummyAsset' + + args = self.page_kwargs.copy() + args['settings'] = get_settings() + args['source_path'] = 'content' + args['context']['filenames'] = { + 'images/poster.jpg': type(cls_name, (object,), {'url': 'images/poster.jpg'}), + 'assets/video.mp4': type(cls_name, (object,), {'url': 'assets/video.mp4'}), + 'images/graph.svg': type(cls_name, (object,), {'url': 'images/graph.svg'}), + 'reference.rst': type(cls_name, (object,), {'url': 'reference.html'}), + } + + # video.poster + args['content'] = ( + 'There is a video with poster ' + '' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEqual( + content, + 'There is a video with poster ' + '' + ) + + # object.data + args['content'] = ( + 'There is a svg object ' + '' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEqual( + content, + 'There is a svg object ' + '' + ) + + # blockquote.cite + args['content'] = ( + 'There is a blockquote with cite attribute ' + '
blah blah
' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEqual( + content, + 'There is a blockquote with cite attribute ' + '
blah blah
' + ) + class TestArticle(TestPage): def test_template(self): From ae2afa27fc6841a9785f13f14bfd17bebbd1f516 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 19 Oct 2013 17:20:13 +0200 Subject: [PATCH 0016/1303] Clarify FAQ entry re: need to install Markdown Folks keep running into this error, which probably signals a need to change this behavior. After all, it wouldn't be hard for us to detect what's going on and provide a better error message, such as: "It looks like you're trying to process Markdown, but the Markdown library is not currently installed. Please install the Python-Markdown library via 'pip install markdown'." Until we implement something akin to the above, this should serve as a slightly-improved FAQ entry in the interim. --- docs/faq.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index da37af04..80e14d21 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -65,12 +65,13 @@ How do I create my own theme? Please refer to :ref:`theming-pelican`. -I want to use Markdown, but I got an error. -=========================================== +I'm using Markdown and getting ``No valid files found in content`` errors. +========================================================================== -Markdown is not a hard dependency for Pelican, so you will need to explicitly -install it. You can do so by typing the following command, prepending ``sudo`` -if permissions require it:: +Markdown is not a hard dependency for Pelican, so if you have content in +Markdown format, you will need to explicitly install the Markdown library. +You can do so by typing the following command, prepending ``sudo`` if +permissions require it:: pip install markdown From 9331e42ee10c0a3537d93b000c0a41508758d401 Mon Sep 17 00:00:00 2001 From: Jon Chen Date: Thu, 24 Oct 2013 14:36:03 -0400 Subject: [PATCH 0017/1303] use // instead of explicitly defining http for twitter as well update sample output --- pelican/tests/output/custom/a-markdown-powered-article.html | 4 ++-- pelican/tests/output/custom/archives.html | 2 +- pelican/tests/output/custom/article-1.html | 4 ++-- pelican/tests/output/custom/article-2.html | 4 ++-- pelican/tests/output/custom/article-3.html | 4 ++-- pelican/tests/output/custom/author/alexis-metaireau.html | 2 +- pelican/tests/output/custom/author/alexis-metaireau2.html | 2 +- pelican/tests/output/custom/author/alexis-metaireau3.html | 2 +- pelican/tests/output/custom/authors.html | 2 +- pelican/tests/output/custom/categories.html | 2 +- pelican/tests/output/custom/category/bar.html | 2 +- pelican/tests/output/custom/category/cat1.html | 2 +- pelican/tests/output/custom/category/misc.html | 2 +- pelican/tests/output/custom/category/yeah.html | 2 +- pelican/tests/output/custom/drafts/a-draft-article.html | 2 +- pelican/tests/output/custom/filename_metadata-example.html | 4 ++-- pelican/tests/output/custom/index.html | 2 +- pelican/tests/output/custom/index2.html | 2 +- pelican/tests/output/custom/index3.html | 2 +- pelican/tests/output/custom/jinja2_template.html | 2 +- pelican/tests/output/custom/oh-yeah-fr.html | 4 ++-- pelican/tests/output/custom/oh-yeah.html | 4 ++-- pelican/tests/output/custom/override/index.html | 2 +- .../tests/output/custom/pages/this-is-a-test-hidden-page.html | 2 +- pelican/tests/output/custom/pages/this-is-a-test-page.html | 2 +- pelican/tests/output/custom/second-article-fr.html | 4 ++-- pelican/tests/output/custom/second-article.html | 4 ++-- pelican/tests/output/custom/tag/bar.html | 2 +- pelican/tests/output/custom/tag/baz.html | 4 ++-- pelican/tests/output/custom/tag/foo.html | 2 +- pelican/tests/output/custom/tag/foobar.html | 2 +- pelican/tests/output/custom/tag/oh.html | 2 +- pelican/tests/output/custom/tag/yeah.html | 2 +- pelican/tests/output/custom/tags.html | 2 +- pelican/tests/output/custom/this-is-a-super-article.html | 4 ++-- pelican/tests/output/custom/unbelievable.html | 4 ++-- pelican/themes/notmyidea/templates/article.html | 2 +- pelican/themes/notmyidea/templates/disqus_script.html | 2 +- pelican/themes/notmyidea/templates/twitter.html | 4 ++-- 39 files changed, 52 insertions(+), 52 deletions(-) diff --git a/pelican/tests/output/custom/a-markdown-powered-article.html b/pelican/tests/output/custom/a-markdown-powered-article.html index 4d1fe16f..515b0298 100644 --- a/pelican/tests/output/custom/a-markdown-powered-article.html +++ b/pelican/tests/output/custom/a-markdown-powered-article.html @@ -59,7 +59,7 @@ var disqus_url = "./a-markdown-powered-article.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -105,7 +105,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/archives.html b/pelican/tests/output/custom/archives.html index a2ab7430..13c3d980 100644 --- a/pelican/tests/output/custom/archives.html +++ b/pelican/tests/output/custom/archives.html @@ -92,7 +92,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/article-1.html b/pelican/tests/output/custom/article-1.html index 89e12914..6faed3be 100644 --- a/pelican/tests/output/custom/article-1.html +++ b/pelican/tests/output/custom/article-1.html @@ -58,7 +58,7 @@ var disqus_url = "./article-1.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -104,7 +104,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/article-2.html b/pelican/tests/output/custom/article-2.html index 1113e5e8..d1e89db8 100644 --- a/pelican/tests/output/custom/article-2.html +++ b/pelican/tests/output/custom/article-2.html @@ -58,7 +58,7 @@ var disqus_url = "./article-2.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -104,7 +104,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/article-3.html b/pelican/tests/output/custom/article-3.html index c7306605..5c287a13 100644 --- a/pelican/tests/output/custom/article-3.html +++ b/pelican/tests/output/custom/article-3.html @@ -58,7 +58,7 @@ var disqus_url = "./article-3.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -104,7 +104,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/author/alexis-metaireau.html b/pelican/tests/output/custom/author/alexis-metaireau.html index d2350bd5..19c254a0 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau.html +++ b/pelican/tests/output/custom/author/alexis-metaireau.html @@ -165,7 +165,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/author/alexis-metaireau2.html b/pelican/tests/output/custom/author/alexis-metaireau2.html index 91ef0696..772d2939 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau2.html +++ b/pelican/tests/output/custom/author/alexis-metaireau2.html @@ -175,7 +175,7 @@ YEAH !

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/author/alexis-metaireau3.html b/pelican/tests/output/custom/author/alexis-metaireau3.html index 77c9cdfe..f3d985c3 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau3.html +++ b/pelican/tests/output/custom/author/alexis-metaireau3.html @@ -130,7 +130,7 @@ pelican.conf, it ...

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/authors.html b/pelican/tests/output/custom/authors.html index adb3d992..eb2becfd 100644 --- a/pelican/tests/output/custom/authors.html +++ b/pelican/tests/output/custom/authors.html @@ -71,7 +71,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/categories.html b/pelican/tests/output/custom/categories.html index 5d839648..17d9de76 100644 --- a/pelican/tests/output/custom/categories.html +++ b/pelican/tests/output/custom/categories.html @@ -72,7 +72,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/category/bar.html b/pelican/tests/output/custom/category/bar.html index 3f1bbc4a..30545518 100644 --- a/pelican/tests/output/custom/category/bar.html +++ b/pelican/tests/output/custom/category/bar.html @@ -95,7 +95,7 @@ YEAH !

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/category/cat1.html b/pelican/tests/output/custom/category/cat1.html index 81718322..9a737b76 100644 --- a/pelican/tests/output/custom/category/cat1.html +++ b/pelican/tests/output/custom/category/cat1.html @@ -162,7 +162,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/category/misc.html b/pelican/tests/output/custom/category/misc.html index 36479803..b70afcdf 100644 --- a/pelican/tests/output/custom/category/misc.html +++ b/pelican/tests/output/custom/category/misc.html @@ -173,7 +173,7 @@ pelican.conf, it ...

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/category/yeah.html b/pelican/tests/output/custom/category/yeah.html index 53666b0b..02d07413 100644 --- a/pelican/tests/output/custom/category/yeah.html +++ b/pelican/tests/output/custom/category/yeah.html @@ -99,7 +99,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/drafts/a-draft-article.html b/pelican/tests/output/custom/drafts/a-draft-article.html index b8306208..440780a3 100644 --- a/pelican/tests/output/custom/drafts/a-draft-article.html +++ b/pelican/tests/output/custom/drafts/a-draft-article.html @@ -92,7 +92,7 @@ listed anywhere else.

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/filename_metadata-example.html b/pelican/tests/output/custom/filename_metadata-example.html index fcbda9c2..1252aba8 100644 --- a/pelican/tests/output/custom/filename_metadata-example.html +++ b/pelican/tests/output/custom/filename_metadata-example.html @@ -58,7 +58,7 @@ var disqus_url = "./filename_metadata-example.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -104,7 +104,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/index.html b/pelican/tests/output/custom/index.html index 3fa1d5c3..c7174715 100644 --- a/pelican/tests/output/custom/index.html +++ b/pelican/tests/output/custom/index.html @@ -165,7 +165,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/index2.html b/pelican/tests/output/custom/index2.html index 8769d098..b349b3ca 100644 --- a/pelican/tests/output/custom/index2.html +++ b/pelican/tests/output/custom/index2.html @@ -175,7 +175,7 @@ YEAH !

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/index3.html b/pelican/tests/output/custom/index3.html index b4d9ffc6..c668dba6 100644 --- a/pelican/tests/output/custom/index3.html +++ b/pelican/tests/output/custom/index3.html @@ -130,7 +130,7 @@ pelican.conf, it ...

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/jinja2_template.html b/pelican/tests/output/custom/jinja2_template.html index 31beac32..0eafa913 100644 --- a/pelican/tests/output/custom/jinja2_template.html +++ b/pelican/tests/output/custom/jinja2_template.html @@ -69,7 +69,7 @@ Some text (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/oh-yeah-fr.html b/pelican/tests/output/custom/oh-yeah-fr.html index 410c721f..4450514a 100644 --- a/pelican/tests/output/custom/oh-yeah-fr.html +++ b/pelican/tests/output/custom/oh-yeah-fr.html @@ -60,7 +60,7 @@ Translations: var disqus_url = "./oh-yeah-fr.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -106,7 +106,7 @@ Translations: (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/oh-yeah.html b/pelican/tests/output/custom/oh-yeah.html index dab28171..95cf0317 100644 --- a/pelican/tests/output/custom/oh-yeah.html +++ b/pelican/tests/output/custom/oh-yeah.html @@ -65,7 +65,7 @@ YEAH !

var disqus_url = "./oh-yeah.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -111,7 +111,7 @@ YEAH !

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/override/index.html b/pelican/tests/output/custom/override/index.html index 9c48d76f..e84d79fe 100644 --- a/pelican/tests/output/custom/override/index.html +++ b/pelican/tests/output/custom/override/index.html @@ -73,7 +73,7 @@ at a custom location.

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html b/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html index a061b7ee..dced8107 100644 --- a/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html +++ b/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html @@ -73,7 +73,7 @@ Anyone can see this page but it's not linked to anywhere!

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/pages/this-is-a-test-page.html b/pelican/tests/output/custom/pages/this-is-a-test-page.html index af50adf8..46ea4fef 100644 --- a/pelican/tests/output/custom/pages/this-is-a-test-page.html +++ b/pelican/tests/output/custom/pages/this-is-a-test-page.html @@ -73,7 +73,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/second-article-fr.html b/pelican/tests/output/custom/second-article-fr.html index cbeef437..b4a04ee8 100644 --- a/pelican/tests/output/custom/second-article-fr.html +++ b/pelican/tests/output/custom/second-article-fr.html @@ -60,7 +60,7 @@ var disqus_url = "./second-article-fr.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -106,7 +106,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/second-article.html b/pelican/tests/output/custom/second-article.html index 57009066..04f038c8 100644 --- a/pelican/tests/output/custom/second-article.html +++ b/pelican/tests/output/custom/second-article.html @@ -60,7 +60,7 @@ var disqus_url = "./second-article.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -106,7 +106,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/tag/bar.html b/pelican/tests/output/custom/tag/bar.html index 9560b712..7a90eff2 100644 --- a/pelican/tests/output/custom/tag/bar.html +++ b/pelican/tests/output/custom/tag/bar.html @@ -148,7 +148,7 @@ YEAH !

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/tag/baz.html b/pelican/tests/output/custom/tag/baz.html index c6ebe542..f794b351 100644 --- a/pelican/tests/output/custom/tag/baz.html +++ b/pelican/tests/output/custom/tag/baz.html @@ -58,7 +58,7 @@ var disqus_url = "../tag/baz.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -104,7 +104,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/tag/foo.html b/pelican/tests/output/custom/tag/foo.html index d5b0d413..d99df63b 100644 --- a/pelican/tests/output/custom/tag/foo.html +++ b/pelican/tests/output/custom/tag/foo.html @@ -118,7 +118,7 @@ as well as inline markup.

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/tag/foobar.html b/pelican/tests/output/custom/tag/foobar.html index 0b4d2471..ded91f12 100644 --- a/pelican/tests/output/custom/tag/foobar.html +++ b/pelican/tests/output/custom/tag/foobar.html @@ -99,7 +99,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/tag/oh.html b/pelican/tests/output/custom/tag/oh.html index 3b30a39c..21c8e352 100644 --- a/pelican/tests/output/custom/tag/oh.html +++ b/pelican/tests/output/custom/tag/oh.html @@ -72,7 +72,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/tag/yeah.html b/pelican/tests/output/custom/tag/yeah.html index a6764575..523358b5 100644 --- a/pelican/tests/output/custom/tag/yeah.html +++ b/pelican/tests/output/custom/tag/yeah.html @@ -95,7 +95,7 @@ YEAH !

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/tags.html b/pelican/tests/output/custom/tags.html index bc9b9d20..2e70c9e8 100644 --- a/pelican/tests/output/custom/tags.html +++ b/pelican/tests/output/custom/tags.html @@ -76,7 +76,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/this-is-a-super-article.html b/pelican/tests/output/custom/this-is-a-super-article.html index 0a580e25..d251b0ec 100644 --- a/pelican/tests/output/custom/this-is-a-super-article.html +++ b/pelican/tests/output/custom/this-is-a-super-article.html @@ -69,7 +69,7 @@ var disqus_url = "./this-is-a-super-article.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -115,7 +115,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/tests/output/custom/unbelievable.html b/pelican/tests/output/custom/unbelievable.html index 03b533bb..0d87bbf6 100644 --- a/pelican/tests/output/custom/unbelievable.html +++ b/pelican/tests/output/custom/unbelievable.html @@ -90,7 +90,7 @@ pelican.conf, it will have nothing in default.

var disqus_url = "./unbelievable.html"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://blog-notmyidea.disqus.com/embed.js'; + dsq.src = '//blog-notmyidea.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); @@ -136,7 +136,7 @@ pelican.conf, it will have nothing in default.

(function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/themes/notmyidea/templates/article.html b/pelican/themes/notmyidea/templates/article.html index 516fd3b5..367222b2 100644 --- a/pelican/themes/notmyidea/templates/article.html +++ b/pelican/themes/notmyidea/templates/article.html @@ -23,7 +23,7 @@ var disqus_url = "{{ SITEURL }}/{{ article.url }}"; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = 'http://{{ DISQUS_SITENAME }}.disqus.com/embed.js'; + dsq.src = '//{{ DISQUS_SITENAME }}.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); diff --git a/pelican/themes/notmyidea/templates/disqus_script.html b/pelican/themes/notmyidea/templates/disqus_script.html index c4f442c8..4ee419bb 100644 --- a/pelican/themes/notmyidea/templates/disqus_script.html +++ b/pelican/themes/notmyidea/templates/disqus_script.html @@ -4,7 +4,7 @@ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; - s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); diff --git a/pelican/themes/notmyidea/templates/twitter.html b/pelican/themes/notmyidea/templates/twitter.html index c6b159f4..7247a0c6 100644 --- a/pelican/themes/notmyidea/templates/twitter.html +++ b/pelican/themes/notmyidea/templates/twitter.html @@ -1,3 +1,3 @@ {% if TWITTER_USERNAME %} - -{% endif %} \ No newline at end of file + +{% endif %} From 6c808e426fe5287b49fdd6a56067aa90eaaba963 Mon Sep 17 00:00:00 2001 From: Kevin Deldycke Date: Mon, 21 Oct 2013 23:38:25 +0200 Subject: [PATCH 0018/1303] Document video support in Markdown and reST. --- THANKS | 1 + docs/tips.rst | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/THANKS b/THANKS index e4eed231..1d867471 100644 --- a/THANKS +++ b/THANKS @@ -88,6 +88,7 @@ Joseph Reagle Joshua Adelman Julian Berman Justin Mayer +Kevin Deldycke Kyle Fuller Laureline Guerin Leonard Huang diff --git a/docs/tips.rst b/docs/tips.rst index 7629481f..b140ea3c 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -94,3 +94,8 @@ directly into your source content. Alternatively, you can also use Pelican plugins like ``liquid_tags``, ``pelican_youtube``, or ``pelican_vimeo`` to embed videos in your content. + +Moreover, markup languages like reST and Markdown have plugins that let you +embed videos in the markup. You can use `reST video directive +`_ for reST or `mdx_video plugin +`_ for Markdown. From 5e5510cfcf65b873881d9e08adcb54ac1db9c730 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sun, 27 Oct 2013 09:27:30 -0700 Subject: [PATCH 0019/1303] Improve Disqus embed code in notmyidea theme According to Disqus, the disqus_shortname variable is a required field. Also added a