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
a18a95f0
Commit
a18a95f0
authored
Jul 30, 2012
by
Mike Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert blank lines to <br>
parent
e1288eba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
cms/static/grammar.jspeg
+8
-8
common/lib/xmodule/xmodule/js/src/capa/edit.coffee
+10
-1
No files found.
cms/static/grammar.jspeg
View file @
a18a95f0
start
= sections:(StringResponse / NumericalResponse / MultipleChoice / Paragraph / Linebreak+)+
{
var hasKind = function(o) {
return o.hasOwnProperty('type');
}
return sections.filter(hasKind);
}
= sections:(StringResponse / NumericalResponse / MultipleChoice / Paragraph / PreservedLinebreaks)+
StudentProducedResponseIdentifier
= '='
...
...
@@ -76,7 +70,7 @@ Paragraph
Line
= text:Text terminator:Linebreak
{
return text +
terminator
;
return text +
'\n'
;
}
Text
...
...
@@ -88,6 +82,12 @@ Text
OptionalSpaces
= ' '*
PreservedLinebreaks
= terminators:('\n')+
{
return {'type': 'linebreaks', 'count': terminators.length}
}
Linebreak
= ('\n')
...
...
common/lib/xmodule/xmodule/js/src/capa/edit.coffee
View file @
a18a95f0
...
...
@@ -24,6 +24,7 @@ class @CapaDescriptor
try
source
=
@
source_box
.
val
()
+
"
\n
"
result
=
@
parser
.
parse
(
source
)
console
.
log
result
@
outputXML
(
result
)
@
message_box
.
css
{
"display"
:
"none"
}
catch
e
...
...
@@ -37,7 +38,8 @@ class @CapaDescriptor
dom2capa
:
(
node
)
->
capa
=
new
XMLSerializer
().
serializeToString
(
node
)
capa
=
capa
+
""
return
capa
.
replace
(
/<startouttext>/g
,
'<startouttext />'
).
replace
(
/<\/startouttext>/g
,
'<endouttext />'
)
return
capa
.
replace
(
/<startouttext>/g
,
'<startouttext />'
)
.
replace
(
/<\/startouttext>/g
,
'<endouttext />'
)
buildXML
:
(
parsed
)
->
dom_parser
=
new
DOMParser
()
...
...
@@ -54,6 +56,13 @@ class @CapaDescriptor
newel
=
create_text_element
(
section
.
text
)
problem
.
append
(
newel
)
else
if
section
.
type
==
'linebreaks'
text
=
create_text_element
(
''
)
for
i
in
[
0
..
section
.
count
]
by
1
br
=
doc
.
createElement
(
'br'
)
text
.
append
(
br
)
problem
.
append
(
text
)
else
if
section
.
type
==
'multiple_choice'
newel
=
$
(
doc
.
createElement
(
'choiceresponse'
))
...
...
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