def _rewrite_section_name(query): """ Rewriting special section names: * EDITOR:NAME => emacs:go-mode """ if '/' not in query: return query section_name, rest = query.split('/', 1) if ':' in section_name: section_name = rewrite_editor_section_name(section_name) section_name = LANGUAGE_ALIAS.get(section_name, section_name) return "%s/%s" % (section_name, rest)
def _rewrite_section_name_for_q(query): """ FIXME: we rewrite the section name too earlier, what means that we have to use SO names everywhere, where actually canonified internal names shoud be used. After this thing is fixed, we should: * fix naming in cache * fix VIM_NAMES """ if '/' not in query: return query section_name, rest = query.split('/', 1) if ':' in section_name: section_name = rewrite_editor_section_name(section_name) section_name = SO_NAME.get(section_name, section_name) return "%s/%s" % (section_name, rest)