##// END OF EJS Templates
helpers: fixed some errors on helpers, and removed dead code.
marcink -
r254:339501a7 default
parent child Browse files
Show More
@@ -438,15 +438,17 b' def get_matching_line_offsets(lines, ter'
438 :param max_lines: cut off for lines of interest
438 :param max_lines: cut off for lines of interest
439 eg.
439 eg.
440
440
441 >>> get_matching_line_offsets('''
441 text = '''
442 words words words
442 words words words
443 words words words
443 words words words
444 some text some
444 some text some
445 words words words
445 words words words
446 words words words
446 words words words
447 text here what
447 text here what
448 ''', 'text', context=1)
448 '''
449 get_matching_line_offsets(text, 'text', context=1)
449 {3: [(5, 9)], 6: [(0, 4)]]
450 {3: [(5, 9)], 6: [(0, 4)]]
451
450 """
452 """
451 matching_lines = {}
453 matching_lines = {}
452 phrases = [normalize_text_for_matching(phrase)
454 phrases = [normalize_text_for_matching(phrase)
@@ -460,6 +462,7 b' text here what'
460
462
461 return matching_lines
463 return matching_lines
462
464
465
463 def get_lexer_safe(mimetype=None, filepath=None):
466 def get_lexer_safe(mimetype=None, filepath=None):
464 """
467 """
465 Tries to return a relevant pygments lexer using mimetype/filepath name,
468 Tries to return a relevant pygments lexer using mimetype/filepath name,
@@ -470,7 +473,7 b' def get_lexer_safe(mimetype=None, filepa'
470 if mimetype:
473 if mimetype:
471 lexer = get_lexer_for_mimetype(mimetype)
474 lexer = get_lexer_for_mimetype(mimetype)
472 if not lexer:
475 if not lexer:
473 lexer = get_lexer_for_filename(path)
476 lexer = get_lexer_for_filename(filepath)
474 except pygments.util.ClassNotFound:
477 except pygments.util.ClassNotFound:
475 pass
478 pass
476
479
@@ -675,11 +678,6 b' def _shorten_commit_id(commit_id):'
675 return commit_id[:def_len]
678 return commit_id[:def_len]
676
679
677
680
678 def get_repo_id_from_name(repo_name):
679 repo = get_by_repo_name(repo_name)
680 return repo.repo_id
681
682
683 def show_id(commit):
681 def show_id(commit):
684 """
682 """
685 Configurable function that shows ID
683 Configurable function that shows ID
@@ -858,7 +856,7 b' def desc_stylize(value):'
858 value = re.sub(r'\[(lang|language)\ \=\>\ *([a-zA-Z\-\/\#\+]*)\]',
856 value = re.sub(r'\[(lang|language)\ \=\>\ *([a-zA-Z\-\/\#\+]*)\]',
859 '<div class="metatag" tag="lang">\\2</div>', value)
857 '<div class="metatag" tag="lang">\\2</div>', value)
860 value = re.sub(r'\[([a-z]+)\]',
858 value = re.sub(r'\[([a-z]+)\]',
861 '<div class="metatag" tag="\\1">\\1</div>', value)
859 '<div class="metatag" tag="\\1">\\1</div>', value)
862
860
863 return value
861 return value
864
862
@@ -883,7 +881,7 b' def escaped_stylize(value):'
883 value = re.sub(r'\[(lang|language)\ \=\&gt;\ *([a-zA-Z\-\/\#\+]*)\]',
881 value = re.sub(r'\[(lang|language)\ \=\&gt;\ *([a-zA-Z\-\/\#\+]*)\]',
884 '<div class="metatag" tag="lang">\\2</div>', value)
882 '<div class="metatag" tag="lang">\\2</div>', value)
885 value = re.sub(r'\[([a-z]+)\]',
883 value = re.sub(r'\[([a-z]+)\]',
886 '<div class="metatag" tag="\\1">\\1</div>', value)
884 '<div class="metatag" tag="\\1">\\1</div>', value)
887
885
888 return value
886 return value
889
887
General Comments 0
You need to be logged in to leave comments. Login now