Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Plugin modules go here.
19 changes: 19 additions & 0 deletions web/plugins/accordion_directive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
http://www.tutorialspoint.com/bootstrap/bootstrap_collapse_plugin.htm

# Usage

```
.. accordion::
:id: acordeon

.. collapse:: IDE (Entorno Integrado de Desarrollo)

Un IDE es un programa que te permite gestionar los archivos Python
de tus proyectos y también *te ayuda* coloreando la sintaxis,
dándote sugerencias de autocompletado con las funciones disponibles
y un sin fin de herramientas más.

* `Spyder <https://github.com/spyder-ide/spyder>`_
* `Ninja-IDE <http://ninja-ide.org/>`_

```
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[Core]
Name = collapse_directive
Module = collapse_directive
Name = accordion
Module = accordion

[Nikola]
MinVersion = 7.4.0

[Documentation]
Author = Manuel Kaufmann
Author = Manuel Kaufmann & Leandro E. Colombo Viña
Version = 0.1
Website = http://plugins.getnikola.com/#collapse_directive
Description = Useful to create collapsible groups or accordion
80 changes: 80 additions & 0 deletions web/plugins/accordion_directive/accordion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-

# Copyright © 2015 Manuel Kaufmann & Leandro E. Colombo Viña

# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the
# Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice
# shall be included in all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import uuid

from docutils import nodes
from docutils.parsers.rst import Directive, directives

from nikola.plugin_categories import RestExtension

"""Accordion and Collapse group directive for reStructuredText"""


class Plugin(RestExtension):
"""Plugin for accordion and collapse reST directive"""

name = "accordion"

def set_site(self, site):
"""Set Nikola site."""
self.site = site
directives.register_directive('accordion', Accordion)
return super(Plugin, self).set_site(site)


class Accordion(Directive):
""" reStructuredText extension for inserting collapsible groups or accordion."""

required_arguments = 0
optional_arguments = 9999
final_argument_whitespace = False
option_spec = {
'class': directives.class_option,
'id': directives.unchanged,
'role': directives.unchanged,
'aria-multiselectable': directives.unchanged,
}

has_content = True

def run(self):
self.assert_has_content()
text = '\n'.join(self.content)
options = {
'class': self.arguments[0] if self.arguments else 'panel-group',
'id': 'accordion',
'role': 'tablist',
'aria-multiselectable': 'true'
}
options.update(self.options)

node = nodes.container(text)
node['classes'] = directives.class_option(options['class'])
self.add_name(node)
self.state.nested_parse(self.content, self.content_offset, node)

return [node]
23 changes: 9 additions & 14 deletions web/plugins/collapse_directive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@ http://www.tutorialspoint.com/bootstrap/bootstrap_collapse_plugin.htm
# Usage

```
.. raw:: html
.. accordion::
:id: acordeon

<div class="panel-group" id="accordion">
.. collapse:: IDE (Entorno Integrado de Desarrollo)

.. collapse:: IDE (Entorno Integrado de Desarrollo)
Un IDE es un programa que te permite gestionar los archivos Python
de tus proyectos y también *te ayuda* coloreando la sintaxis,
dándote sugerencias de autocompletado con las funciones disponibles
y un sin fin de herramientas más.

Un IDE es un programa que te permite gestionar los archivos Python
de tus proyectos y también *te ayuda* coloreando la sintaxis,
dándote sugerencias de autocompletado con las funciones disponibles
y un sin fin de herramientas más.

* `Spyder <https://github.com/spyder-ide/spyder>`_
* `Ninja-IDE <http://ninja-ide.org/>`_

.. raw:: html

</div>
* `Spyder <https://github.com/spyder-ide/spyder>`_
* `Ninja-IDE <http://ninja-ide.org/>`_

```
12 changes: 12 additions & 0 deletions web/plugins/collapse_directive/collapse.plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Core]
Name = collapse
Module = collapse

[Nikola]
MinVersion = 7.4.0

[Documentation]
Author = Manuel Kaufmann & Leandro E. Colombo Viña
Version = 0.2
Website = http://plugins.getnikola.com/#collapse_directive
Description = Useful to create collapsible groups or accordion
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright © 2015 Manuel Kaufmann
# Copyright © 2015 Manuel Kaufmann & Leandro E. Colombo Viña

# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
Expand All @@ -24,26 +24,29 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import unicode_literals

from docutils import nodes
from docutils.parsers.rst import Directive, directives

from nikola.plugin_categories import RestExtension

"""Accordion and Collapse group directive for reStructuredText"""


class Plugin(RestExtension):
"""Plugin for accordion and collapse reST directive"""

name = "collapse_directive"
name = "collapse"

def set_site(self, site):
"""Set Nikola site."""
self.site = site
Collapse.site = site
directives.register_directive('collapse', Collapse)
return super(Plugin, self).set_site(site)


class Collapse(Directive):
""" Restructured text extension for inserting collapsible groups or accordion."""
""" reStructuredText extension for inserting collapsible groups or accordion."""

# TODO: http://www.tutorialspoint.com/bootstrap/bootstrap_collapse_plugin.htm
option_spec = {
Expand All @@ -62,7 +65,8 @@ def _sanitize_options(self):

def run(self):
if len(self.content) == 0:
return
msg = 'collapse directive with no content'
return [nodes.raw('', '<div class="text-error">{0}</div>'.format(msg), format='html')]

# from nikola.plugins.compile.rest import rst2html
# content = rst2html('\n'.join(self.content))
Expand All @@ -84,4 +88,4 @@ def run(self):
return [nodes.raw('', output, format='html')]


directives.register_directive('collapse', Collapse)
#directives.register_directive('collapse', Collapse)