Commit 19555f44 authored by François Grisez's avatar François Grisez

Fixes translate_class_reference() method

parent 98d37769
......@@ -72,9 +72,6 @@ Enums
-----
{{#enums}}
.. _{{{ref_label}}}:
{{#make_subsection}}{{{name}}}{{/make_subsection}}
.. {{#write_declarator}}enum{{/write_declarator}}:: {{{declaration}}}
......
......@@ -210,10 +210,10 @@ class EnumPart(SphinxPart):
self.selector = self._make_selector(enum)
self.sectionName = RstTools.make_section(self.name)
self.declaration = 'public enum {0}'.format(self.name) if self.lang.langCode == 'Java' else self.name
self.ref_label = '{langCode}_{name}'.format(
langCode=lang.langCode,
name=enum.name.to_c()
)
ref = metadoc.ClassReference(None)
ref.relatedObject = enum
self.link = ref.translate(lang.docTranslator)
def _translate_enumerator(self, enumerator):
return {
......@@ -333,9 +333,8 @@ class ClassPage(SphinxPage):
def enumsSummary(self):
table = RstTools.Table()
for enum in self.enums:
reference = ':ref:`{0}`'.format(enum.ref_label)
briefDoc = '\n'.join([line['line'] for line in enum.briefDesc['lines']])
table.addrow([reference, briefDoc])
table.addrow((enum.link, briefDoc))
return table
@property
......
......@@ -437,7 +437,9 @@ class Translator:
if namespace is None:
description = ref.find_root()
namespace = description.relatedObject.find_first_ancestor_by_type(abstractapi.Namespace, abstractapi.Class)
if namespace.name.is_prefix_of(ref.relatedObject.name):
if namespace is abstractapi.GlobalNs:
commonName = None
elif namespace.name.is_prefix_of(ref.relatedObject.name):
commonName = namespace.name
else:
commonName = metaname.Name.find_common_parent(ref.relatedObject.name, namespace.name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment