allow for passing file to Ox.SyntaxHighlighter
This commit is contained in:
parent
6fcac07ee9
commit
f473100875
1 changed files with 10 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
Ox.SyntaxHighlighter <f> Syntax Highlighter
|
||||
([options[, self]]) -> <o:Ox.Element> Syntax Highlighter
|
||||
options <o> Options
|
||||
file <s|''> JavaScript file (alternative to `source` option)
|
||||
lineLength <n|0> If larger than zero, show edge of page
|
||||
offset <n|1> First line number
|
||||
replace <[[]]|[]> Array of replacements
|
||||
|
@ -24,6 +25,7 @@ Ox.SyntaxHighlighter = function(options, self) {
|
|||
self = self || {};
|
||||
var that = Ox.Element({}, self)
|
||||
.defaults({
|
||||
file: '',
|
||||
lineLength: 0,
|
||||
offset: 1,
|
||||
replace: [],
|
||||
|
@ -39,7 +41,14 @@ Ox.SyntaxHighlighter = function(options, self) {
|
|||
.update(renderSource)
|
||||
.addClass('OxSyntaxHighlighter');
|
||||
|
||||
renderSource();
|
||||
if (self.options.file) {
|
||||
Ox.get(self.options.file, function(source) {
|
||||
self.options.source = source;
|
||||
renderSource();
|
||||
});
|
||||
} else {
|
||||
renderSource();
|
||||
}
|
||||
|
||||
function renderSource() {
|
||||
var $lineNumbers, $line, $source, width,
|
||||
|
|
Loading…
Reference in a new issue