summaryrefslogtreecommitdiff
path: root/tools/gendocs/source.py
blob: 3de487427ccd4d0c3e2f123189406467563e2635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python3
# -*- coding: utf-8 -*-


class SourceReader(object):
    """Lecteur attentif de code source."""


    def __init__(self, parent, name, output):
        """Initialise l'identité d'une partie de documentation."""

        self._parent = parent
        self._name = name
        self._output_cls = output
        self._output = output()


    def build(self, validation):
        """Construit de façon générique une documentation complète."""

        self._output.open(self._name, self._fullname)

        others, mod_desc = self.prepare_module()
        classes = self.list_all_classes()

        # Contenu du module

        self._output.start_main_section('Content')

        self._output.show_list_sub_modules(self._parent, self._fullname, others, self.make_path)

        self._output.show_list_sub_classes(self._fullname, classes, self.make_path)

        self._output.describe_module(mod_desc)

        # Description des classes

        if len(classes) > 0:

            self._output.start_main_section('Classes')

            for cls in classes:
                self.describe_class(cls, validation)

        # Eléments propres au module

        self.describe_module_items()

        # Fermeture et suite

        self._output.close()

        for o in others:
            o.build(validation)