has_content = False
optional_arguments = 1
option_spec = {
- 'language': directives.unchanged
+ 'language': directives.unchanged
}
def run(self):
'.. toggle-header::',
' :header: View {}'.format(filename),
'',
- ' `Download {} <https://framagit.org/simgrid/simgrid/tree/{}>`_'.format(os.path.basename(filename), filename),
+ ' `Download {} <https://framagit.org/simgrid/simgrid/tree/master/{}>`_'.format(os.path.basename(filename), filename),
'',
' .. literalinclude:: ../../{}'.format(filename),
' :language: {}'.format(language),
if filename[-3:] == '.py':
language = 'Python'
langcode = 'py'
+ elif filename[-2:] == '.c':
+ language = 'C'
+ langcode = 'c'
elif filename[-4:] == '.cpp':
language = 'C++'
langcode = 'cpp'
language = 'XML'
langcode = 'xml'
else:
- raise Exception("Unknown language '{}'. Please choose '.cpp', '.py' or '.xml'".format(language))
+ raise Exception("Unknown language '{}'. Please choose '.cpp', '.py', '.c' or '.xml'".format(language))
for idx, line in enumerate(self.content.data):
self.content.data[idx] = ' ' + line
class ToggleDirective(Directive):
has_content = True
- option_spec = {'header': directives.unchanged}
+ option_spec = {
+ 'header': directives.unchanged,
+ 'show': directives.flag
+ }
optional_arguments = 1
def run(self):
node = nodes.container()
node['classes'].append('toggle-content')
+ if "show" not in self.options:
+ # This :show: thing is not working, and I fail to see why.
+ # Only the hidden-content class gets a call to hide() in the Javascript,
+ # and :show:n block# still get hidden when I load the page.
+ # No idea what's going on (Mt)
+ node['classes'].append('hidden-content')
par = nodes.container()
par['classes'].append('toggle-header')
return [par, node]
def add_assets(app):
- app.add_stylesheet(CSS_FILE)
- app.add_javascript(JS_FILE)
+ app.add_css_file(CSS_FILE)
+ app.add_js_file(JS_FILE)
def copy_assets(app, exception):
app.connect('builder-inited', add_assets)
app.connect('build-finished', copy_assets)
-