From f52d517acb7f74a236dd988e532989c885484aa3 Mon Sep 17 00:00:00 2001
From: Dung Truong
Date: Mon, 5 Aug 2024 14:11:32 -0400
Subject: [PATCH] update nsgportal and sidebar mechanism
---
code/plugins/reformat_plugin.py | 25 ++++++++++++++-----
...ing-and-managing-a-job-from-pop_nsg-GUI.md | 5 ++--
...job-using-pop_nsg-from-the-command-line.md | 5 ++--
...command-line-tools-to-RESTful-interface.md | 8 ------
plugins/nsgportal/EEGLAB-plug-ins-on-NSG.md | 5 ++--
plugins/nsgportal/Registering-at-NSG.md | 7 ++++--
plugins/nsgportal/Registering-on-NSG-R.md | 8 ------
plugins/nsgportal/Running-AMICA-on-NSG.md | 9 -------
.../Scheme-of-plug-in-functions-call.md | 6 +++--
plugins/nsgportal/Setting-up-the-plug-in.md | 5 ++--
...mmand-line-tools-in-your-EEGLAB-plug-in.md | 5 ++--
.../nsgportal/Using-the-Open-EEGLAB-Portal.md | 5 ++--
plugins/nsgportal/_Sidebar.md | 14 ++++-------
.../nsgportal/nsgportal-command-line-tools.md | 5 ++--
...ortal-graphical-user-interface:-pop_nsg.md | 3 ---
15 files changed, 54 insertions(+), 61 deletions(-)
delete mode 100644 plugins/nsgportal/EEGLAB-command-line-tools-to-RESTful-interface.md
delete mode 100644 plugins/nsgportal/Registering-on-NSG-R.md
delete mode 100644 plugins/nsgportal/Running-AMICA-on-NSG.md
diff --git a/code/plugins/reformat_plugin.py b/code/plugins/reformat_plugin.py
index a7b5517..f0ade7c 100644
--- a/code/plugins/reformat_plugin.py
+++ b/code/plugins/reformat_plugin.py
@@ -6,26 +6,39 @@
def reformat_wiki_pages(filepath, filename, parent, output_file, wiki_input_dir=""):
append_text = '''---
layout: default
-title: {filename}
-long_title: {filename}
parent: {parent}
grand_parent: Plugins
'''.format(filename=filename, parent=parent)
- print(f"Reformatting {filename}...")
+ print(f"Reformatting {filename} of {parent}...")
if parent in ["nsgportal", "limo"]:
pages = []
+ titles = []
# load _Sidebar.md and extract all links from markdown file
with open(os.path.join(wiki_input_dir, '_Sidebar.md')) as f:
lines = f.readlines()
for line in lines:
if '(' in line:
# extract text between square brackets
+ title = line[line.find('[')+1:line.find(']')]
page = line[line.find('(')+1:line.find(')')]
pages.append(page)
- if filename in pages:
- order = pages.index(filename)
- append_text += 'nav_order: {order}\n'.format(order=order)
+ titles.append(title)
+ pages = list(map(str.lower, pages))
+ if filename.lower() in pages:
+ order = pages.index(filename.lower())
+ title = titles[order]
+ append_text += '''
+title: {title}
+long_title: {title}
+'''.format(title=title)
+
+ append_text += 'nav_order: {order}\n'.format(order=order+1)
+ else:
+ append_text += '''
+title: {filename}
+long_title: {filename}
+'''.format(filename=filename)
append_text += '---\n'
diff --git a/plugins/nsgportal/Creating-and-managing-a-job-from-pop_nsg-GUI.md b/plugins/nsgportal/Creating-and-managing-a-job-from-pop_nsg-GUI.md
index fb0ea19..e68cfec 100644
--- a/plugins/nsgportal/Creating-and-managing-a-job-from-pop_nsg-GUI.md
+++ b/plugins/nsgportal/Creating-and-managing-a-job-from-pop_nsg-GUI.md
@@ -1,9 +1,10 @@
---
layout: default
-title: Creating-and-managing-a-job-from-pop_nsg-GUI
-long_title: Creating-and-managing-a-job-from-pop_nsg-GUI
parent: nsgportal
grand_parent: Plugins
+
+title: Tutorial 1-GUI job management
+long_title: Tutorial 1-GUI job management
nav_order: 8
---
# Creating and managing a job from pop_nsg GUI
diff --git a/plugins/nsgportal/Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line.md b/plugins/nsgportal/Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line.md
index f2f7d2a..ccfa560 100644
--- a/plugins/nsgportal/Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line.md
+++ b/plugins/nsgportal/Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line.md
@@ -1,9 +1,10 @@
---
layout: default
-title: Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line
-long_title: Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line
parent: nsgportal
grand_parent: Plugins
+
+title: Tutorial 2-Command line management
+long_title: Tutorial 2-Command line management
nav_order: 9
---
This tutorial describes in details the process of submitting and managing a job using the command line options in _pop_nsg_.
diff --git a/plugins/nsgportal/EEGLAB-command-line-tools-to-RESTful-interface.md b/plugins/nsgportal/EEGLAB-command-line-tools-to-RESTful-interface.md
deleted file mode 100644
index 2a43363..0000000
--- a/plugins/nsgportal/EEGLAB-command-line-tools-to-RESTful-interface.md
+++ /dev/null
@@ -1,8 +0,0 @@
----
-layout: default
-title: EEGLAB-command-line-tools-to-RESTful-interface
-long_title: EEGLAB-command-line-tools-to-RESTful-interface
-parent: nsgportal
-grand_parent: Plugins
----
-# Under construction
\ No newline at end of file
diff --git a/plugins/nsgportal/EEGLAB-plug-ins-on-NSG.md b/plugins/nsgportal/EEGLAB-plug-ins-on-NSG.md
index f174681..69811bd 100644
--- a/plugins/nsgportal/EEGLAB-plug-ins-on-NSG.md
+++ b/plugins/nsgportal/EEGLAB-plug-ins-on-NSG.md
@@ -1,9 +1,10 @@
---
layout: default
-title: EEGLAB-plug-ins-on-NSG
-long_title: EEGLAB-plug-ins-on-NSG
parent: nsgportal
grand_parent: Plugins
+
+title: EEGLAB plug-ins on NSG
+long_title: EEGLAB plug-ins on NSG
nav_order: 3
---
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
diff --git a/plugins/nsgportal/Registering-at-NSG.md b/plugins/nsgportal/Registering-at-NSG.md
index 9e816f1..e944ab9 100644
--- a/plugins/nsgportal/Registering-at-NSG.md
+++ b/plugins/nsgportal/Registering-at-NSG.md
@@ -1,11 +1,14 @@
---
layout: default
-title: Registering-at-NSG
-long_title: Registering-at-NSG
parent: nsgportal
grand_parent: Plugins
+
+title: Registering on NSG
+long_title: Registering on NSG
nav_order: 1
---
+There are two ways to access to NSG: via NSG portal and through the command line interface NSG-R. The latter one uses its core curl commands to communicate with NSG and is the interface used by the nsgportal plug-in. Since both ways are interfaces to NSG, If you have already registered to NSG, you can use the same login and password for NSG-R. For the REST interface, refer to the [NSG REST documentation](https://nsgr.sdsc.edu:8443/restusers/documentation).
+
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).
diff --git a/plugins/nsgportal/Registering-on-NSG-R.md b/plugins/nsgportal/Registering-on-NSG-R.md
deleted file mode 100644
index 85d97c1..0000000
--- a/plugins/nsgportal/Registering-on-NSG-R.md
+++ /dev/null
@@ -1,8 +0,0 @@
----
-layout: default
-title: Registering-on-NSG-R
-long_title: Registering-on-NSG-R
-parent: nsgportal
-grand_parent: Plugins
----
-There are two ways to access to NSG: via NSG portal and through the command line interface NSG-R. The later one use on its core *curl* commands to communicate with NSG and is the interface used by the *nsgportal* plug-in. Since both ways are interfaces to NSG, If you have already registered to NSG, you can use the same login and password for NSG-R. If you have not done so, visit [this](https://github.com/sccn/nsgportal/wiki/Registering-at-NSG) section of the wiki.
\ No newline at end of file
diff --git a/plugins/nsgportal/Running-AMICA-on-NSG.md b/plugins/nsgportal/Running-AMICA-on-NSG.md
deleted file mode 100644
index 23a5bcb..0000000
--- a/plugins/nsgportal/Running-AMICA-on-NSG.md
+++ /dev/null
@@ -1,9 +0,0 @@
----
-layout: default
-title: Running-AMICA-on-NSG
-long_title: Running-AMICA-on-NSG
-parent: nsgportal
-grand_parent: Plugins
-nav_order: 11
----
-See this [page](https://github.com/japalmer29/amica/wiki/AMICA#how-to-run-amica-option-2-neuroscience-gateway-nsg) on the AMICA Gihub page.
\ No newline at end of file
diff --git a/plugins/nsgportal/Scheme-of-plug-in-functions-call.md b/plugins/nsgportal/Scheme-of-plug-in-functions-call.md
index 6422a00..4efba94 100644
--- a/plugins/nsgportal/Scheme-of-plug-in-functions-call.md
+++ b/plugins/nsgportal/Scheme-of-plug-in-functions-call.md
@@ -1,9 +1,11 @@
---
layout: default
-title: Scheme-of-plug-in-functions-call
-long_title: Scheme-of-plug-in-functions-call
parent: nsgportal
grand_parent: Plugins
+
+title: Scheme of plug-in functions call
+long_title: Scheme of plug-in functions call
+nav_order: 7
---
The figure below shows a scheme of function calls in _nsgportal_. In the plug-in there are two main sets, or layers, of functions designated by the prefix _pop__ and _nsg__. The _pop__ functions open a parameter entry window when called with fewer than the required arguments, else run directly without opening a window. The second class of nsgportal functions with prefix _nsg__ can be called directly from MATLAB command line or from other MATLAB scripts or functions. These functions perform lower-level processing than the pop_ functions. A plug-in function (_eegplugin_nsgportal_) manages the inclusion and appearance of an nsgportal item in the main EEGLAB window menu.
diff --git a/plugins/nsgportal/Setting-up-the-plug-in.md b/plugins/nsgportal/Setting-up-the-plug-in.md
index 50329a0..54d2881 100644
--- a/plugins/nsgportal/Setting-up-the-plug-in.md
+++ b/plugins/nsgportal/Setting-up-the-plug-in.md
@@ -1,9 +1,10 @@
---
layout: default
-title: Setting-up-the-plug-in
-long_title: Setting-up-the-plug-in
parent: nsgportal
grand_parent: Plugins
+
+title: Setting up the plug-in
+long_title: Setting up the plug-in
nav_order: 4
---
# Setting up the plug-in
diff --git a/plugins/nsgportal/Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in.md b/plugins/nsgportal/Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in.md
index a787828..32bb82f 100644
--- a/plugins/nsgportal/Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in.md
+++ b/plugins/nsgportal/Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in.md
@@ -1,9 +1,10 @@
---
layout: default
-title: Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in
-long_title: Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in
parent: nsgportal
grand_parent: Plugins
+
+title: Tutorial 3-Using in other EEGLAB plug-ins
+long_title: Tutorial 3-Using in other EEGLAB plug-ins
nav_order: 10
---
# Using pop_nsg command line tools in your EEGLAB plug-in
diff --git a/plugins/nsgportal/Using-the-Open-EEGLAB-Portal.md b/plugins/nsgportal/Using-the-Open-EEGLAB-Portal.md
index 8948783..fc80cdc 100644
--- a/plugins/nsgportal/Using-the-Open-EEGLAB-Portal.md
+++ b/plugins/nsgportal/Using-the-Open-EEGLAB-Portal.md
@@ -1,9 +1,10 @@
---
layout: default
-title: Using-the-Open-EEGLAB-Portal
-long_title: Using-the-Open-EEGLAB-Portal
parent: nsgportal
grand_parent: Plugins
+
+title: Using the Open EEGLAB Portal
+long_title: Using the Open EEGLAB Portal
nav_order: 2
---
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.
diff --git a/plugins/nsgportal/_Sidebar.md b/plugins/nsgportal/_Sidebar.md
index 6a3462b..4feaaa7 100644
--- a/plugins/nsgportal/_Sidebar.md
+++ b/plugins/nsgportal/_Sidebar.md
@@ -1,22 +1,18 @@
---
layout: default
-title: _Sidebar
-long_title: _Sidebar
parent: nsgportal
grand_parent: Plugins
---
# EEGLAB on NSG
-* [EEGLAB on NSG](Home)
* [Registering on NSG](Registering-at-NSG)
* [Using the Open EEGLAB Portal](Using-the-Open-EEGLAB-Portal)
* [EEGLAB plug-ins on NSG](EEGLAB-plug-ins-on-NSG)
-# EEGLAB plug in to NSG: nsportal
+# EEGLAB plug in to NSG
* [Setting up the plug-in](Setting-up-the-plug-in)
-* [Nsgportal plug-in GUI](nsgportal-graphical-user-interface:-pop_nsg)
+* [Nsgportal plug-in GUI](https://github.com/sccn/nsgportal/wiki/nsgportal-graphical-user-interface:-pop_nsg)
* [Nsgportal command line tools](nsgportal-command-line-tools)
* [Scheme of plug-in functions call](scheme-of-plug-in-functions-call)
# Tutorials
-* [Tutorial 1: Creating and managing an NSG job from the _pop_nsg_ GUI](Creating-and-managing-a-job-from-pop_nsg-GUI)
-* [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)
-* [Tutorial 3: Using _pop_nsg_ in an EEGLAB plug-in](Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in)
-* [Tutorial 4: Running AMICA on NSG](Running-AMICA-on-NSG)
+* [Tutorial 1-GUI job management](Creating-and-managing-a-job-from-pop_nsg-GUI)
+* [Tutorial 2-Command line management](Creating-and-managing-an-NSG-job-using-pop_nsg-from-the-command-line)
+* [Tutorial 3-Using in other EEGLAB plug-ins](Using-pop_nsg-command-line-tools-in-your-EEGLAB-plug-in)
diff --git a/plugins/nsgportal/nsgportal-command-line-tools.md b/plugins/nsgportal/nsgportal-command-line-tools.md
index f3efc04..15becd7 100644
--- a/plugins/nsgportal/nsgportal-command-line-tools.md
+++ b/plugins/nsgportal/nsgportal-command-line-tools.md
@@ -1,9 +1,10 @@
---
layout: default
-title: nsgportal-command-line-tools
-long_title: nsgportal-command-line-tools
parent: nsgportal
grand_parent: Plugins
+
+title: Nsgportal command line tools
+long_title: Nsgportal command line tools
nav_order: 6
---
Just like many other EEGLAB functions, users can interact with *nsgportal* through either the graphic user interface or using command line tools. The command line tools allow users to largely automate their analysis and make the process easy to reproduce. In this section, we introduce the *nsgportal* command line tools to NSG.
diff --git a/plugins/nsgportal/nsgportal-graphical-user-interface:-pop_nsg.md b/plugins/nsgportal/nsgportal-graphical-user-interface:-pop_nsg.md
index cfecb2b..7769a00 100644
--- a/plugins/nsgportal/nsgportal-graphical-user-interface:-pop_nsg.md
+++ b/plugins/nsgportal/nsgportal-graphical-user-interface:-pop_nsg.md
@@ -1,10 +1,7 @@
---
layout: default
-title: nsgportal-graphical-user-interface:-pop_nsg
-long_title: nsgportal-graphical-user-interface:-pop_nsg
parent: nsgportal
grand_parent: Plugins
-nav_order: 5
---
# *nsgportal* graphical user interface: pop_nsg