Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
008ee60e
Commit
008ee60e
authored
Mar 02, 2015
by
kidpixo
Committed by
Bram Schoenmakers
May 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added color coding for
- METADATA (key:value pairs) - LINK (
foo://bar.bla
)
parent
cb24bc40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
topydo/lib/PrettyPrinterFilter.py
topydo/lib/PrettyPrinterFilter.py
+19
-10
No files found.
topydo/lib/PrettyPrinterFilter.py
View file @
008ee60e
...
...
@@ -32,13 +32,16 @@ class PrettyPrinterFilter(object):
return
p_todo_str
PRIORITY_COLORS
=
{
'A'
:
'
\
033
[36m'
,
# cyan
'B'
:
'
\
033
[33m'
,
# yellow
'C'
:
'
\
033
[34m'
# blue
'A'
:
'
\
033
[
0;
36m'
,
# cyan
'B'
:
'
\
033
[
0;
33m'
,
# yellow
'C'
:
'
\
033
[
0;
34m'
# blue
}
PROJECT_COLOR
=
'
\
033
[31m'
# red
NEUTRAL_COLOR
=
'
\
033
[0m'
PROJECT_COLOR
=
'
\
033
[1;31m'
# color for + keyword : red
CONTEXT_COLOR
=
'
\
033
[1;35m'
# color for @ keyword : magenta
METADATA_COLOR
=
'
\
033
[1;32m'
# color for @ metadata : green
LINK_COLOR
=
'
\
033
[4;36m'
# color for @ links : cyan/underline
NEUTRAL_COLOR
=
'
\
033
[0m'
class
PrettyPrinterColorFilter
(
PrettyPrinterFilter
):
"""
...
...
@@ -57,15 +60,21 @@ class PrettyPrinterColorFilter(PrettyPrinterFilter):
except
KeyError
:
pass
p_todo_str
=
color
+
p_todo_str
+
NEUTRAL_COLOR
p_todo_str
=
'%s%s%s'
%
(
color
,
p_todo_str
,
NEUTRAL_COLOR
)
if
config
().
highlight_projects_contexts
():
p_todo_str
=
re
.
sub
(
r'\
B(
\+|@)(\
S*
\w)'
,
PROJECT_COLOR
+
r'\
g<
0>'
+
color
,
#PROJECT_COLOR + r'\g<0>' + color,
lambda
m
:
(
CONTEXT_COLOR
if
m
.
group
(
0
)[
0
]
==
"+"
else
PROJECT_COLOR
)
+
m
.
group
(
0
)
+
color
,
p_todo_str
)
p_todo_str
+=
NEUTRAL_COLOR
p_todo_str
=
re
.
sub
(
r'\
w(
\S*:[^/\
s]
\S*)\
w
',METADATA_COLOR+r'
\
g
<
0
>
'+color,p_todo_str)
# add LINK_COLOR to anything like : (one group od charater and a :)(// and non whitespace chars)
p_todo_str = re.sub(r'
\
s
(
\
w
*
:){
1
}(
//
\
S
*
\
w
)
','
'+LINK_COLOR+r'
\
1
\
2
'+color,p_todo_str)
p_todo_str += NEUTRAL_COLOR
# chnge any group of reduntant multiple NEUTRAL_GROUP occurrence to only one
p_todo_str = re.sub(r'
(
'+re.escape(NEUTRAL_COLOR)+'
)
+
',NEUTRAL_COLOR,p_todo_str)
return p_todo_str
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment