diff --git a/kallithea/lib/annotate.py b/kallithea/lib/annotate.py --- a/kallithea/lib/annotate.py +++ b/kallithea/lib/annotate.py @@ -48,7 +48,7 @@ def annotate_highlight(filenode, annotat :param headers: dictionary with headers (keys are whats in ``order`` parameter) """ - from kallithea.lib.utils import get_custom_lexer + from kallithea.lib.pygmentsutils import get_custom_lexer options['linenos'] = True formatter = AnnotateHtmlFormatter(filenode=filenode, order=order, headers=headers, diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -41,7 +41,7 @@ from webhelpers.html.tags import _set_in from kallithea.config.routing import url from kallithea.lib.annotate import annotate_highlight -from kallithea.lib.utils import get_custom_lexer +from kallithea.lib.pygmentsutils import get_custom_lexer from kallithea.lib.utils2 import str2bool, safe_unicode, safe_str, \ time_to_datetime, AttributeDict, safe_int, MENTIONS_REGEX from kallithea.lib.markup_renderer import url_re diff --git a/kallithea/lib/pygmentsutils.py b/kallithea/lib/pygmentsutils.py --- a/kallithea/lib/pygmentsutils.py +++ b/kallithea/lib/pygmentsutils.py @@ -78,3 +78,15 @@ def get_index_filenames(): filenames.append(f) return filenames + + +def get_custom_lexer(extension): + """ + returns a custom lexer if it's defined in rcextensions module, or None + if there's no custom lexer defined + """ + import kallithea + #check if we didn't define this extension as other lexer + if kallithea.EXTENSIONS and extension in kallithea.EXTENSIONS.EXTRA_LEXERS: + _lexer_name = kallithea.EXTENSIONS.EXTRA_LEXERS[extension] + return lexers.get_lexer_by_name(_lexer_name) diff --git a/kallithea/lib/utils.py b/kallithea/lib/utils.py --- a/kallithea/lib/utils.py +++ b/kallithea/lib/utils.py @@ -580,19 +580,6 @@ def load_rcextensions(root_path): # setattr(EXT, k, getattr(rcextensions, k)) -def get_custom_lexer(extension): - """ - returns a custom lexer if it's defined in rcextensions module, or None - if there's no custom lexer defined - """ - import kallithea - from pygments import lexers - #check if we didn't define this extension as other lexer - if kallithea.EXTENSIONS and extension in kallithea.EXTENSIONS.EXTRA_LEXERS: - _lexer_name = kallithea.EXTENSIONS.EXTRA_LEXERS[extension] - return lexers.get_lexer_by_name(_lexer_name) - - #============================================================================== # TEST FUNCTIONS AND CREATORS #==============================================================================