diff --git a/src/scripts/gendoc/doc_start.template b/src/scripts/gendoc/doc_start.template index aeeed38fd3..57526ca51f 100644 --- a/src/scripts/gendoc/doc_start.template +++ b/src/scripts/gendoc/doc_start.template @@ -10,12 +10,6 @@ Pratically there is nothing python related currently in this documentation, so it can be considered valid for all languages. -^** Some numbers just for information **^^ - -| ${label}$ | **${val}$** | - - - ===== ${ns.name}$ (namespace) ===== diff --git a/src/scripts/gendoc/gendoc.py b/src/scripts/gendoc/gendoc.py index d3286229c6..d0fc5ebf28 100755 --- a/src/scripts/gendoc/gendoc.py +++ b/src/scripts/gendoc/gendoc.py @@ -76,6 +76,47 @@ def page_path_for_object(obj): return os.path.join(args.root_path, *path, output_file) +# render a (temporary) page for analizying the namespaces hierarchy +t = Template('namespaces.template') +nspaces = [ ns for ns in eolian_db.all_namespaces + if ns.name.startswith(args.namespace) ] + +tot_classes = tot_regulars = tot_abstracts = tot_mixins = tot_ifaces = 0 +tot_enums = tot_structs = tot_aliases = 0 +for ns in nspaces: + for cls in ns.classes: + tot_classes += 1 + if cls.type == eolian.Eolian_Class_Type.REGULAR: + tot_regulars += 1 + elif cls.type == eolian.Eolian_Class_Type.ABSTRACT: + tot_abstracts += 1 + elif cls.type == eolian.Eolian_Class_Type.MIXIN: + tot_mixins += 1 + elif cls.type == eolian.Eolian_Class_Type.INTERFACE: + tot_ifaces += 1 + tot_enums += len(ns.enums) + tot_structs += len(ns.structs) + tot_aliases += len(ns.aliases) + + +totals = [ + ('Namespaces', len(nspaces)), + ('ALL Classes', tot_classes), + ('Regular classes', tot_regulars), + ('Abstract classes', tot_abstracts), + ('Mixins', tot_mixins), + ('Interfaces', tot_ifaces), + ('Enums', tot_enums), + ('Structs', tot_structs), + ('Aliases', tot_aliases), +] + +root_ns = eolian_db.namespace_get_by_name(args.namespace) + +output_file = os.path.join(args.root_path,'data','pages','develop','api','namespaces.txt') +t.render(output_file, args.verbose, root_ns=root_ns, totals=totals) + + # render the main start.txt page if args.step in ('start', None): t = Template('doc_start.template') @@ -83,29 +124,8 @@ if args.step in ('start', None): nspaces = [ ns for ns in eolian_db.all_namespaces if ns.name.startswith(args.namespace) ] - tot_classes = tot_regulars = tot_abstracts = tot_mixins = tot_ifaces = 0 - for ns in nspaces: - for cls in ns.classes: - tot_classes += 1 - if cls.type == eolian.Eolian_Class_Type.REGULAR: - tot_regulars += 1 - elif cls.type == eolian.Eolian_Class_Type.ABSTRACT: - tot_abstracts += 1 - elif cls.type == eolian.Eolian_Class_Type.MIXIN: - tot_mixins += 1 - elif cls.type == eolian.Eolian_Class_Type.INTERFACE: - tot_ifaces += 1 - totals = [ - ('Namespaces', len(nspaces)), - ('ALL Classes', tot_classes), - ('Regular classes', tot_regulars), - ('Abstract classes', tot_abstracts), - ('Mixins', tot_mixins), - ('Interfaces', tot_ifaces), - ] - output_file = os.path.join(args.root_path,'data','pages','develop','api','start.txt') - t.render(output_file, args.verbose, nspaces=nspaces, totals=totals) + t.render(output_file, args.verbose, nspaces=nspaces) # render a page for each Class diff --git a/src/scripts/gendoc/namespaces.template b/src/scripts/gendoc/namespaces.template new file mode 100644 index 0000000000..02c071b634 --- /dev/null +++ b/src/scripts/gendoc/namespaces.template @@ -0,0 +1,83 @@ +~~Title: EFL Namespaces~~ + +#!############################################################################## +#!#### CLS_LINK(cls) ######################################################### +#!############################################################################## + +[[:develop:api#! + +:${n.lower()}$#! + +:${cls.name.lower()}$|${cls.name}$]] + + +#!############################################################################## +#!#### TYPEDECL_LINK(typedecl) ############################################### +#!############################################################################## + +[[:develop:api#! + +:${n.lower()}$#! + +:${typedecl.name.lower()}$|${typedecl.name}$]] + + +#!############################################################################## +#!#### NAMESPACE_ITEM(ns) #################################################### +#!############################################################################## + +**${ns.name}$** #! + + \\ Classes: ${CLS_LINK(cls=cls)}$, #! + + + \\ Abstracts: ${CLS_LINK(cls=cls)}$, #! + + + \\ Mixins: ${CLS_LINK(cls=cls)}$, #! + + + \\ Interfaces: ${CLS_LINK(cls=cls)}$, #! + + + \\ Structs: ${TYPEDECL_LINK(typedecl=struct)}$, #! + + + \\ Enums: ${TYPEDECL_LINK(typedecl=enum)}$, #! + + + \\ Aliases: ${TYPEDECL_LINK(typedecl=alias)}$, #! + + + + +====== Unified-API namespaces hierarchy ====== +This page is just a temporary work to analyze the namespaces in the new API + + +^** Some numbers just for information **^^ + +| ${label}$ | **${val}$** | + + + + +===== Namespaces hierarchy ===== + + + * ${NAMESPACE_ITEM(ns=root_ns)}$ + + * ${NAMESPACE_ITEM(ns=sub)}$ + + * ${NAMESPACE_ITEM(ns=sub)}$ + + * ${NAMESPACE_ITEM(ns=sub)}$ + + * ${NAMESPACE_ITEM(ns=sub)}$ + + + + + + + diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 6e3b52b3ec..d62e74bec2 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -509,49 +509,57 @@ class Namespace(object): def namespaces(self): return self._name.split('.') + @property + def sub_namespaces(self): + base = self._name + '.' + deep = self._name.count('.') + 1 + return [ ns for ns in self._unit.all_namespaces + if ns.name.startswith(base) and ns.name.count('.') == deep ] + + @property def classes(self): - return [ c for c in self._unit.all_classes - if c.namespace == self._name ] + return sorted([ c for c in self._unit.all_classes + if c.namespace == self._name ]) @property def regulars(self): - return [ c for c in self._unit.all_classes - if c.type == Eolian_Class_Type.REGULAR and - c.namespace == self._name] + return sorted([ c for c in self._unit.all_classes + if c.type == Eolian_Class_Type.REGULAR and + c.namespace == self._name]) @property def abstracts(self): - return [ c for c in self._unit.all_classes - if c.type == Eolian_Class_Type.ABSTRACT and - c.namespace == self._name] + return sorted([ c for c in self._unit.all_classes + if c.type == Eolian_Class_Type.ABSTRACT and + c.namespace == self._name]) @property def mixins(self): - return [ c for c in self._unit.all_classes - if c.type == Eolian_Class_Type.MIXIN and - c.namespace == self._name] + return sorted([ c for c in self._unit.all_classes + if c.type == Eolian_Class_Type.MIXIN and + c.namespace == self._name]) @property def interfaces(self): - return [ c for c in self._unit.all_classes - if c.type == Eolian_Class_Type.INTERFACE and - c.namespace == self._name] + return sorted([ c for c in self._unit.all_classes + if c.type == Eolian_Class_Type.INTERFACE and + c.namespace == self._name]) @property def aliases(self): - return [ td for td in self._unit.typedecl_all_aliases - if td.namespace == self._name] + return sorted([ td for td in self._unit.typedecl_all_aliases + if td.namespace == self._name]) @property def structs(self): - return [ td for td in self._unit.typedecl_all_structs - if td.namespace == self._name] + return sorted([ td for td in self._unit.typedecl_all_structs + if td.namespace == self._name]) @property def enums(self): - return [ td for td in self._unit.typedecl_all_enums - if td.namespace == self._name] + return sorted([ td for td in self._unit.typedecl_all_enums + if td.namespace == self._name]) ### Eolian Classes ##########################################################