File: Synopsis/Formatters/HTML/Fragments/TemplateSpecializations.py 1
2
3
4
5
6
7
8from Synopsis.Formatters.HTML.Tags import *
9from Synopsis.Formatters.HTML.Fragment import Fragment
10
11class TemplateSpecializations(Fragment):
12 """Cross-link primary templates with their specializations."""
13
14 def format_forward(self, forward):
15
16 if not forward.template:
17 return ''
18 if forward.specializations:
19 spec = '\n'.join([div(None, self.reference(s))
20 for s in forward.specializations])
21 return div('specializations', 'Specializations: ' + div(None, spec))
22 elif forward.primary_template:
23 return div('primary-template',
24 'Primary template: ' + self.reference(forward.primary_template))
25 return ''
26
27 def format_class(self, class_):
28
29 if class_.primary_template:
30 return div('primary-template',
31 'Primary template: ' + self.reference(class_.primary_template))
32 return ''
33
34 def format_class_template(self, template_):
35
36 if template_.specializations:
37 spec = ' '.join([div(None, self.reference(s))
38 for s in template_.specializations])
39 return div('specializations', 'Specializations: ' + spec)
40 elif template_.primary_template:
41 return div('primary-template',
42 'Primary template: ' + self.reference(template_.primary_template))
43 return ''
44
Generated on Thu Apr 16 16:27:16 2009 by
synopsis (version devel)