-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated full-ide mode in emacs-purpose
- Loading branch information
1 parent
ab99409
commit 9ad678a
Showing
2 changed files
with
150 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#! /usr/bin/python | ||
|
||
import sys | ||
import re | ||
import os | ||
|
||
|
||
def run(): | ||
lines = sys.stdin.readlines() | ||
current_todo = '' | ||
|
||
todo = [] | ||
lines = list(filter(None, [line.strip() for line in lines])) | ||
for line in lines: | ||
matches = re.search(r'^(\d+):\s*(.*)$', line) | ||
if not matches: | ||
current_file = line | ||
continue | ||
line_in_file = matches.group(1) | ||
description = matches.group(2) | ||
importance = re.search(r'\@tod(o+)', description) | ||
importance = len(importance.group(1)) | ||
description = re.sub(r'.*\@todo+\s*', '', description) | ||
if '[[file:{file}::{line}]]'.format(file=current_file, line=line_in_file) in current_todo: | ||
continue | ||
todo.append({ | ||
'importance': importance, | ||
'description': description, | ||
'file': current_file, | ||
'line': line_in_file | ||
}) | ||
todo.sort(key=lambda x: x['importance'], reverse=True) | ||
todo_buffer = [] | ||
for i, _todo in enumerate(todo): | ||
todo_item = '''{description} | ||
[[file:{file}::{line}]] | ||
'''.format(i=i+1, **_todo) | ||
todo_buffer.append(todo_item) | ||
print '{}{}'.format(current_todo, ''.join(todo_buffer)) | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters