summaryrefslogtreecommitdiff
path: root/doc/_extensions/odoo/switcher.py
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2016-10-11 12:06:39 +0200
committerMartin Trigaux <mat@odoo.com>2016-10-11 12:09:28 +0200
commit731fe1c9abbcd3df0cf27053daaf3e7ca3d08ba3 (patch)
treeea956bbfd1e21d82cce8faa9406b71945546d4b8 /doc/_extensions/odoo/switcher.py
parent95280245367da42fead8be9892079a5795171fd0 (diff)
[FIX] doc: avoid conflict on extenstion and odoo folder
Diffstat (limited to 'doc/_extensions/odoo/switcher.py')
-rw-r--r--doc/_extensions/odoo/switcher.py44
1 files changed, 0 insertions, 44 deletions
diff --git a/doc/_extensions/odoo/switcher.py b/doc/_extensions/odoo/switcher.py
deleted file mode 100644
index 51fb604929c..00000000000
--- a/doc/_extensions/odoo/switcher.py
+++ /dev/null
@@ -1,44 +0,0 @@
-from docutils import nodes, utils
-from docutils.parsers.rst import Directive
-
-from pygments.lexers import get_lexer_by_name
-
-def setup(app):
- app.add_directive('switcher', SwitcherDirective)
- app.add_directive('case', CaseDirective)
-
-class SwitcherDirective(Directive):
- has_content = True
-
- def run(self):
- self.assert_has_content()
-
- body = nodes.compound('\n'.join(self.content), classes=['tabs'])
- self.state.nested_parse(self.content, self.content_offset, body)
-
- titles = []
- for child in body.children:
- if isinstance(child, nodes.literal_block):
- titles.append(get_lexer_by_name(child['language']).name)
- else:
- assert child['names'], ("A switcher case must be either a "\
- "code block or a compound with a name")
- titles.append(' '.join(child['names']))
- tabs = nodes.bullet_list('', *[
- nodes.list_item('', nodes.Text(title))
- for title in titles
- ])
- node = nodes.compound('', tabs, body, classes=['content-switcher'])
- return [node]
-
-class CaseDirective(Directive):
- required_arguments = 1
- final_argument_whitespace = True
- has_content = True
-
- def run(self):
- self.assert_has_content()
-
- node = nodes.compound('\n'.join(self.content), names=[self.arguments[0]])
- self.state.nested_parse(self.content, self.content_offset, node)
- return [node]