catseye  committed 56b4ce6

Allow jQuery URL to be overridden (for local offline testing.)

  • Participants
  • Parent commits 80c8e7f

Comments (0)

Files changed (3)

File src/chrysoberyl/

     """Render all nodes to a set of HTML5 files.
+    optparser.add_option("--jquery-url",
+                         dest="jquery_url", metavar='URL',
+                         default='',
+                         help="URL from which rendered pages grab jQuery")
                          dest="node_dir", metavar='DIR',
         json.dump(transform_dates(data), file, encoding='utf-8',
-    r = Renderer(data, 'templates', options.node_dir)
+    r = Renderer(data, 'templates', options.node_dir,
+                 jquery_url=options.jquery_url)
     for filename in ['chrysoberyl.js', 'chrysoberyl-query.js']:
         shutil.copy(os.path.join('static', filename),

File src/chrysoberyl/

     """Object which renders Chrysoberyl data as HTML pages.
-    def __init__(self, data, template_dir, output_dir):
+    def __init__(self, data, template_dir, output_dir,
+                 jquery_url=None): = data
         self.template_dir = template_dir
         self.output_dir = output_dir
         self.loader = jinja2.FileSystemLoader(self.template_dir,
         self.env = jinja2.Environment(loader=self.loader)
+        self.jquery_url = jquery_url
     def render(self, template, output_filename, context):
         """Low-level method to render a given template."""
         context['data'] =
         context['key'] = key
         context['filekey'] = filekey
+        context['jquery_url'] = self.jquery_url
         # Context functions.  Being nested functions of render_node lets
         # them easily access (close over) the current node and its key.

File templates/base.html

   <title>{{ key }} | Cat's Eye Technologies</title>
   <link rel="shortcut icon" type="image/x-icon" href="../../favicon.ico" />
   <link rel="stylesheet" type="text/css" href="../stylesheet/chrysoberyl.css" />
-  <script src=""></script>
+  <script src="{{ jquery_url }}"></script>
   <script type="text/javascript" src="../scripts/chrysoberyl.js"></script>
   {% block extra_head %}{% endblock extra_head %}