Pyolian doc generator: update wrt name API changes

Argh, this has been difficult... hopefully I have done
this right
This commit is contained in:
Davide Andreoli 2018-03-17 11:37:13 +01:00
parent 35316db2f0
commit 2cb896dfab
9 changed files with 51 additions and 51 deletions

View File

@ -1,6 +1,6 @@
<!--(include)-->doc_macros.include<!--(end)-->#! <!--(include)-->doc_macros.include<!--(end)-->#!
~~Title: ${alias.full_name}$~~ ~~Title: ${alias.name}$~~
====== ${alias.full_name}$ (alias) ====== ====== ${alias.name}$ (alias) ======
${BEST_SUMMARY(obj=alias)}$ ${BEST_SUMMARY(obj=alias)}$

View File

@ -1,6 +1,6 @@
<!--(include)-->doc_macros.include<!--(end)-->#! <!--(include)-->doc_macros.include<!--(end)-->#!
~~Title: ${cls.full_name}$~~ ~~Title: ${cls.name}$~~
====== ${cls.full_name}$ (${CLS_TYPE}$) ====== ====== ${cls.name}$ (${CLS_TYPE}$) ======
${BEST_SUMMARY(obj=cls)}$ ${BEST_SUMMARY(obj=cls)}$

View File

@ -1,6 +1,6 @@
<!--(include)-->doc_macros.include<!--(end)-->#! <!--(include)-->doc_macros.include<!--(end)-->#!
~~Title: ${enum.full_name}$~~ ~~Title: ${enum.name}$~~
====== ${enum.full_name}$ (enum) ====== ====== ${enum.name}$ (enum) ======
${BEST_SUMMARY(obj=enum)}$ ${BEST_SUMMARY(obj=enum)}$
@ -23,7 +23,7 @@ ${OBJECT_STATIC_CONTENT(obj=enum, section='fields')}$
<code> <code>
enum { enum {
<!--(for field in enum.enum_fields)--> <!--(for field in enum.enum_fields)-->
${field.name}$: ${field.value.serialize}$, ${field.name}$: ${field.value.serialize}$
<!--(end)--> <!--(end)-->
} }
</code> </code>
@ -35,5 +35,5 @@ typedef enum {
<!--(for field in enum.enum_fields)--> <!--(for field in enum.enum_fields)-->
${field.c_name}$ = ${field.value.serialize}$, ${field.c_name}$ = ${field.value.serialize}$,
<!--(end)--> <!--(end)-->
} ${enum.full_name.replace('.', '_')}$; } ${enum.name.replace('.', '_')}$;
</code> </code>

View File

@ -125,7 +125,7 @@ interface#!
<!--(for n in cls.namespaces)--> <!--(for n in cls.namespaces)-->
:${n.lower()}$#! :${n.lower()}$#!
<!--(end)--> <!--(end)-->
:${cls.name.lower()}$|${cls.full_name}$]] :${cls.short_name.lower()}$|${cls.name}$]]
<!--(end)--> <!--(end)-->
#!############################################################################## #!##############################################################################
#!#### EVENT_LINK(cls, ev) ################################################### #!#### EVENT_LINK(cls, ev) ###################################################
@ -135,9 +135,9 @@ interface#!
<!--(for n in cls.namespaces)--> <!--(for n in cls.namespaces)-->
:${n.lower()}$#! :${n.lower()}$#!
<!--(end)--> <!--(end)-->
:${cls.name.lower()}$#! :${cls.short_name.lower()}$#!
:event#! :event#!
:${ev.name.lower().replace(',','_')}$|${ev.name}$]] :${ev.short_name.lower().replace(',','_')}$|${ev.name}$]]
<!--(end)--> <!--(end)-->
#!############################################################################## #!##############################################################################
#!#### TYPEDECL_LINK(typedecl) ############################################### #!#### TYPEDECL_LINK(typedecl) ###############################################
@ -147,7 +147,7 @@ interface#!
<!--(for n in typedecl.namespaces)--> <!--(for n in typedecl.namespaces)-->
:${n.lower()}$#! :${n.lower()}$#!
<!--(end)--> <!--(end)-->
:${typedecl.name.lower()}$|${typedecl.full_name}$]] :${typedecl.short_name.lower()}$|${typedecl.name}$]]
<!--(end)--> <!--(end)-->
#!############################################################################## #!##############################################################################
#!#### TYPE_LINK(type) ####################################################### #!#### TYPE_LINK(type) #######################################################
@ -157,7 +157,7 @@ interface#!
<!--(for n in type.namespaces)--> <!--(for n in type.namespaces)-->
:${n.lower()}$#! :${n.lower()}$#!
<!--(end)--> <!--(end)-->
:${type.name.lower()}$|${type.full_name}$]] :${type.short_name.lower()}$|${type.name}$]]
<!--(end)--> <!--(end)-->
#!############################################################################## #!##############################################################################
#!#### FUNC_LINK(func) ####################################################### #!#### FUNC_LINK(func) #######################################################
@ -172,7 +172,7 @@ interface#!
<!--(else)--> <!--(else)-->
:property#! :property#!
<!--(end)--> <!--(end)-->
:${func.name}$|${func.name}$]] :${func.short_name}$|${func.short_name}$]]
<!--(end)--> <!--(end)-->
#!############################################################################## #!##############################################################################
#!#### FUNC_SCOPE(func) ###################################################### #!#### FUNC_SCOPE(func) ######################################################
@ -253,7 +253,7 @@ interface#!
<!--(if i == 0)--> <!--(if i == 0)-->
^ parameters ^ type ^ description ^ ^ parameters ^ type ^ description ^
<!--(end)--> <!--(end)-->
|${PARAM_DIRECTION_TAG(param=par)}$ **${par.name}$**|${par.type.full_name}$ #! |${PARAM_DIRECTION_TAG(param=par)}$ **${par.name}$**|${par.type.name}$ #!
|${BEST_SUMMARY(obj=par)}$ ${BEST_DESCRIPTION(obj=par)}$| |${BEST_SUMMARY(obj=par)}$ ${BEST_DESCRIPTION(obj=par)}$|
<!--(else)--> <!--(else)-->
**This function do not accept any parameter.** **This function do not accept any parameter.**
@ -262,7 +262,7 @@ interface#!
<!--(if func.method_return_type)--> <!--(if func.method_return_type)-->
${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#! ${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#!
^ return ^ description ^ ^ return ^ description ^
|**${func.method_return_type.full_name}$**|${BEST_SUMMARY(obj=obj)}$ ${BEST_DESCRIPTION(obj=obj)}$| |**${func.method_return_type.name}$**|${BEST_SUMMARY(obj=obj)}$ ${BEST_DESCRIPTION(obj=obj)}$|
<!--(else)--> <!--(else)-->
**This function do not return anything.** **This function do not return anything.**
<!--(end)--> <!--(end)-->
@ -277,14 +277,14 @@ ${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#!
<!--(if i == 0)--> <!--(if i == 0)-->
^ values ^ type ^ description ^ ^ values ^ type ^ description ^
<!--(end)--> <!--(end)-->
|**${val.name}$**|${val.type.full_name}$|${BEST_SUMMARY(obj=val)}$| |**${val.name}$**|${val.type.name}$|${BEST_SUMMARY(obj=val)}$|
<!--(end)--> <!--(end)-->
<!--(for i, key in enumerate(func.getter_keys or func.setter_keys))--> <!--(for i, key in enumerate(func.getter_keys or func.setter_keys))-->
<!--(if i == 0)--> <!--(if i == 0)-->
^ keys ^ type ^ description ^ ^ keys ^ type ^ description ^
<!--(end)--> <!--(end)-->
|**${key.name}$**|${key.type.full_name}$|${BEST_SUMMARY(obj=key)}$| |**${key.name}$**|${key.type.name}$|${BEST_SUMMARY(obj=key)}$|
<!--(end)--> <!--(end)-->
<!--(end)--> <!--(end)-->
@ -296,19 +296,19 @@ ${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#!
(#! (#!
<!--(if impl.is_property)--> <!--(if impl.is_property)-->
<!--(for i, val in enumerate(impl.function.getter_values or impl.function.setter_values))--> <!--(for i, val in enumerate(impl.function.getter_values or impl.function.setter_values))-->
${', ' if i else ''}$${val.type.name}$#! ${', ' if i else ''}$${val.type.short_name}$#!
<!--(end)--> <!--(end)-->
<!--(elif impl.is_method)--> <!--(elif impl.is_method)-->
<!--(for i, param in enumerate(impl.function.parameters))--> <!--(for i, param in enumerate(impl.function.parameters))-->
${', ' if i else ''}$#! ${', ' if i else ''}$#!
//${param.type.name}$// ''${param.direction.name.lower()}$'' **${param.name}$**#! //${param.type.short_name}$// ''${param.direction.name.lower()}$'' **${param.short_name}$**#!
<!--(end)--> <!--(end)-->
<!--(end)--> <!--(end)-->
) #! ) #!
${IMPLEMENT_TAGS}$ #! ${IMPLEMENT_TAGS}$ #!
<!--(if impl.is_method)--> <!--(if impl.is_method)-->
<!--(if impl.function.method_return_type)--> <!--(if impl.function.method_return_type)-->
=> //${impl.function.method_return_type.name}$// #! => //${impl.function.method_return_type.short_name}$// #!
<!--(else)--> <!--(else)-->
=> //None// #! => //None// #!
<!--(end)--> <!--(end)-->

View File

@ -1,6 +1,6 @@
<!--(include)-->doc_macros.include<!--(end)-->#! <!--(include)-->doc_macros.include<!--(end)-->#!
~~Title: ${struct.full_name}$~~ ~~Title: ${struct.name}$~~
====== ${struct.full_name}$ (struct) ====== ====== ${struct.name}$ (struct) ======
${BEST_SUMMARY(obj=struct)}$ ${BEST_SUMMARY(obj=struct)}$
@ -21,7 +21,7 @@ ${OBJECT_STATIC_CONTENT(obj=struct, section='fields')}$
===== Signature ===== ===== Signature =====
<code> <code>
struct ${struct.full_name}$ { struct ${struct.name}$ {
<!--(for field in struct.struct_fields)--> <!--(for field in struct.struct_fields)-->
${field.name}$: ${field.type.name}$, ${field.name}$: ${field.type.name}$,
<!--(end)--> <!--(end)-->
@ -31,9 +31,9 @@ struct ${struct.full_name}$ {
===== C Signature ===== ===== C Signature =====
<code> <code>
typedef struct _${struct.full_name.replace('.', '_')}$ { typedef struct _${struct.name.replace('.', '_')}$ {
<!--(for field in struct.struct_fields)--> <!--(for field in struct.struct_fields)-->
${field.name}$: **TODO (issue with Typedecl.c_type need Unit)**, ${field.name}$: **TODO (issue with Typedecl.c_type need Unit)**,
<!--(end)--> <!--(end)-->
} ${struct.full_name.replace('.', '_')}$; } ${struct.name.replace('.', '_')}$;
</code> </code>

View File

@ -41,7 +41,7 @@ _choices = ['start', 'classes', 'enums', 'structs', 'aliases']
parser.add_argument('--step', '-s', metavar='STEP', default=None, parser.add_argument('--step', '-s', metavar='STEP', default=None,
choices=_choices, choices=_choices,
help='A single step to run (default to all), ' help='A single step to run (default to all), '
'valid choises: '+ ', '.join(_choices)) 'valid choices: '+ ', '.join(_choices))
args = parser.parse_args() args = parser.parse_args()
@ -72,7 +72,7 @@ def page_path_for_object(obj):
path = ['data', 'pages', 'develop', 'api'] path = ['data', 'pages', 'develop', 'api']
for ns in obj.namespaces: for ns in obj.namespaces:
path.append(ns.lower()) path.append(ns.lower())
output_file = obj.name.lower() + '.txt' output_file = obj.short_name.lower() + '.txt'
return os.path.join(args.root_path, *path, output_file) return os.path.join(args.root_path, *path, output_file)
@ -132,30 +132,30 @@ if args.step in ('start', None):
if args.step in ('classes', None): if args.step in ('classes', None):
t = Template('doc_class.template') t = Template('doc_class.template')
for cls in eolian_db.classes: for cls in eolian_db.classes:
if cls.full_name.startswith(args.namespace): if cls.name.startswith(args.namespace):
output_file = page_path_for_object(cls) output_file = page_path_for_object(cls)
t.render(output_file, args.verbose, cls=cls.full_name) t.render(output_file, args.verbose, cls=cls.name)
# render a page for each Enum # render a page for each Enum
if args.step in ('enums', None): if args.step in ('enums', None):
t = Template('doc_enum.template') t = Template('doc_enum.template')
for enum in eolian_db.enums: for enum in eolian_db.enums:
if enum.full_name.startswith(args.namespace): if enum.name.startswith(args.namespace):
output_file = page_path_for_object(enum) output_file = page_path_for_object(enum)
t.render(output_file, args.verbose, enum=enum.full_name) t.render(output_file, args.verbose, enum=enum.name)
# render a page for each Struct # render a page for each Struct
if args.step in ('structs', None): if args.step in ('structs', None):
t = Template('doc_struct.template') t = Template('doc_struct.template')
for struct in eolian_db.structs: for struct in eolian_db.structs:
if struct.full_name.startswith(args.namespace): if struct.name.startswith(args.namespace):
output_file = page_path_for_object(struct) output_file = page_path_for_object(struct)
t.render(output_file, args.verbose, struct=struct.full_name) t.render(output_file, args.verbose, struct=struct.name)
# render a page for each Alias # render a page for each Alias
if args.step in ('aliases', None): if args.step in ('aliases', None):
t = Template('doc_alias.template') t = Template('doc_alias.template')
for alias in eolian_db.aliases: for alias in eolian_db.aliases:
if alias.full_name.startswith(args.namespace): if alias.name.startswith(args.namespace):
output_file = page_path_for_object(alias) output_file = page_path_for_object(alias)
t.render(output_file, args.verbose, alias=alias.full_name) t.render(output_file, args.verbose, alias=alias.name)

View File

@ -8,7 +8,7 @@
<!--(for n in cls.namespaces)--> <!--(for n in cls.namespaces)-->
:${n.lower()}$#! :${n.lower()}$#!
<!--(end)--> <!--(end)-->
:${cls.name.lower()}$|${cls.name}$]] :${cls.short_name.lower()}$|${cls.short_name}$]]
<!--(end)--> <!--(end)-->
#!############################################################################## #!##############################################################################
@ -19,7 +19,7 @@
<!--(for n in typedecl.namespaces)--> <!--(for n in typedecl.namespaces)-->
:${n.lower()}$#! :${n.lower()}$#!
<!--(end)--> <!--(end)-->
:${typedecl.name.lower()}$|${typedecl.name}$]] :${typedecl.short_name.lower()}$|${typedecl.short_name}$]]
<!--(end)--> <!--(end)-->
#!############################################################################## #!##############################################################################

View File

@ -1,12 +1,12 @@
================================================================================ ================================================================================
Class: ${cls.full_name}$ Class: ${cls.name}$ (${cls.short_name}$)
================================================================================ ================================================================================
Class type: ${cls.type}$ Class type: ${cls.type}$
Base Class: ${cls.base_class.full_name if cls.base_class else None}$ Base Class: ${cls.base_class.name if cls.base_class else None}$
Inherits: ${', '.join([i.full_name for i in cls.inherits])}$ Inherits: ${', '.join([i.name for i in cls.inherits])}$
Hierarchy: ${' => '.join([i.full_name for i in cls.hierarchy])}$ Hierarchy: ${' => '.join([i.name for i in cls.hierarchy])}$
InheritsFull: ${', '.join([i.full_name for i in cls.inherits_full])}$ InheritsFull: ${', '.join([i.name for i in cls.inherits_full])}$
Namespace: ${cls.namespace}$ Namespace: ${cls.namespace}$
Namespaces: ${list(cls.namespaces)}$ Namespaces: ${list(cls.namespaces)}$
File: ${cls.file}$ File: ${cls.file}$
@ -40,7 +40,7 @@ Properties:
Implements: Implements:
=========== ===========
<!--(for i in cls.implements)--> <!--(for i in cls.implements)-->
* ${i.full_name}$ * ${i.name}$
<!--(else)--> <!--(else)-->
no implements available no implements available
<!--(end)--> <!--(end)-->

View File

@ -6,7 +6,7 @@ Namespace: ${namespace.name}$ ${namespace.namespaces}$
Regular Classes: Regular Classes:
================ ================
<!--(for cls in namespace.regulars)--> <!--(for cls in namespace.regulars)-->
* ${cls.full_name}$ * ${cls.name}$
<!--(else)--> <!--(else)-->
no classes available no classes available
<!--(end)--> <!--(end)-->
@ -14,7 +14,7 @@ Regular Classes:
Abstract Classes: Abstract Classes:
================ ================
<!--(for cls in namespace.abstracts)--> <!--(for cls in namespace.abstracts)-->
* ${cls.full_name}$ * ${cls.name}$
<!--(else)--> <!--(else)-->
no classes available no classes available
<!--(end)--> <!--(end)-->
@ -22,7 +22,7 @@ Abstract Classes:
Mixins: Mixins:
======= =======
<!--(for cls in namespace.mixins)--> <!--(for cls in namespace.mixins)-->
* ${cls.full_name}$ * ${cls.name}$
<!--(else)--> <!--(else)-->
no classes available no classes available
<!--(end)--> <!--(end)-->
@ -30,7 +30,7 @@ Mixins:
Interfaces: Interfaces:
=========== ===========
<!--(for cls in namespace.interfaces)--> <!--(for cls in namespace.interfaces)-->
* ${cls.full_name}$ * ${cls.name}$
<!--(else)--> <!--(else)-->
no classes available no classes available
<!--(end)--> <!--(end)-->
@ -38,7 +38,7 @@ Interfaces:
Aliases: Aliases:
======== ========
<!--(for typedecl in namespace.aliases)--> <!--(for typedecl in namespace.aliases)-->
* ${typedecl.full_name}$ * ${typedecl.name}$
<!--(else)--> <!--(else)-->
no alias available no alias available
<!--(end)--> <!--(end)-->
@ -46,7 +46,7 @@ Aliases:
Structs: Structs:
======== ========
<!--(for typedecl in namespace.structs)--> <!--(for typedecl in namespace.structs)-->
* ${typedecl.full_name}$ * ${typedecl.name}$
<!--(for field in typedecl.struct_fields)--> <!--(for field in typedecl.struct_fields)-->
${field.type.name}$ ${field.name}$ ${field.type.name}$ ${field.name}$
<!--(end)--> <!--(end)-->
@ -57,7 +57,7 @@ Structs:
Enums: Enums:
====== ======
<!--(for typedecl in namespace.enums)--> <!--(for typedecl in namespace.enums)-->
* ${typedecl.full_name}$ * ${typedecl.name}$
<!--(for field in typedecl.enum_fields)--> <!--(for field in typedecl.enum_fields)-->
${field.c_name}$ = ${field.value.serialize}$ ${field.c_name}$ = ${field.value.serialize}$
<!--(end)--> <!--(end)-->