import nitcorn
import nitcorn::log
import template
+import json::serialization_write
# Nitcorn service to hightlight code
#
var hlcode = null
if code != null then hlcode = hightlightcode(hl, code)
+ if http_request.post_args.get_or_null("json") == "true" and hlcode != null then
+ var response = new HttpResponse(200)
+ response.header["Content-Type"] = "text/json"
+ response.body = hlcode.to_json
+ return response
+ end
+
if http_request.post_args.get_or_null("ajax") == "true" and hlcode != null then
page.add hlcode.code_mirror_update
page.add """