diff --git a/index.js b/index.js index 41e0a432..c90d8e5f 100644 --- a/index.js +++ b/index.js @@ -202,22 +202,30 @@ Ox.load(function() { re: { - code: new RegExp( - 'Ox' - + '(\.' - + 'UI)?' - + '\.' - + '([\\$\\w]+)<\/span>', - 'g' - ), - - comment: /\b(Ox\.\w+)\b/g + code: [ + new RegExp( + 'Ox' + + '(\.' + + 'UI)?' + + '\.' + + '([\\$\\w]+)<\/span>', + 'g' + ), + function (str) { + return '' + str + ''; + } + ], + comment: [ + /\b(Ox\.\w+)\b/g, + '$1' + ] }, ui: { - documentation: function() { + doc: function() { return Ox.DocPanel({ files: app.data.documentation, getModule: function(item) { @@ -228,7 +236,8 @@ Ox.load(function() { var file = item.file.replace(/^dev\//, ''); return item.section || file.split('/')[2].split('.')[0]; }, - path: 'dev/' + path: 'dev/', + replace: [app.re.code], }); }, @@ -237,17 +246,8 @@ Ox.load(function() { examples: app.data.examples, keywords: /\b(Ox\.[\w]+)\b/g, path: 'examples/', - replaceCode: [[ - app.re.code, - function (str) { - return '' + str + ''; - } - ]], - replaceComment: [[ - app.re.comment, - '$1' - ]], + replaceCode: [app.re.code], + replaceComment: [app.re.comment], selected: '' }) .bindEvent({ @@ -323,14 +323,18 @@ Ox.load(function() { sections: function() { var $element = (Ox.UI ? $ : Ox.$)('
').addClass('ui sections'); [ - 'about', 'readme', 'examples', 'documentation', - 'downloads', 'development', 'contact' + 'about', 'readme', 'examples', 'doc', + 'downloads', 'dev', 'contact' ].forEach(function(section, i) { Ox.$('') .addClass('button' + ( app.user('section') == section ? ' selected' : '' )) - .html(Ox.toTitleCase(section)) + .html(Ox.toTitleCase( + section == 'doc' ? 'documentation' + : section == 'dev' ? 'development' + : section + )) .bind({ click: function() { app.$ui.sections.children().removeClass('selected'); diff --git a/source/Ox.UI/js/Code/Ox.DocPage.js b/source/Ox.UI/js/Code/Ox.DocPage.js index 12ffbab1..8af6466b 100644 --- a/source/Ox.UI/js/Code/Ox.DocPage.js +++ b/source/Ox.UI/js/Code/Ox.DocPage.js @@ -6,6 +6,7 @@ Ox.DocPage DocPage (options, self) -> DocPage object options Options object item doc item + replace <[[]]|[]> See Ox.SyntaxHighlighter self Shared private variable @*/ Ox.DocPage = function(options, self) { @@ -13,7 +14,8 @@ Ox.DocPage = function(options, self) { self = self || {}; var that = Ox.Element({}, self) .defaults({ - item: {} + item: {}, + replace: [] }) .options(options || {}) .css({ @@ -182,6 +184,7 @@ Ox.DocPage = function(options, self) { ); $elements.push( Ox.SyntaxHighlighter({ + replace: self.options.replace, showLineNumbers: true, // fixme: silly source: item.source.map(function(token) { diff --git a/source/Ox.UI/js/Code/Ox.DocPanel.js b/source/Ox.UI/js/Code/Ox.DocPanel.js index 61752776..fc822258 100644 --- a/source/Ox.UI/js/Code/Ox.DocPanel.js +++ b/source/Ox.UI/js/Code/Ox.DocPanel.js @@ -11,6 +11,7 @@ Ox.DocPanel Documentation Panel getModule returns module for given item getSection returns section for given item path path prefix + replace <[[]]|[]> See Ox.SyntaxHighlighter resizable is resizable resize resize positions size default size @@ -34,6 +35,7 @@ Ox.DocPanel = function(options, self) { return item.section; }, path: '', + replace: [], resizable: true, resize: [128, 256, 384], size: 256 @@ -160,7 +162,8 @@ Ox.DocPanel = function(options, self) { selected = data.ids[0]; if (selected[0] != '_') { self.$page = Ox.DocPage({ - item: getItemByName(selected) + item: getItemByName(selected), + replace: self.options.replace }); that.$element.replaceElement(1, self.$page); that.triggerEvent('select', {