reorg coil gen posts + new theme

This commit is contained in:
Don Harper 2015-09-23 22:26:49 -05:00
parent 650f7ceb04
commit ad3bcc971e
79 changed files with 14597 additions and 25 deletions

View file

@ -4,6 +4,6 @@ To use it:
```
$ nikola plugin -i import_feed
$ nikola import_feed feed_url
$ nikola import_feed --url=feed_url
```

View file

@ -4,7 +4,7 @@ Module = import_feed
[Documentation]
Author = Grzegorz Śliwiński
Version = 0.1
Version = 0.2
Website = http://www.fizyk.net.pl/
Description = Import a blog posts from a RSS/Atom dump
Description = Import a blog posts from a RSS/Atom feed

View file

@ -53,9 +53,24 @@ class CommandImportFeed(Command, ImportMixin):
name = "import_feed"
needs_config = False
doc_usage = "[options] feed_file"
doc_purpose = "import a RSS/Atom dump"
cmd_options = ImportMixin.cmd_options
doc_usage = "[options] --url=feed_url"
doc_purpose = "import a RSS/Atom feed"
cmd_options = [
{
'name': 'output_folder',
'long': 'output-folder',
'short': 'o',
'default': 'new_site',
'help': 'Location to write imported content.'
},
{
'name': 'url',
'long': 'url',
'short': 'u',
'default': None,
'help': 'URL or filename of the feed to be imported.'
},
]
def _execute(self, options, args):
'''
@ -65,16 +80,15 @@ class CommandImportFeed(Command, ImportMixin):
req_missing(['feedparser'], 'import feeds')
return
if not args:
if not options['url']:
print(self.help())
return
options['filename'] = args[0]
self.feed_export_file = options['filename']
self.feed_url = options['url']
self.output_folder = options['output_folder']
self.import_into_existing_site = False
self.url_map = {}
channel = self.get_channel_from_file(self.feed_export_file)
channel = self.get_channel_from_file(self.feed_url)
self.context = self.populate_context(channel)
conf_template = self.generate_base_site()
self.context['REDIRECTIONS'] = self.configure_redirections(
@ -160,6 +174,9 @@ class CommandImportFeed(Command, ImportMixin):
# FIXME: handle attachments
elif item.get('summary'):
content = item.get('summary')
else:
content = ''
LOGGER.warn('Entry without content! {}', item)
tags = []
for tag in item.get('tags', []):

View file

@ -3,7 +3,7 @@ Name = sass
Module = sass
[Documentation]
Author = Roberto Alsina, Chris "Kwpolska" Warrick
Author = Roberto Alsina, Chris Warrick
Version = 0.1
Website = http://plugins.getnikola.com/#sass
Description = Build CSS out of Sass sources

View file

@ -7,6 +7,6 @@ MinVersion = 7.4.0
[Documentation]
Author = Chris Warrick
Version = 0.1.2
Version = 0.1.3
Website = http://plugins.getnikola.com/#upgrade_metadata
Description = Upgrade old-style metadata

View file

@ -70,22 +70,23 @@ class UpgradeMetadata(Command):
yesno = utils.ask_yesno("Proceed with metadata upgrade?")
if options['yes'] or yesno:
for post in flagged:
for lang in post.translated_to:
for lang in self.site.config['TRANSLATIONS'].keys():
if lang == post.default_lang:
fname = post.metadata_path
else:
meta_path = os.path.splitext(post.source_path)[0] + '.meta'
fname = utils.get_translation_candidate(post.config, meta_path, lang)
with io.open(fname, 'r', encoding='utf-8') as fh:
meta = fh.readlines()
if os.path.exists(fname):
with io.open(fname, 'r', encoding='utf-8') as fh:
meta = fh.readlines()
if not meta[1].startswith('.. '):
# check if were dealing with old style metadata
with io.open(fname, 'w', encoding='utf-8') as fh:
for k, v in zip(self.fields, meta):
fh.write('.. {0}: {1}'.format(k, v))
L.debug(fname)
if not meta[min(1, len(meta) - 1)].startswith('.. '):
# check if were dealing with old style metadata
with io.open(fname, 'w', encoding='utf-8') as fh:
for k, v in zip(self.fields, meta):
fh.write('.. {0}: {1}'.format(k, v))
L.debug(fname)
L.info('{0} posts upgraded.'.format(len(flagged)))
else: