Skip to content

Commit

Permalink
Organize TOC
Browse files Browse the repository at this point in the history
- Dataframes have a dropdown
- enums have a drop
- remove excess operators from datai/o dropdown
  • Loading branch information
cjsha committed Oct 29, 2024
1 parent 3c2860a commit b4dc71f
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 76 deletions.
9 changes: 3 additions & 6 deletions template/partials/class.tmpl.partial
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{{#oe.operator.configureDevice}}
<div class="CAUTION alert alert-danger">
<h5>Caution</h5>
<div class="Important alert alert-info">
<h5>TIP</h5>
<p>
This is a device configuration operator. Device configuration operators are not recommended for interfacing with off-the-shelf ONIX hardware. Use <a class="xref" href="configure.html">aggregate configuration operators</a> to do that instead.
</p>
<p>
To understand the benefits of <a class="xref" href="configure.html">aggregate configuration operators</a>, refer to the <a class="xref" href="device-configure.html">device configuration operators</a> page.
This is a device configuration operator. <a class="xref" href="configure.html">Aggregate configuration operators</a> are recommended in lieu of <a class="xref" href="device-configure.html">device configuration operators</a> for interfacing with Open Ephys Onix hardware.
</p>
</div>
{{/oe.operator.configureDevice}}
Expand Down
156 changes: 86 additions & 70 deletions template/toc.extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,84 +8,100 @@ exports.preTransform = function (model) {
if (model.items[0].name === 'OpenEphys.Onix1'){
if (model.items[0].items){
itemsItemsLength = model.items[0].items.length;
let items = [{
'name': 'Core Operators',
'href' : 'core.html',
'topicHref': 'core.html',
'topicUid': 'core',
'items': []}, {
'name': 'Configuration Operators',
'href' : 'configure.html',
'topicHref': 'configure.html',
'topicUid': 'configure',
'items': []}, {
'name': 'Data I/O Operators',
'href' : 'dataio.html',
'topicHref': 'dataio.html',
'topicUid': 'dataio',
'items': []}, {
'name': 'Other',
'items': [
let items = [
{
'name': 'Core Operators',
'href' : 'core.html',
'topicHref': 'core.html',
'topicUid': 'core',
'items': []
},
{
'name': 'Configuration Operators',
'href' : 'configure.html',
'topicHref': 'configure.html',
'topicUid': 'configure',
'items': []
},
{
'name': 'Data I/O Operators',
'href' : 'dataio.html',
'topicHref': 'dataio.html',
'topicUid': 'dataio',
'items': []
},
{
'name': 'Device Configuration Operators',
'href' : 'device-configure.html',
'topicHref': 'device-configure.html',
'topicUid': 'device-configure',
'items': []
},
{
'name': 'Data Frames',
'href' : 'dataframes.html',
'topicHref': 'dataframes.html',
'topicUid': 'dataframes',
'items': []
},
{
'name': 'Other',
'href' : 'other.html',
'topicHref': 'other.html',
'topicUid': 'other',
'items':
[
{
'name': 'Enums',
'href' : 'enums.html',
'topicHref': 'enums.html',
'topicUid': 'enums',
'items': []
}
]
}
];
for (let i = 0; i < itemsItemsLength; i++)
{
globalYml = '~/api/' + model.items[0].items[i].topicUid + '.yml';
globalModel = model.__global._shared[globalYml];
if (globalModel?.type === 'class' || globalModel?.type === 'struct')
{
if (model.items[0].items[i].name.includes('CreateContext') || model.items[0].items[i].name.includes('StartAcquisition'))
{
'name': 'Device Configuration Operators',
'href' : 'device-configure.html',
'topicHref': 'device-configure.html',
'topicUid': 'device-configure',
'items': [],
items[0].items.push(model.items[0].items[i]);
}
]
}];
for (let i = 0; i < itemsItemsLength; i++) {
globalYml = '~/api/' + model.items[0].items[i].topicUid + '.yml';
if (model.items[0].items[i].name.includes('Frame') ||
model.items[0].items[i].name.includes('DeviceFactory') ||
model.items[0].items[i].name.includes('ContextTask') ||
model.items[0].items[i].name.includes('DeviceNameConverter') ||
model.items[0].items[i].name.includes('ConfigureDS90UB9x') ||
model.items[0].items[i].name.includes('ConfigureFmcLinkController') ||
model.items[0].items[i].name.includes('DeviceContext') ||
model.items[0].items[i].name.includes('NeuropixelsV2QuadShankElectrode') ||
model.items[0].items[i].name.includes('NeuropixelsV2QuadShankProbeConfiguration') ||
model.items[0].items[i].name.includes('NeuropixelsV1eAdc')){
model.items[0].items[i].hide = true;
}
else if (model.__global._shared[globalYml] && model.__global._shared[globalYml].type === 'enum') {
model.items[0].items[i].hide = true;
}
else {
if (model.__global._shared[globalYml] && model.__global._shared[globalYml].type === 'class'){
const inheritanceLength = model.__global._shared[globalYml].inheritance.length;
device = false;
hub = false;
for (let j = 0; j < inheritanceLength; j++){
if (model.__global._shared[globalYml].inheritance[j].uid === 'OpenEphys.Onix1.SingleDeviceFactory'){
device = true;
}
else if (model.__global._shared[globalYml].inheritance[j].uid === 'OpenEphys.Onix1.MultiDeviceFactory'){
hub = true;
}
}
if (model.items[0].items[i].name.includes('CreateContext') || model.items[0].items[i].name.includes('StartAcquisition')){
items[0].items.push(model.items[0].items[i]);
}
else if (device){
items[3].items[0].items.push(model.items[0].items[i]);
}
else if (hub){
items[1].items.push(model.items[0].items[i]);
}
else {
items[2].items.push(model.items[0].items[i]);
}
else if (globalModel?.inheritance.some(inherited => inherited.uid === 'OpenEphys.Onix1.MultiDeviceFactory'))
{
items[1].items.push(model.items[0].items[i]);
}
else if (globalModel?.inheritance.some(inherited => inherited.uid === 'OpenEphys.Onix1.SingleDeviceFactory'))
{
items[3].items.push(model.items[0].items[i]);
}
else if ((globalModel.syntax?.content[0].value.includes('ElementCategory.Source') ||
globalModel.syntax?.content[0].value.includes('ElementCategory.Sink') ||
globalModel?.inheritance.some(inherited => inherited.uid.includes('Bonsai.Source')) ||
globalModel?.inheritance.some(inherited => inherited.uid.includes('Bonsai.Sink'))) &&
!globalModel.syntax?.content[0].value.includes('abstract'))
{
items[2].items.push(model.items[0].items[i]);
}
else if (model.items[0].items[i].name.includes('ContextTask') ||
model.items[0].items[i].name.includes('OutputClockParameters') ||
globalModel?.inheritance.some(inherited => inherited.uid === 'OpenEphys.Onix1.DataFrame' || inherited.uid === 'OpenEphys.Onix1.BufferedDataFrame'))
{
items[4].items.push(model.items[0].items[i]);
}
}
else if (globalModel && globalModel.type === 'enum')
{
items[5].items[0].items.push(model.items[0].items[i]);
}
}
model.items[0].items = items;
}
}
// if (model.items[1].name === 'OpenEphys.Onix1.Design'){
// model.items.splice(1, 1);
// }
return model;
}

Expand Down

0 comments on commit b4dc71f

Please sign in to comment.