1
0
Fork 0
forked from 0x2620/oxjs

allow for replacement function in DocPanel and DocPage

This commit is contained in:
rolux 2012-04-06 14:24:17 +02:00
commit e9f6751748
3 changed files with 38 additions and 28 deletions

View file

@ -202,22 +202,30 @@ Ox.load(function() {
re: {
code: new RegExp(
'<span class="OxIdentifier">Ox</span>'
+ '(<span class="OxOperator">\.</span>'
+ '<span class="OxIdentifier">UI</span>)?'
+ '<span class="OxOperator">\.</span>'
+ '<span class="OxIdentifier">([\\$\\w]+)<\/span>',
'g'
),
comment: /\b(Ox\.\w+)\b/g
code: [
new RegExp(
'<span class="OxIdentifier">Ox</span>'
+ '(<span class="OxOperator">\.</span>'
+ '<span class="OxIdentifier">UI</span>)?'
+ '<span class="OxOperator">\.</span>'
+ '<span class="OxIdentifier">([\\$\\w]+)<\/span>',
'g'
),
function (str) {
return '<a href="#doc/' + Ox.stripTags(str)
+ '" class="doclink">' + str + '</a>';
}
],
comment: [
/\b(Ox\.\w+)\b/g,
'<a href="#doc/$1" class="OxMonospace doclink">$1</a>'
]
},
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 '<a href="#doc/' + Ox.stripTags(str)
+ '" class="doclink">' + str + '</a>';
}
]],
replaceComment: [[
app.re.comment,
'<a href="#doc/$1" class="OxMonospace doclink">$1</a>'
]],
replaceCode: [app.re.code],
replaceComment: [app.re.comment],
selected: ''
})
.bindEvent({
@ -323,14 +323,18 @@ Ox.load(function() {
sections: function() {
var $element = (Ox.UI ? $ : Ox.$)('<div>').addClass('ui sections');
[
'about', 'readme', 'examples', 'documentation',
'downloads', 'development', 'contact'
'about', 'readme', 'examples', 'doc',
'downloads', 'dev', 'contact'
].forEach(function(section, i) {
Ox.$('<span>')
.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');