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
d3962ecd
Commit
d3962ecd
authored
Aug 17, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated CodeMirror modes for better syntax highlighting.
parent
0fbfaf61
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
170 additions
and
120 deletions
+170
-120
common/static/js/vendor/CodeMirror/mitx_markdown.js
+103
-112
common/static/js/vendor/CodeMirror/xml.js
+67
-8
No files found.
common/static/js/vendor/CodeMirror/mitx_markdown.js
View file @
d3962ecd
This diff is collapsed.
Click to expand it.
common/static/js/vendor/CodeMirror/xml.js
View file @
d3962ecd
CodeMirror
.
defineMode
(
"xml"
,
function
(
config
,
parserConfig
)
{
var
indentUnit
=
config
.
indentUnit
;
var
Kludges
=
parserConfig
.
htmlMode
?
{
autoSelfClosers
:
{
"br"
:
true
,
"img"
:
true
,
"hr"
:
true
,
"link"
:
true
,
"input"
:
true
,
"meta"
:
true
,
"col"
:
true
,
"frame"
:
true
,
"base"
:
true
,
"area"
:
true
},
autoSelfClosers
:
{
'area'
:
true
,
'base'
:
true
,
'br'
:
true
,
'col'
:
true
,
'command'
:
true
,
'embed'
:
true
,
'frame'
:
true
,
'hr'
:
true
,
'img'
:
true
,
'input'
:
true
,
'keygen'
:
true
,
'link'
:
true
,
'meta'
:
true
,
'param'
:
true
,
'source'
:
true
,
'track'
:
true
,
'wbr'
:
true
},
implicitlyClosed
:
{
'dd'
:
true
,
'li'
:
true
,
'optgroup'
:
true
,
'option'
:
true
,
'p'
:
true
,
'rp'
:
true
,
'rt'
:
true
,
'tbody'
:
true
,
'td'
:
true
,
'tfoot'
:
true
,
'th'
:
true
,
'tr'
:
true
},
contextGrabbers
:
{
'dd'
:
{
'dd'
:
true
,
'dt'
:
true
},
'dt'
:
{
'dd'
:
true
,
'dt'
:
true
},
'li'
:
{
'li'
:
true
},
'option'
:
{
'option'
:
true
,
'optgroup'
:
true
},
'optgroup'
:
{
'optgroup'
:
true
},
'p'
:
{
'address'
:
true
,
'article'
:
true
,
'aside'
:
true
,
'blockquote'
:
true
,
'dir'
:
true
,
'div'
:
true
,
'dl'
:
true
,
'fieldset'
:
true
,
'footer'
:
true
,
'form'
:
true
,
'h1'
:
true
,
'h2'
:
true
,
'h3'
:
true
,
'h4'
:
true
,
'h5'
:
true
,
'h6'
:
true
,
'header'
:
true
,
'hgroup'
:
true
,
'hr'
:
true
,
'menu'
:
true
,
'nav'
:
true
,
'ol'
:
true
,
'p'
:
true
,
'pre'
:
true
,
'section'
:
true
,
'table'
:
true
,
'ul'
:
true
},
'rp'
:
{
'rp'
:
true
,
'rt'
:
true
},
'rt'
:
{
'rp'
:
true
,
'rt'
:
true
},
'tbody'
:
{
'tbody'
:
true
,
'tfoot'
:
true
},
'td'
:
{
'td'
:
true
,
'th'
:
true
},
'tfoot'
:
{
'tbody'
:
true
},
'th'
:
{
'td'
:
true
,
'th'
:
true
},
'thead'
:
{
'tbody'
:
true
,
'tfoot'
:
true
},
'tr'
:
{
'tr'
:
true
}
},
doNotIndent
:
{
"pre"
:
true
},
allowUnquoted
:
true
,
allowMissing
:
false
}
:
{
autoSelfClosers
:
{},
doNotIndent
:
{},
allowUnquoted
:
false
,
allowMissing
:
false
};
}
:
{
autoSelfClosers
:
{},
implicitlyClosed
:
{},
contextGrabbers
:
{},
doNotIndent
:
{},
allowUnquoted
:
false
,
allowMissing
:
false
};
var
alignCDATA
=
parserConfig
.
alignCDATA
;
// Return variables for tokenizers
...
...
@@ -162,7 +194,12 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
}
else
if
(
type
==
"closeTag"
)
{
var
err
=
false
;
if
(
curState
.
context
)
{
err
=
curState
.
context
.
tagName
!=
tagName
;
if
(
curState
.
context
.
tagName
!=
tagName
)
{
if
(
Kludges
.
implicitlyClosed
.
hasOwnProperty
(
curState
.
context
.
tagName
.
toLowerCase
()))
{
popContext
();
}
err
=
!
curState
.
context
||
curState
.
context
.
tagName
!=
tagName
;
}
}
else
{
err
=
true
;
}
...
...
@@ -174,9 +211,15 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
function
endtag
(
startOfLine
)
{
return
function
(
type
)
{
if
(
type
==
"selfcloseTag"
||
(
type
==
"endTag"
&&
Kludges
.
autoSelfClosers
.
hasOwnProperty
(
curState
.
tagName
.
toLowerCase
())))
(
type
==
"endTag"
&&
Kludges
.
autoSelfClosers
.
hasOwnProperty
(
curState
.
tagName
.
toLowerCase
())))
{
maybePopContext
(
curState
.
tagName
.
toLowerCase
());
return
cont
();
}
if
(
type
==
"endTag"
)
{
maybePopContext
(
curState
.
tagName
.
toLowerCase
());
pushContext
(
curState
.
tagName
,
startOfLine
);
return
cont
();
if
(
type
==
"endTag"
)
{
pushContext
(
curState
.
tagName
,
startOfLine
);
return
cont
();
}
}
return
cont
();
};
}
...
...
@@ -188,6 +231,20 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
return
cont
(
arguments
.
callee
);
}
}
function
maybePopContext
(
nextTagName
)
{
var
parentTagName
;
while
(
true
)
{
if
(
!
curState
.
context
)
{
return
;
}
parentTagName
=
curState
.
context
.
tagName
.
toLowerCase
();
if
(
!
Kludges
.
contextGrabbers
.
hasOwnProperty
(
parentTagName
)
||
!
Kludges
.
contextGrabbers
[
parentTagName
].
hasOwnProperty
(
nextTagName
))
{
return
;
}
popContext
();
}
}
function
attributes
(
type
)
{
if
(
type
==
"word"
)
{
setStyle
=
"attribute"
;
return
cont
(
attribute
,
attributes
);}
...
...
@@ -255,7 +312,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
if
(
a
.
indented
!=
b
.
indented
||
a
.
tokenize
!=
b
.
tokenize
)
return
false
;
for
(
var
ca
=
a
.
context
,
cb
=
b
.
context
;
;
ca
=
ca
.
prev
,
cb
=
cb
.
prev
)
{
if
(
!
ca
||
!
cb
)
return
ca
==
cb
;
if
(
ca
.
tagName
!=
cb
.
tagName
)
return
false
;
if
(
ca
.
tagName
!=
cb
.
tagName
||
ca
.
indent
!=
cb
.
indent
)
return
false
;
}
},
...
...
@@ -263,5 +320,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
};
});
CodeMirror
.
defineMIME
(
"text/xml"
,
"xml"
);
CodeMirror
.
defineMIME
(
"application/xml"
,
"xml"
);
CodeMirror
.
defineMIME
(
"text/html"
,
{
name
:
"xml"
,
htmlMode
:
true
});
if
(
!
CodeMirror
.
mimeModes
.
hasOwnProperty
(
"text/html"
))
CodeMirror
.
defineMIME
(
"text/html"
,
{
name
:
"xml"
,
htmlMode
:
true
});
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