Changeset 118
- Timestamp:
- 20-01-2008 22:26:28 (10 months ago)
- Author:
- s0undt3ch
- Message:
-
Made lineanchor links unique, that was they can also be used on the paste's listing, no need to create seperate caches.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r117
|
r118
|
|
| 3 | 3 | from pygments.formatters import HtmlFormatter |
| 4 | 4 | from genshi import XML |
| 5 | | import operator |
| 6 | 5 | import StringIO |
| 7 | 6 | from pylons.decorators.cache import beaker_cache |
| … |
… |
|
| 93 | 92 | num += 1 |
| 94 | 93 | |
| | 94 | |
| 95 | 95 | formatter = PastieHtmlFormatter(linenos=True, cssclass="syntax", |
| 96 | 96 | encoding='utf-8', lineanchors='line', |
| … |
… |
|
| 103 | 103 | else: |
| 104 | 104 | diff_to_id = None |
| | 105 | |
| 105 | 106 | @beaker_cache(type='memory', expire='never') |
| 106 | 107 | def cached_wrapper(paste_id=None, truncate_lines=None, diff_to_id=None): |
| … |
… |
|
| 118 | 119 | if diff_to: |
| 119 | 120 | lexex = get_lexer_by_name('diff') |
| | 121 | |
| | 122 | formatter.lineanchors='paste-%d-line' % paste_id |
| 120 | 123 | return XML(highlight(source, lexer, formatter).decode('utf-8')) |
| 121 | 124 | return cached_wrapper(code.id, truncate_lines, diff_to_id) |
Download in other formats:
|
|