Commits

Miki Tebeka committed e3aa154

Load CSS from JS and renaming

Comments (0)

Files changed (3)

 <html>
     <head>
         <title>Test</title>
-        <link type="text/css" href= "http://localhost:8080/css" rel="stylesheet" />
     </head>
     <body>
         <h3>Testing</h3>
             Some random text here ...
         </p>
     </body>
-    <script src="http://localhost:8080/js"></script>
+    <script src="http://localhost:8080/highlight"></script>
 </html>
     var obj = $('.highlight');
     var options = get_options(obj.attr('class'));
     options['code'] = obj.text();
-    obj.load("http://localhost:8080/highlight", options);
+    obj.load("http://localhost:8080/pygmentize", options);
 }
 
-$(document).ready(highlight);
+function on_ready() {
+    var url = '<link type="text/css" href="http://localhost:8080/css" ' +
+              'rel="stylesheet" />'
+    $('head').append($(url))
+    highlight();
+}
+
+$(document).ready(on_ready);
             return fo.read()
 
     @expose
-    def highlight(self, **kw):
+    def pygmentize(self, **kw):
         code = kw.get("code", "")
         if not code:
             return ""
 
     @expose
     @tools.response_headers(headers=[("Content-Type", "application/json")])
-    def js(self, **kw):
+    def highlight(self, **kw):
         with open("jquery.js") as fo:
             jquery = fo.read()
         with open("highlight.js") as fo: