From 2cb896dfab7180e3dc802be01987943c0bd3e555 Mon Sep 17 00:00:00 2001 From: Dave Andreoli Date: Sat, 17 Mar 2018 11:37:13 +0100 Subject: [PATCH] Pyolian doc generator: update wrt name API changes Argh, this has been difficult... hopefully I have done this right --- src/scripts/gendoc/doc_alias.template | 4 +-- src/scripts/gendoc/doc_class.template | 4 +-- src/scripts/gendoc/doc_enum.template | 8 +++--- src/scripts/gendoc/doc_macros.include | 26 +++++++++---------- src/scripts/gendoc/doc_struct.template | 10 +++---- src/scripts/gendoc/gendoc.py | 20 +++++++------- src/scripts/gendoc/namespaces.template | 4 +-- src/scripts/pyolian/test_gen_class.template | 12 ++++----- .../pyolian/test_gen_namespace.template | 14 +++++----- 9 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/scripts/gendoc/doc_alias.template b/src/scripts/gendoc/doc_alias.template index c0d5fa7a3d..0f3382344b 100644 --- a/src/scripts/gendoc/doc_alias.template +++ b/src/scripts/gendoc/doc_alias.template @@ -1,6 +1,6 @@ doc_macros.include#! -~~Title: ${alias.full_name}$~~ -====== ${alias.full_name}$ (alias) ====== +~~Title: ${alias.name}$~~ +====== ${alias.name}$ (alias) ====== ${BEST_SUMMARY(obj=alias)}$ diff --git a/src/scripts/gendoc/doc_class.template b/src/scripts/gendoc/doc_class.template index 60f6779af1..6daaa5f087 100644 --- a/src/scripts/gendoc/doc_class.template +++ b/src/scripts/gendoc/doc_class.template @@ -1,6 +1,6 @@ doc_macros.include#! -~~Title: ${cls.full_name}$~~ -====== ${cls.full_name}$ (${CLS_TYPE}$) ====== +~~Title: ${cls.name}$~~ +====== ${cls.name}$ (${CLS_TYPE}$) ====== ${BEST_SUMMARY(obj=cls)}$ diff --git a/src/scripts/gendoc/doc_enum.template b/src/scripts/gendoc/doc_enum.template index 03f6cd62cd..bdbb37a527 100644 --- a/src/scripts/gendoc/doc_enum.template +++ b/src/scripts/gendoc/doc_enum.template @@ -1,6 +1,6 @@ doc_macros.include#! -~~Title: ${enum.full_name}$~~ -====== ${enum.full_name}$ (enum) ====== +~~Title: ${enum.name}$~~ +====== ${enum.name}$ (enum) ====== ${BEST_SUMMARY(obj=enum)}$ @@ -23,7 +23,7 @@ ${OBJECT_STATIC_CONTENT(obj=enum, section='fields')}$ enum { - ${field.name}$: ${field.value.serialize}$, + ${field.name}$: ${field.value.serialize}$ } @@ -35,5 +35,5 @@ typedef enum { ${field.c_name}$ = ${field.value.serialize}$, -} ${enum.full_name.replace('.', '_')}$; +} ${enum.name.replace('.', '_')}$; diff --git a/src/scripts/gendoc/doc_macros.include b/src/scripts/gendoc/doc_macros.include index 577052ef64..1e62a2b62e 100644 --- a/src/scripts/gendoc/doc_macros.include +++ b/src/scripts/gendoc/doc_macros.include @@ -125,7 +125,7 @@ interface#! :${n.lower()}$#! -:${cls.name.lower()}$|${cls.full_name}$]] +:${cls.short_name.lower()}$|${cls.name}$]] #!############################################################################## #!#### EVENT_LINK(cls, ev) ################################################### @@ -135,9 +135,9 @@ interface#! :${n.lower()}$#! -:${cls.name.lower()}$#! +:${cls.short_name.lower()}$#! :event#! -:${ev.name.lower().replace(',','_')}$|${ev.name}$]] +:${ev.short_name.lower().replace(',','_')}$|${ev.name}$]] #!############################################################################## #!#### TYPEDECL_LINK(typedecl) ############################################### @@ -147,7 +147,7 @@ interface#! :${n.lower()}$#! -:${typedecl.name.lower()}$|${typedecl.full_name}$]] +:${typedecl.short_name.lower()}$|${typedecl.name}$]] #!############################################################################## #!#### TYPE_LINK(type) ####################################################### @@ -157,7 +157,7 @@ interface#! :${n.lower()}$#! -:${type.name.lower()}$|${type.full_name}$]] +:${type.short_name.lower()}$|${type.name}$]] #!############################################################################## #!#### FUNC_LINK(func) ####################################################### @@ -172,7 +172,7 @@ interface#! :property#! -:${func.name}$|${func.name}$]] +:${func.short_name}$|${func.short_name}$]] #!############################################################################## #!#### FUNC_SCOPE(func) ###################################################### @@ -253,7 +253,7 @@ interface#! ^ parameters ^ type ^ description ^ -|${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)}$| **This function do not accept any parameter.** @@ -262,7 +262,7 @@ interface#! ${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#! ^ 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)}$| **This function do not return anything.** @@ -277,14 +277,14 @@ ${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#! ^ values ^ type ^ description ^ -|**${val.name}$**|${val.type.full_name}$|${BEST_SUMMARY(obj=val)}$| +|**${val.name}$**|${val.type.name}$|${BEST_SUMMARY(obj=val)}$| ^ keys ^ type ^ description ^ -|**${key.name}$**|${key.type.full_name}$|${BEST_SUMMARY(obj=key)}$| +|**${key.name}$**|${key.type.name}$|${BEST_SUMMARY(obj=key)}$| @@ -296,19 +296,19 @@ ${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#! (#! -${', ' if i else ''}$${val.type.name}$#! +${', ' if i else ''}$${val.type.short_name}$#! ${', ' if i else ''}$#! -//${param.type.name}$// ''${param.direction.name.lower()}$'' **${param.name}$**#! +//${param.type.short_name}$// ''${param.direction.name.lower()}$'' **${param.short_name}$**#! ) #! ${IMPLEMENT_TAGS}$ #! - => //${impl.function.method_return_type.name}$// #! + => //${impl.function.method_return_type.short_name}$// #! => //None// #! diff --git a/src/scripts/gendoc/doc_struct.template b/src/scripts/gendoc/doc_struct.template index 370e9be6e9..306dcfd961 100644 --- a/src/scripts/gendoc/doc_struct.template +++ b/src/scripts/gendoc/doc_struct.template @@ -1,6 +1,6 @@ doc_macros.include#! -~~Title: ${struct.full_name}$~~ -====== ${struct.full_name}$ (struct) ====== +~~Title: ${struct.name}$~~ +====== ${struct.name}$ (struct) ====== ${BEST_SUMMARY(obj=struct)}$ @@ -21,7 +21,7 @@ ${OBJECT_STATIC_CONTENT(obj=struct, section='fields')}$ ===== Signature ===== -struct ${struct.full_name}$ { +struct ${struct.name}$ { ${field.name}$: ${field.type.name}$, @@ -31,9 +31,9 @@ struct ${struct.full_name}$ { ===== C Signature ===== -typedef struct _${struct.full_name.replace('.', '_')}$ { +typedef struct _${struct.name.replace('.', '_')}$ { ${field.name}$: **TODO (issue with Typedecl.c_type need Unit)**, -} ${struct.full_name.replace('.', '_')}$; +} ${struct.name.replace('.', '_')}$; diff --git a/src/scripts/gendoc/gendoc.py b/src/scripts/gendoc/gendoc.py index 8fec32cc13..2ebaa605d4 100755 --- a/src/scripts/gendoc/gendoc.py +++ b/src/scripts/gendoc/gendoc.py @@ -41,7 +41,7 @@ _choices = ['start', 'classes', 'enums', 'structs', 'aliases'] parser.add_argument('--step', '-s', metavar='STEP', default=None, choices=_choices, help='A single step to run (default to all), ' - 'valid choises: '+ ', '.join(_choices)) + 'valid choices: '+ ', '.join(_choices)) args = parser.parse_args() @@ -72,7 +72,7 @@ def page_path_for_object(obj): path = ['data', 'pages', 'develop', 'api'] for ns in obj.namespaces: 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) @@ -132,30 +132,30 @@ if args.step in ('start', None): if args.step in ('classes', None): t = Template('doc_class.template') 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) - 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 if args.step in ('enums', None): t = Template('doc_enum.template') 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) - 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 if args.step in ('structs', None): t = Template('doc_struct.template') 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) - 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 if args.step in ('aliases', None): t = Template('doc_alias.template') 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) - t.render(output_file, args.verbose, alias=alias.full_name) + t.render(output_file, args.verbose, alias=alias.name) diff --git a/src/scripts/gendoc/namespaces.template b/src/scripts/gendoc/namespaces.template index 02c071b634..d373025d56 100644 --- a/src/scripts/gendoc/namespaces.template +++ b/src/scripts/gendoc/namespaces.template @@ -8,7 +8,7 @@ :${n.lower()}$#! -:${cls.name.lower()}$|${cls.name}$]] +:${cls.short_name.lower()}$|${cls.short_name}$]] #!############################################################################## @@ -19,7 +19,7 @@ :${n.lower()}$#! -:${typedecl.name.lower()}$|${typedecl.name}$]] +:${typedecl.short_name.lower()}$|${typedecl.short_name}$]] #!############################################################################## diff --git a/src/scripts/pyolian/test_gen_class.template b/src/scripts/pyolian/test_gen_class.template index 15129bf080..cc0e845ab5 100644 --- a/src/scripts/pyolian/test_gen_class.template +++ b/src/scripts/pyolian/test_gen_class.template @@ -1,12 +1,12 @@ ================================================================================ -Class: ${cls.full_name}$ +Class: ${cls.name}$ (${cls.short_name}$) ================================================================================ Class type: ${cls.type}$ -Base Class: ${cls.base_class.full_name if cls.base_class else None}$ -Inherits: ${', '.join([i.full_name for i in cls.inherits])}$ -Hierarchy: ${' => '.join([i.full_name for i in cls.hierarchy])}$ -InheritsFull: ${', '.join([i.full_name for i in cls.inherits_full])}$ +Base Class: ${cls.base_class.name if cls.base_class else None}$ +Inherits: ${', '.join([i.name for i in cls.inherits])}$ +Hierarchy: ${' => '.join([i.name for i in cls.hierarchy])}$ +InheritsFull: ${', '.join([i.name for i in cls.inherits_full])}$ Namespace: ${cls.namespace}$ Namespaces: ${list(cls.namespaces)}$ File: ${cls.file}$ @@ -40,7 +40,7 @@ Properties: Implements: =========== - * ${i.full_name}$ + * ${i.name}$ no implements available diff --git a/src/scripts/pyolian/test_gen_namespace.template b/src/scripts/pyolian/test_gen_namespace.template index 2276c4ce96..8cdb4f7ca7 100644 --- a/src/scripts/pyolian/test_gen_namespace.template +++ b/src/scripts/pyolian/test_gen_namespace.template @@ -6,7 +6,7 @@ Namespace: ${namespace.name}$ ${namespace.namespaces}$ Regular Classes: ================ - * ${cls.full_name}$ + * ${cls.name}$ no classes available @@ -14,7 +14,7 @@ Regular Classes: Abstract Classes: ================ - * ${cls.full_name}$ + * ${cls.name}$ no classes available @@ -22,7 +22,7 @@ Abstract Classes: Mixins: ======= - * ${cls.full_name}$ + * ${cls.name}$ no classes available @@ -30,7 +30,7 @@ Mixins: Interfaces: =========== - * ${cls.full_name}$ + * ${cls.name}$ no classes available @@ -38,7 +38,7 @@ Interfaces: Aliases: ======== - * ${typedecl.full_name}$ + * ${typedecl.name}$ no alias available @@ -46,7 +46,7 @@ Aliases: Structs: ======== - * ${typedecl.full_name}$ + * ${typedecl.name}$ ${field.type.name}$ ${field.name}$ @@ -57,7 +57,7 @@ Structs: Enums: ====== - * ${typedecl.full_name}$ + * ${typedecl.name}$ ${field.c_name}$ = ${field.value.serialize}$