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
6baaa5bb
Commit
6baaa5bb
authored
May 10, 2012
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix newlines escaping
parent
3a1e89ef
Hide 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 @
6baaa5bb
...
@@ -91,7 +91,7 @@ class Compressor(object):
...
@@ -91,7 +91,7 @@ class Compressor(object):
base_path
=
self
.
base_path
(
paths
)
base_path
=
self
.
base_path
(
paths
)
for
path
in
paths
:
for
path
in
paths
:
contents
=
self
.
read_file
(
path
)
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
)
contents
=
re
.
sub
(
r"'"
,
"
\\
'"
,
contents
)
name
=
self
.
template_name
(
path
,
base_path
)
name
=
self
.
template_name
(
path
,
base_path
)
compiled
+=
"
%
s['
%
s'] =
%
s('
%
s');
\n
"
%
(
compiled
+=
"
%
s['
%
s'] =
%
s('
%
s');
\n
"
%
(
...
...
tests/tests/compressor.py
View file @
6baaa5bb
...
@@ -71,12 +71,12 @@ class CompressorTest(TestCase):
...
@@ -71,12 +71,12 @@ class CompressorTest(TestCase):
def
test_compile_templates
(
self
):
def
test_compile_templates
(
self
):
templates
=
self
.
compressor
.
compile_templates
([
'templates/photo/list.jst'
])
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"> <img src="<
%%
= src
%%
>" /> <div class="caption"> <
%%
= caption
%%
> </div></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
=
self
.
compressor
.
compile_templates
([
'templates/video/detail.jst'
,
'templates/video/detail.jst'
,
'templates/photo/detail.jst'
'templates/photo/detail.jst'
])
])
self
.
assertEqual
(
templates
,
"""window.JST = window.JST || {};
\n
%
s
\n
window.JST[
'video_detail'] = template('<div class="video"> <video src="<
%%
= src
%%
>" /> <div class="caption"> <
%%
= description
%%
> </div></div>');
\n
window.JST[
\'
photo_detail
\'
] = template(
\'
<div class="photo"> <img src="<
%%
= src
%%
>" /> <div class="caption"> <
%%
= caption
%%
> by <
%%
= author
%%
> </div>
</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
):
def
test_embeddable
(
self
):
self
.
assertFalse
(
self
.
compressor
.
embeddable
(
'images/sprite.png'
,
None
))
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