Show More
@@ -438,15 +438,17 b' def get_matching_line_offsets(lines, ter' | |||
|
438 | 438 | :param max_lines: cut off for lines of interest |
|
439 | 439 | eg. |
|
440 | 440 | |
|
441 | >>> get_matching_line_offsets(''' | |
|
442 | words words words | |
|
443 | words words words | |
|
444 | some text some | |
|
445 | words words words | |
|
446 | words words words | |
|
447 | text here what | |
|
448 | ''', 'text', context=1) | |
|
441 | text = ''' | |
|
442 | words words words | |
|
443 | words words words | |
|
444 | some text some | |
|
445 | words words words | |
|
446 | words words words | |
|
447 | text here what | |
|
448 | ''' | |
|
449 | get_matching_line_offsets(text, 'text', context=1) | |
|
449 | 450 | {3: [(5, 9)], 6: [(0, 4)]] |
|
451 | ||
|
450 | 452 | """ |
|
451 | 453 | matching_lines = {} |
|
452 | 454 | phrases = [normalize_text_for_matching(phrase) |
@@ -460,6 +462,7 b' text here what' | |||
|
460 | 462 | |
|
461 | 463 | return matching_lines |
|
462 | 464 | |
|
465 | ||
|
463 | 466 | def get_lexer_safe(mimetype=None, filepath=None): |
|
464 | 467 | """ |
|
465 | 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 | 473 | if mimetype: |
|
471 | 474 | lexer = get_lexer_for_mimetype(mimetype) |
|
472 | 475 | if not lexer: |
|
473 | lexer = get_lexer_for_filename(path) | |
|
476 | lexer = get_lexer_for_filename(filepath) | |
|
474 | 477 | except pygments.util.ClassNotFound: |
|
475 | 478 | pass |
|
476 | 479 | |
@@ -675,11 +678,6 b' def _shorten_commit_id(commit_id):' | |||
|
675 | 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 | 681 | def show_id(commit): |
|
684 | 682 | """ |
|
685 | 683 | Configurable function that shows ID |
@@ -858,7 +856,7 b' def desc_stylize(value):' | |||
|
858 | 856 | value = re.sub(r'\[(lang|language)\ \=\>\ *([a-zA-Z\-\/\#\+]*)\]', |
|
859 | 857 | '<div class="metatag" tag="lang">\\2</div>', value) |
|
860 | 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 | 861 | return value |
|
864 | 862 | |
@@ -883,7 +881,7 b' def escaped_stylize(value):' | |||
|
883 | 881 | value = re.sub(r'\[(lang|language)\ \=\>\ *([a-zA-Z\-\/\#\+]*)\]', |
|
884 | 882 | '<div class="metatag" tag="lang">\\2</div>', value) |
|
885 | 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 | 886 | return value |
|
889 | 887 |
General Comments 0
You need to be logged in to leave comments.
Login now