Skip to content

Commit

Permalink
Add proper titles and "open in MATLAB Online" badges to tutorial pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ehennestad committed Dec 6, 2024
1 parent 8aa83c3 commit d913c6b
Show file tree
Hide file tree
Showing 21 changed files with 171 additions and 61 deletions.
19 changes: 19 additions & 0 deletions docs/source/_config/tutorial_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"intro": "Getting Started with MatNWB",
"read_demo": "Reading NWB Files with MatNWB",
"basicUsage": "Basic Usage of MatNWB",
"dimensionMapNoDataPipes": "Mapping Dimensions without DataPipes",
"dimensionMapWithDataPipes": "Mapping Dimensions with DataPipes",
"convertTrials": "Converting Trials to NWB Format",
"dynamic_tables": "Using Dynamic Tables in MatNWB",
"scratch": "Working with Scratch Space in MatNWB",
"behavior": "Behavior Data Processing",
"ecephys": "Electrophysiology",
"icephys": "Intracellular Electrophysiology",
"images": "Image Data",
"ogen": "Optogenetics",
"ophys": "Optical Physiology",
"dataPipe": "Advanced Writing Using DataPipes",
"dynamically_loaded_filters": "Implementing Dynamically Loaded Filters",
"remote_read": "Reading NWB Files from Remote Locations"
}
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/basicUsage.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
basicUsage
===============================
Basic Usage of MatNWB
=====================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/basicUsage.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/basicUsage.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/basicUsage.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/behavior.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
behavior
===============================
Behavior Data Processing
========================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/behavior.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/behavior.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/behavior.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
8 changes: 6 additions & 2 deletions docs/source/pages/tutorials/convertTrials.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
convertTrials
Converting Trials to NWB Format
===============================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/convertTrials.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/convertTrials.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/convertTrials.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/dataPipe.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dataPipe
===============================
Advanced Writing Using DataPipes
================================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/dataPipe.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/dataPipe.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/dataPipe.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/dimensionMapNoDataPipes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dimensionMapNoDataPipes
===============================
Mapping Dimensions without DataPipes
====================================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/dimensionMapNoDataPipes.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/dimensionMapNoDataPipes.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/dimensionMapNoDataPipes.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/dimensionMapWithDataPipes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dimensionMapWithDataPipes
===============================
Mapping Dimensions with DataPipes
=================================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/dimensionMapWithDataPipes.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/dimensionMapWithDataPipes.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/dimensionMapWithDataPipes.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/dynamic_tables.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dynamic_tables
===============================
Using Dynamic Tables in MatNWB
==============================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/dynamic_tables.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/dynamic_tables.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/dynamic_tables.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/dynamically_loaded_filters.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dynamically_loaded_filters
===============================
Implementing Dynamically Loaded Filters
=======================================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/dynamically_loaded_filters.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/dynamically_loaded_filters.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/dynamically_loaded_filters.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/ecephys.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
ecephys
===============================
Electrophysiology
=================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/ecephys.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/ecephys.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/ecephys.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
8 changes: 6 additions & 2 deletions docs/source/pages/tutorials/icephys.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
icephys
Intracellular Electrophysiology
===============================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/icephys.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/icephys.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/icephys.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/images.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
images
===============================
Image Data
==========

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/images.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/images.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/images.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
29 changes: 21 additions & 8 deletions docs/source/pages/tutorials/index.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
Tutorials
=========

General Tutorials
-----------------
.. toctree::
:maxdepth: 1
:caption: Tutorials

intro
read_demo
basicUsage
behavior
convertTrials
dataPipe
dimensionMapNoDataPipes
dimensionMapWithDataPipes
convertTrials
dynamic_tables
dynamically_loaded_filters
scratch

Domain-Specific Tutorials
-------------------------
.. toctree::
:maxdepth: 1

behavior
ecephys
icephys
images
intro
ogen
ophys
read_demo

Advanced I/O
------------
.. toctree::
:maxdepth: 1

dataPipe
dynamically_loaded_filters
remote_read
scratch
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/intro.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
intro
===============================
Getting Started with MatNWB
===========================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/intro.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/intro.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/intro.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/ogen.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
ogen
===============================
Optogenetics
============

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/ogen.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/ogen.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/ogen.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/ophys.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
ophys
===============================
Optical Physiology
==================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/ophys.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/ophys.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/ophys.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/read_demo.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
read_demo
===============================
Reading NWB Files with MatNWB
=============================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/read_demo.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/read_demo.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/read_demo.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/remote_read.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
remote_read
===============================
Reading NWB Files from Remote Locations
=======================================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/remote_read.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/remote_read.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/remote_read.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions docs/source/pages/tutorials/scratch.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
scratch
===============================
Working with Scratch Space in MatNWB
====================================

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/scratch.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="../../_static/html/tutorials/scratch.html" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="../../_static/html/tutorials/scratch.html" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
10 changes: 7 additions & 3 deletions tools/documentation/_rst_templates/tutorial.rst.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{tutorial_name}}
===============================
{{tutorial_title}}
{{tutorial_title_underline}}

.. image:: https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg
:target: https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/{{tutorial_name}}.mlx
:alt: Open in MATLAB Online

.. raw:: html

<iframe src="{{static_html_path}}" style="width: 900px; height: 100vh; overflow: hidden; border: none;"></iframe>
<iframe src="{{static_html_path}}" style="width: 100%; height: 100vh; overflow: hidden; border: none;"></iframe>
8 changes: 7 additions & 1 deletion tools/documentation/private/generateRstForTutorials.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ function generateRstForTutorials()
tutorialRstTargetDir = fullfile(docsSourceRootDir, 'pages', 'tutorials');
if ~isfolder(tutorialRstTargetDir); mkdir(tutorialRstTargetDir); end

tutorialConfigFilePath = fullfile(docsSourceRootDir, '_config', 'tutorial_config.json');
S = jsondecode(fileread(tutorialConfigFilePath));

rstTemplate = fileread( getRstTemplateFile('tutorial') );

% List all html files in source dir
Expand All @@ -17,9 +20,12 @@ function generateRstForTutorials()
relPath = strrep(thisFilePath, docsSourceRootDir, '../..');

[~, name] = fileparts(relPath);
title = S.(name);

rstOutput = replace(rstTemplate, '{{static_html_path}}', relPath);
rstOutput = replace(rstOutput, '{{tutorial_name}}', name);
rstOutput = replace(rstOutput, '{{tutorial_title}}', title);
rstOutput = replace(rstOutput, '{{tutorial_title_underline}}', repmat('=', 1, numel(title)));

rstOutputFile = fullfile(tutorialRstTargetDir, [name, '.rst']);
fid = fopen(rstOutputFile, 'wt');
Expand All @@ -34,5 +40,5 @@ function generateRstForTutorials()

thisRst = fillTemplate(indexTemplate, data);
rstFilePath = fullfile(tutorialRstTargetDir, ['index', '.rst']);
filewrite(rstFilePath, thisRst);
%filewrite(rstFilePath, thisRst);
end

0 comments on commit d913c6b

Please sign in to comment.