Skip to content

Commit a2e48fd

Browse files
committed
use _Sidebar order for nsgportal
1 parent 074cd5c commit a2e48fd

13 files changed

+38
-12
lines changed

code/plugins/reformat_plugin.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,36 @@
33
import shutil
44

55
# open a text file ending with .md and append a paragraph to it
6-
def reformat_wiki_pages(filepath, filename, parent, output_file):
7-
with open(filepath) as f:
8-
text = f.read()
9-
append_text = '''---
6+
def reformat_wiki_pages(filepath, filename, parent, output_file, wiki_input_dir=""):
7+
append_text = '''---
108
layout: default
119
title: {filename}
1210
long_title: {filename}
1311
parent: {parent}
1412
grand_parent: Plugins
15-
---
1613
'''.format(filename=filename, parent=parent)
14+
15+
if parent == "nsgportal":
16+
pages = []
17+
# load _Sidebar.md and extract all links from markdown file
18+
with open(os.path.join(wiki_input_dir, '_Sidebar.md')) as f:
19+
lines = f.readlines()
20+
for line in lines:
21+
if line.startswith('*'):
22+
# extract text between square brackets
23+
page = line[line.find('(')+1:line.find(')')]
24+
pages.append(page)
25+
if filename in pages:
26+
order = pages.index(filename)
27+
append_text += 'nav_order: {order}\n'.format(order=order)
28+
29+
append_text += '---\n'
30+
31+
with open(filepath) as f:
32+
text = f.read()
1733
text = append_text + text
18-
with open(output_file, 'w') as out:
19-
out.write(text)
34+
with open(output_file, 'w') as out:
35+
out.write(text)
2036

2137
def reformat_plugin_dir(plugin_input_dir, plugin_name, order, plugin_type='wiki'):
2238
# plugins_output_dir = '/Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins'
@@ -70,7 +86,7 @@ def reformat_plugin_dir(plugin_input_dir, plugin_name, order, plugin_type='wiki'
7086
for root, dirs, files in os.walk(wiki_plugin_input_dir):
7187
for file in files:
7288
if file.endswith('.md') and not file.startswith('index') and not file.startswith('Home'):
73-
reformat_wiki_pages(os.path.join(wiki_plugin_input_dir, file), file.strip('.md'), plugin_name, os.path.join(plugin_output_dir, file))
89+
reformat_wiki_pages(os.path.join(wiki_plugin_input_dir, file), file.strip('.md'), plugin_name, os.path.join(plugin_output_dir, file), wiki_plugin_input_dir)
7490
# main
7591
def main():
7692
if len(sys.argv) != 5:

plugins/nsgportal/Creating-and-managing-a-job-from-pop_nsg-GUI.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Creating-and-managing-a-job-from-pop_nsg-GUI
44
long_title: Creating-and-managing-a-job-from-pop_nsg-GUI
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 8
78
---
89
# Creating and managing a job from pop_nsg GUI
910
In this tutorial we will address the creation and managing of NSG jobs from EEGLAB by using the plugin *nsgportal*. Specifically, the tutorial will focus on performing these tasks from the pop_nsg GUI.

plugins/nsgportal/Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line
44
long_title: Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 9
78
---
89
This tutorial describes in details the process of submitting and managing a job using the command line options in _pop_nsg_.
910

plugins/nsgportal/EEGLAB-plug-ins-on-NSG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: EEGLAB-plug-ins-on-NSG
44
long_title: EEGLAB-plug-ins-on-NSG
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 3
78
---
89
The EEGLAB installation on NSG provides access to most of the EEGLAB plug-ins. See the table below for the list below of plug-in available from EEGLAB at NSG, as well as important links to the use of these plugins
910

plugins/nsgportal/Registering-at-NSG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Registering-at-NSG
44
long_title: Registering-at-NSG
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 1
78
---
89
The first step to using the Open EEGLAB Portal is to create an NSG account [HERE](https://www.nsgportal.org/gest/reg.php) (or by clicking on "Register account" on the NSG home page).
910

plugins/nsgportal/Running-AMICA-on-NSG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ title: Running-AMICA-on-NSG
44
long_title: Running-AMICA-on-NSG
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 11
78
---
89
See this [page](https://github.com/japalmer29/amica/wiki/AMICA#how-to-run-amica-option-2-neuroscience-gateway-nsg) on the AMICA Gihub page.

plugins/nsgportal/Setting-up-the-plug-in.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Setting-up-the-plug-in
44
long_title: Setting-up-the-plug-in
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 4
78
---
89
# Setting up the plug-in
910

plugins/nsgportal/Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in
44
long_title: Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 10
78
---
89
# Using pop_nsg command line tools in your EEGLAB plug-in
910

plugins/nsgportal/Using-the-Open-EEGLAB-Portal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Using-the-Open-EEGLAB-Portal
44
long_title: Using-the-Open-EEGLAB-Portal
55
parent: nsgportal
66
grand_parent: Plugins
7+
nav_order: 2
78
---
89
There will be two approaches to using the Open EEGLAB Portal: either, through its NSG web interface (http://www.NSGportal.org), or by making use of the NSG command line RESTful interface (NSG-R). This section describes the use of the web interface.
910

plugins/nsgportal/_Sidebar.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ grand_parent: Plugins
99
* [EEGLAB on NSG](Home)
1010
* [Registering on NSG](Registering-at-NSG)
1111
* [Using the Open EEGLAB Portal](Using-the-Open-EEGLAB-Portal)
12-
* [EEGLAB plug-ins on NSG](EEGLAB-plug\-ins-on-NSG)
12+
* [EEGLAB plug-ins on NSG](EEGLAB-plug-ins-on-NSG)
1313
# EEGLAB plug in to NSG: nsportal
1414
* [Setting up the plug-in](Setting-up-the-plug-in)
15-
* [Nsgportal plug-in GUI](https://github.com/sccn/nsgportal/wiki/nsgportal-graphical-user-interface:-pop_nsg)
15+
* [Nsgportal plug-in GUI](nsgportal-graphical-user-interface:-pop_nsg)
1616
* [Nsgportal command line tools](nsgportal-command-line-tools)
17-
* [Scheme of plug-in functions call](scheme-of-plug\-in-functions-call)
17+
* [Scheme of plug-in functions call](scheme-of-plug-in-functions-call)
1818
# Tutorials
1919
* [Tutorial 1: Creating and managing an NSG job from the _pop_nsg_ GUI](Creating-and-managing-a-job-from-pop_nsg-GUI)
2020
* [Tutorial 2: Creating and managing an NSG job using _pop_nsg_ from the command line](Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line)

0 commit comments

Comments
 (0)