Skip to content

Commit

Permalink
add SIFT plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dungscout96 committed May 30, 2024
1 parent a4b9843 commit 15b40d8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
37 changes: 37 additions & 0 deletions code/SIFT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import sys

# open a text file ending with .md and append a paragraph to it
# Usage: python test.py <filename>.md
def append_to_file(filepath, filename, parent):
with open(filepath) as f:
text = f.read()
append_text = '''---
layout: default
title: {filename}
long_title: {filename}
parent: {parent}
grand_parent: Plugins
---
'''.format(filename=filename, parent=parent)
text = append_text + text
with open(filepath, 'w') as out:
out.write(text)

def reformat_plugin_dir(dirpath, plugin_name):
for root, dirs, files in os.walk(dirpath):
for file in files:
if file.endswith('.md') and not file.startswith('index') and not file.startswith('Home'):
append_to_file(os.path.join(root, file), file.strip('.md'), plugin_name)

# main
def main():
if len(sys.argv) != 3:
print('Usage: python test.py <plugin_dir_path> <plugin_name>')
sys.exit(1)
dirpath = sys.argv[1]
plugin_name = sys.argv[2]
reformat_plugin_dir(dirpath, plugin_name)

if __name__ == "__main__":
main()
3 changes: 3 additions & 0 deletions code/update_plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
git -C /Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins/SIFT.wiki fetch origin master
git -C /Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins/SIFT.wiki reset --hard origin/master
python /Users/dtyoung/Documents/EEGLAB/sccn.github.io/code/SIFT.py /Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins/SIFT.wiki SIFT
1 change: 1 addition & 0 deletions plugins/SIFT.wiki
Submodule SIFT.wiki added at c1aafb
8 changes: 8 additions & 0 deletions plugins/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout: default
title: Plugins
has_children: true
has_toc: false
nav_order: 7
---
This is a test

0 comments on commit 15b40d8

Please sign in to comment.