Explorar o código

add ability to specify static directory

Jake Vanderplas %!s(int64=12) %!d(string=hai) anos
pai
achega
d091f2780b
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 2 1
      liquid_tags/include_code.py
  2. 0 1
      liquid_tags/notebook.py

+ 2 - 1
liquid_tags/include_code.py

@@ -69,7 +69,8 @@ def include_code(preprocessor, tag, markup):
     else:
         title = os.path.basename(src)
 
-    url = '/{0}/{1}/{2}'.format('static', code_dir, src)
+    static_dir = settings.get('STATIC_OUT_DIR', 'static')
+    url = '/{0}/{1}/{2}'.format(static_dir, code_dir, src)
 
     open_tag = ("<figure class='code'>\n<figcaption><span>{title}</span> "
                 "<a href='{url}'>download</a></figcaption>".format(title=title,

+ 0 - 1
liquid_tags/notebook.py

@@ -174,7 +174,6 @@ def notebook(preprocessor, tag, markup):
     settings = preprocessor.configs.config['settings']
     nb_dir =  settings.get('NOTEBOOK_DIR', 'notebooks')
     nb_path = os.path.join('content', nb_dir, src)
-    url = '/{0}/{1}/{2}'.format('static', nb_dir, src)
 
     if not os.path.exists(nb_path):
         raise ValueError("File {0} could not be found".format(nb_path))