Skip to content
Permalink
Browse files

Some fixes for getnikola/nikola#1976

  • Loading branch information
ralsina committed Sep 2, 2015
1 parent 49a1760 commit 60a4ea745cfaf9079b7589f3267efc2f12edc60f
Showing with 27 additions and 10 deletions.
  1. +1 −1 v7/import_feed/README.md
  2. +2 −2 v7/import_feed/import_feed.plugin
  3. +24 −7 v7/import_feed/import_feed.py
@@ -4,6 +4,6 @@ To use it:

```
$ nikola plugin -i import_feed
$ nikola import_feed feed_url
$ nikola import_feed --url=feed_url
```

@@ -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

@@ -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 @@ def _execute(self, options, args):
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 @@ def import_item(self, item, out_folder=None):
# 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', []):

0 comments on commit 60a4ea7

Please sign in to comment.
You can’t perform that action at this time.