Example #1
0
    def _format_symbol(self, symbol):
        if isinstance(symbol,
                      (QualifiedSymbol, FieldSymbol, EnumMemberSymbol)):
            return Formatter._format_symbol(self, symbol)

        self.extension.setup_language('c', None)
        self.__add_attrs(symbol, language='c')

        c_out = Formatter._format_symbol(self, symbol)
        python_out = None
        js_out = None

        self.extension.setup_language('python', 'c')
        if is_introspectable(symbol.unique_name, 'python'):
            self.__add_attrs(symbol, language='python')
            python_out = Formatter._format_symbol(self, symbol)

        self.extension.setup_language('javascript', 'python')
        if is_introspectable(symbol.unique_name, 'javascript'):
            self.__add_attrs(symbol, language='javascript')
            js_out = Formatter._format_symbol(self, symbol)

        self.extension.setup_language(None, 'javascript')
        return self.__wrap_in_language(symbol, c_out, python_out, js_out)
Example #2
0
    def _format_symbol (self, symbol):
        if isinstance(symbol, (QualifiedSymbol, FieldSymbol, EnumMemberSymbol)):
            return Formatter._format_symbol(self, symbol)

        langs_docs = {}
        previous_lang = None
        for lang in self.extension.get_languages():
            self.extension.setup_language(lang, previous_lang)
            lang_name = lang.language_name
            if lang_name == 'c' or is_introspectable(symbol.unique_name, lang):
                self.__add_attrs(symbol, language=lang_name)
                langs_docs[lang_name] = Formatter._format_symbol(self, symbol)
            else:
                langs_docs[lang_name] = None
            previous_lang = lang

        self.extension.setup_language(None, previous_lang)
        return self.__wrap_in_language(symbol, langs_docs)
Example #3
0
    def __translate_title(self, link, language):
        fund = FUNDAMENTALS[language].get(link.id_)
        if fund:
            return fund._title

        if language != 'c' and not is_introspectable(link.id_, language):
            return link._title + ' (not introspectable)'

        aliased_link = ALIASED_LINKS[language].get(link.id_)
        if aliased_link:
            return self.__translate_link_title(aliased_link, language)

        translated = get_translation(link.id_, language)
        if translated:
            return translated

        if language == 'c' and link.id_ in GTKDOC_HREFS:
            return link.id_

        return None
Example #4
0
    def __translate_title(self, link, language):
        fund = language.get_fundamental(link.id_)
        if fund:
            return fund._title

        if language.language_name != 'c' and not is_introspectable(
                link.id_, language):
            return link._title + ' (not introspectable)'

        aliased_link = language.get_alias_link(link.id_)
        if aliased_link:
            return self.__translate_link_title(aliased_link, language)

        translated = language.get_translation(link.id_)
        if translated:
            return translated

        if language.language_name == 'c' and link.id_ in GTKDOC_HREFS:
            return link.id_
        return None