29
30:- module(annotation,
31 [ annotation//1 32 ]).
41:- use_module(generics). 42:- use_module(library(http/html_head)). 43:- use_module(library(http/html_write)). 44:- use_module(library(http/http_dispatch)). 45:- use_module(library(pldoc/doc_html), [object_ref//2]). 46:- use_module(object_support). 47:- use_module(post). 48
49:- html_resource(css('annotation.css'),
50 [ requires([css('post.css')])
51 ]). 52
53:- multifile
54 prolog:doc_object_page_footer/2. 55
56:- http_handler(root(annotation), annotation_process, [prefix]).
65annotation_process(Request):-
66 memberchk(method(get), Request),
67 request_to_id(Request, annotation, Post), !,
68 post(Post, id, Id),
69 post(Post, about, Object),
70 object_label(Object, Label),
71 atomic_list_concat(['Annotation',Label], '--', Title),
72 reply_html_page(
73 wiki(Title),
74 title(Title),
75 \post(Id, [])).
76annotation_process(Request):-
77 post_process(Request, annotation).
83annotation(Object) -->
84 { ground(Object), !,
85 ( prolog:doc_canonical_object(Object, Object2)
86 -> true
87 ; Object2 = Object
88 ),
89 find_posts(annotation, object_post(Object2), Ids)
90 },
91 html([\html_requires(css('annotation.css')),
92 \posts(annotation, Object2, Ids, [])
93 ]).
94annotation(_) --> [].
95
96object_post(About, Id) :-
97 post(Id, object, About)
Annotation