File: sympylive.py

package info (click to toggle)
sympy 1.7.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 37,052 kB
  • sloc: python: 426,614; xml: 359; sh: 318; makefile: 138; lisp: 4
file content (36 lines) | stat: -rw-r--r-- 1,428 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
    sympylive
    ~~~~~~~~~

    Allow `SymPy Live <https://live.sympy.org/>`_ to be used for interactive
    evaluation of SymPy's code examples.

    :copyright: Copyright 2014 by the SymPy Development Team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""


def builder_inited(app):
    if not app.config.sympylive_url:
        raise ExtensionError('sympylive_url config value must be set'
                             ' for the sympylive extension to work')

    app.add_js_file(app.config.sympylive_url + '/static/utilities.js')
    app.add_js_file(app.config.sympylive_url + '/static/external/classy.js')

    app.add_css_file(app.config.sympylive_url + '/static/live-core.css')
    app.add_css_file(app.config.sympylive_url +
                     '/static/live-autocomplete.css')
    app.add_css_file(app.config.sympylive_url + '/static/live-sphinx.css')

    app.add_js_file(app.config.sympylive_url + '/static/live-core.js')
    app.add_js_file(app.config.sympylive_url + '/static/live-autocomplete.js')
    app.add_js_file(app.config.sympylive_url + '/static/live-sphinx.js')


def setup(app):
    #app.add_config_value('sympylive_url', 'https://live.sympy.org', False)
    # disable completely this feature since it implies a breach in privacy
    # which does not comply with DFSG
    app.add_config_value('sympylive_url', 'http://localhost', False)
    app.connect('builder-inited', builder_inited)