diff options
| author | 2015-08-26 07:57:04 -0300 | |
|---|---|---|
| committer | 2015-08-26 07:57:04 -0300 | |
| commit | 8041475aab2b8efad7d2857027331bd626d26312 (patch) | |
| tree | 3980e1763c067079a4cebb425d642ca9eac834bf /nikola/plugins/compile/rest/soundcloud.py | |
| parent | b0b24795b24ee6809397fbbadf42f31f310a219f (diff) | |
Imported Upstream version 7.6.4
Diffstat (limited to 'nikola/plugins/compile/rest/soundcloud.py')
| -rw-r--r-- | nikola/plugins/compile/rest/soundcloud.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/nikola/plugins/compile/rest/soundcloud.py b/nikola/plugins/compile/rest/soundcloud.py index a26806c..30134a9 100644 --- a/nikola/plugins/compile/rest/soundcloud.py +++ b/nikola/plugins/compile/rest/soundcloud.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +"""SoundCloud directive for reStructuredText.""" from docutils import nodes from docutils.parsers.rst import Directive, directives @@ -10,9 +11,12 @@ from nikola.plugin_categories import RestExtension class Plugin(RestExtension): + """Plugin for soundclound directive.""" + name = "rest_soundcloud" def set_site(self, site): + """Set Nikola site.""" self.site = site directives.register_directive('soundcloud', SoundCloud) directives.register_directive('soundcloud_playlist', SoundCloudPlaylist) @@ -27,7 +31,8 @@ src="https://w.soundcloud.com/player/?url=http://api.soundcloud.com/{preslug}/"" class SoundCloud(Directive): - """ Restructured text extension for inserting SoundCloud embedded music + + """reST extension for inserting SoundCloud embedded music. Usage: .. soundcloud:: <sound id> @@ -35,6 +40,7 @@ class SoundCloud(Directive): :width: 600 """ + has_content = True required_arguments = 1 option_spec = { @@ -44,7 +50,7 @@ class SoundCloud(Directive): preslug = "tracks" def run(self): - """ Required by the Directive interface. Create docutils nodes """ + """Run the soundcloud directive.""" self.check_content() options = { 'sid': self.arguments[0], @@ -56,12 +62,15 @@ class SoundCloud(Directive): return [nodes.raw('', CODE.format(**options), format='html')] def check_content(self): - """ Emit a deprecation warning if there is content """ - if self.content: + """Emit a deprecation warning if there is content.""" + if self.content: # pragma: no cover raise self.warning("This directive does not accept content. The " "'key=value' format for options is deprecated, " "use ':key: value' instead") class SoundCloudPlaylist(SoundCloud): + + """reST directive for SoundCloud playlists.""" + preslug = "playlists" |
