+@never_cache
+def document_diff(request, name, revA, revB):
+ storage = getstorage()
+ docA = storage.get(name, int(revA))
+ docB = storage.get(name, int(revB))
+
+
+ return HttpResponse(nice_diff.html_diff_table(docA.plain_text.splitlines(),
+ docB.plain_text.splitlines()) )
+
+@never_cache
+def document_history(request, name):
+ storage = getstorage()
+
+ return HttpResponse(
+ json.dumps(storage.history(name), cls=DateTimeEncoder),
+ mimetype='application/json')
+
+
+@never_cache
+def document_publish(request, name, version):
+ storage = getstorage()
+
+ # get the document
+ try:
+ document = storage.get(name, revision = int(version))
+ except DocumentNotFound:
+ raise Http404
+
+ api = wlapi.WLAPI(settings.WL_API_CONFIG)
+ try:
+ result = {"success": True, "result": api.publish_book(document)}
+ except wlapi.APICallException, e:
+ result = {"success": False, "reason": str(e)}
+
+ return HttpResponse( json.dumps(result), mimetype='application/json')
\ No newline at end of file