Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
ade8558d
Commit
ade8558d
authored
May 10, 2012
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ahem
parent
6baaa5bb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
pipeline/compressors/__init__.py
+1
-1
tests/tests/compressor.py
+2
-2
No files found.
pipeline/compressors/__init__.py
View file @
ade8558d
...
...
@@ -91,7 +91,7 @@ class Compressor(object):
base_path
=
self
.
base_path
(
paths
)
for
path
in
paths
:
contents
=
self
.
read_file
(
path
)
contents
=
re
.
sub
(
r"\r?\n"
,
"
\\
n"
,
contents
)
contents
=
re
.
sub
(
r"\r?\n"
,
"
\\
\\
n"
,
contents
)
contents
=
re
.
sub
(
r"'"
,
"
\\
'"
,
contents
)
name
=
self
.
template_name
(
path
,
base_path
)
compiled
+=
"
%
s['
%
s'] =
%
s('
%
s');
\n
"
%
(
...
...
tests/tests/compressor.py
View file @
ade8558d
...
...
@@ -71,12 +71,12 @@ class CompressorTest(TestCase):
def
test_compile_templates
(
self
):
templates
=
self
.
compressor
.
compile_templates
([
'templates/photo/list.jst'
])
self
.
assertEquals
(
templates
,
"""window.JST = window.JST || {};
\n
%
s
\n
window.JST[
\'
list
\'
] = template(
\'
<div class="photo">
\
n
<img src="<
%%
= src
%%
>" />
\n
<div class="caption">
\n
<
%%
= caption
%%
>
\n
</div>
\n
</div>
\'
);
\n
"""
%
TEMPLATE_FUNC
)
self
.
assertEquals
(
templates
,
"""window.JST = window.JST || {};
\n
%
s
\n
window.JST[
\'
list
\'
] = template(
\'
<div class="photo">
\
\
n <img src="<
%%
= src
%%
>" />
\\
n <div class="caption">
\\
n <
%%
= caption
%%
>
\\
n </div>
\
\
n</div>
\'
);
\n
"""
%
TEMPLATE_FUNC
)
templates
=
self
.
compressor
.
compile_templates
([
'templates/video/detail.jst'
,
'templates/photo/detail.jst'
])
self
.
assertEqual
(
templates
,
"""window.JST = window.JST || {};
\n
%
s
\n
window.JST[
\'
video_detail
\'
] = template(
\'
<div class="video">
\
n
<video src="<
%%
= src
%%
>" />
\n
<div class="caption">
\n
<
%%
= description
%%
>
\n
</div>
\n
</div>
\'
);
\n
window.JST[
\'
photo_detail
\'
] = template(
\'
<div class="photo">
\n
<img src="<
%%
= src
%%
>" />
\n
<div class="caption">
\n
<
%%
= caption
%%
> by <
%%
= author
%%
>
\n
</div>
\n
</div>
\'
);
\n
"""
%
TEMPLATE_FUNC
)
self
.
assertEqual
(
templates
,
"""window.JST = window.JST || {};
\n
%
s
\n
window.JST[
\'
video_detail
\'
] = template(
\'
<div class="video">
\
\
n <video src="<
%%
= src
%%
>" />
\\
n <div class="caption">
\\
n <
%%
= description
%%
>
\\
n </div>
\\
n</div>
\'
);
\n
window.JST[
\'
photo_detail
\'
] = template(
\'
<div class="photo">
\\
n <img src="<
%%
= src
%%
>" />
\\
n <div class="caption">
\\
n <
%%
= caption
%%
> by <
%%
= author
%%
>
\\
n </div>
\
\
n</div>
\'
);
\n
"""
%
TEMPLATE_FUNC
)
def
test_embeddable
(
self
):
self
.
assertFalse
(
self
.
compressor
.
embeddable
(
'images/sprite.png'
,
None
))
...
...
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