3 from django.http import HttpResponse
4 from django.views.generic import TemplateView, ListView, DetailView, View
6 from librarian.dcparser import BookInfo
7 from librarian.document import WLDocument
8 from librarian.builders import StandaloneHtmlBuilder
11 class XslView(TemplateView):
12 template_name = 'wlxml/wl2html.xsl'
13 content_type = 'application/xslt+xml'
15 def get_context_data(self):
16 ctx = super().get_context_data()
18 for t in models.Tag.objects.all():
19 tags.setdefault(t.type, []).append(t.name)
22 "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
23 "http://purl.org/dc/elements/1.1/": "dc",
24 "http://www.w3.org/XML/1998/namespace": "xml",
30 class EditorCSS(ListView):
31 template_name = 'wlxml/editor.css'
32 content_type = 'text/css'
33 queryset = models.Tag.objects.all()
36 class TagsView(ListView):
37 queryset = models.Tag.objects.all()
40 class TagView(DetailView):
41 queryset = models.Tag.objects.all()
45 class MetaTagsView(View):
46 def get(self, request):
48 'let META_FIELDS = ' + json.dumps([
51 'required': f.required,
52 'multiple': f.multiple,
55 'hasLanguage': f.value_type.has_language,
56 'name': f.value_type.__name__,
59 for f in BookInfo.FIELDS
61 content_type='text/javascript')