Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
e6f64429
Commit
e6f64429
authored
Feb 05, 2016
by
Robert Raposa
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11437 from edx/robrap/markup
Move markup helpers to djangolib
parents
158c4e58
29fe2c7b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
cms/templates/container.html
+1
-1
lms/templates/enrollment/course_enrollment_message.html
+1
-1
openedx/core/djangolib/markup.py
+3
-3
openedx/core/djangolib/tests/test_markup.py
+5
-5
No files found.
cms/templates/container.html
View file @
e6f64429
...
...
@@ -12,7 +12,7 @@ from contentstore.views.helpers import xblock_studio_url, xblock_type_display_na
from
openedx
.
core
.
djangolib
.
js_utils
import
(
dump_js_escaped_json
,
js_escaped_string
)
from
util
.
markup
import
HTML
,
ugettext
as
_
from
openedx
.
core
.
djangolib
.
markup
import
HTML
,
ugettext
as
_
%
>
<
%
block
name=
"title"
>
${xblock.display_name_with_default_escaped} ${xblock_type_display_name(xblock) | h}
</
%
block>
<
%
block
name=
"bodyclass"
>
is-signedin course container view-container
</
%
block>
...
...
lms/templates/enrollment/course_enrollment_message.html
View file @
e6f64429
<
%!
from
util
.
markup
import
ugettext
as
_
%
>
<
%!
from
openedx
.
core
.
djangolib
.
markup
import
ugettext
as
_
%
>
<
%
page
expression_filter=
"h"
/>
% for course_msg in course_enrollment_messages:
<div
class=
"wrapper-msg urgency-high"
>
...
...
common/djangoapps/util
/markup.py
→
openedx/core/djangolib
/markup.py
View file @
e6f64429
...
...
@@ -16,12 +16,12 @@ def ugettext(text):
Use like this in Mako::
<
%
from
util
.markup import ugettext as _
%
>
<
%
from
openedx.core.djangolib
.markup import ugettext as _
%
>
<p>${_("Hello, world!")}</p>
Or with formatting::
<
%
from
util
.markup import HTML, ugettext as _
%
>
<
%
from
openedx.core.djangolib
.markup import HTML, ugettext as _
%
>
${_("Write & send {start}email{end}").format(
start=HTML("<a href='mailto:ned@edx.org'>"),
end=HTML("</a>"),
...
...
@@ -41,7 +41,7 @@ def HTML(html): # pylint: disable=invalid-name
Use this when formatting HTML into other strings::
<
%
from
util
.markup import HTML, ugettext as _
%
>
<
%
from
openedx.core.djangolib
.markup import HTML, ugettext as _
%
>
${_("Write & send {start}email{end}").format(
start=HTML("<a href='mailto:ned@edx.org'>"),
end=HTML("</a>"),
...
...
common/djangoapps/util
/tests/test_markup.py
→
openedx/core/djangolib
/tests/test_markup.py
View file @
e6f64429
# -*- coding: utf-8 -*-
"""
Tests for
util
.markup
Tests for
openedx.core.djangolib
.markup
"""
import
unittest
import
ddt
from
mako.template
import
Template
from
edxmako.template
import
Template
from
util.markup
import
escape
,
HTML
,
ugettext
as
_
,
ungettext
from
openedx.core.djangolib.markup
import
escape
,
HTML
,
ugettext
as
_
,
ungettext
@ddt.ddt
...
...
@@ -54,12 +54,12 @@ class FormatHtmlTest(unittest.TestCase):
# The default_filters used here have to match the ones in edxmako.
template
=
Template
(
"""
<
%
! from
util
.markup import HTML, ugettext as _
%
>
<
%
! from
openedx.core.djangolib
.markup import HTML, ugettext as _
%
>
${_(u"A & {BC}").format(BC=HTML("B & C"))}
"""
,
default_filters
=
[
'decode.utf8'
,
'h'
],
)
out
=
template
.
render
(
{}
)
out
=
template
.
render
()
self
.
assertEqual
(
out
.
strip
(),
u"A & B & C"
)
def
test_ungettext
(
self
):
...
...
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