Class: JekyllImport::Importers::Medium
- Inherits:
-
JekyllImport::Importer
- Object
- JekyllImport::Importer
- JekyllImport::Importers::Medium
- Defined in:
- lib/jekyll-import/importers/medium.rb
Class Method Summary collapse
-
.process(options) ⇒ Object
Medium posts and associated metadata are exported as an RSS Feed.
- .require_deps ⇒ Object
- .specify_options(c) ⇒ Object
- .validate(options) ⇒ Object
Methods inherited from JekyllImport::Importer
inherited, run, stringify_keys, subclasses
Class Method Details
.process(options) ⇒ Object
Medium posts and associated metadata are exported as an RSS Feed. Hence invoke our RSS Importer to create the Jekyll source directory.
“Tags” attached to a Medium post are exported under the markup ‘<item><category>…</category></item>` in the export feed. Therefore, configure the RSS Importer to always look for tags in the `<category></category>` field of an RSS item.
26 27 28 29 30 31 32 33 |
# File 'lib/jekyll-import/importers/medium.rb', line 26 def self.process() Importers::RSS.process({ "source" => "https://medium.com/feed/@#{.fetch("username")}", "render_audio" => .fetch("render_audio", false), "canonical_link" => .fetch("canonical_link", false), "extract_tags" => "category", }) end |
.require_deps ⇒ Object
16 17 18 |
# File 'lib/jekyll-import/importers/medium.rb', line 16 def self.require_deps Importers::RSS.require_deps end |
.specify_options(c) ⇒ Object
6 7 8 9 10 |
# File 'lib/jekyll-import/importers/medium.rb', line 6 def self.(c) c.option "username", "--username NAME", "Medium username" c.option "canonical_link", "--canonical_link", "Copy original link as canonical_url to post (default: false)" c.option "render_audio", "--render_audio", "Render <audio> element in posts for the enclosure URLs (default: false)" end |
.validate(options) ⇒ Object
12 13 14 |
# File 'lib/jekyll-import/importers/medium.rb', line 12 def self.validate() abort "Missing mandatory option --username." if ["username"].nil? end |