-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
726b8a5
commit 69dbd49
Showing
86 changed files
with
112 additions
and
129 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import os | ||
import sys | ||
import shutil | ||
|
||
# open a text file ending with .md and append a paragraph to it | ||
def reformat_plugin(dirpath, plugin_name): | ||
plugins_dir = '/Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins' | ||
index_file = os.path.join(plugins_dir, 'index.md') | ||
shutil.copyfile(os.path.join(dirpath, 'README.md'), index_file) | ||
with open(index_file) as f: | ||
text = f.read() | ||
append_text = '''--- | ||
layout: default | ||
title: {plugin_name} | ||
long_title: {plugin_name} | ||
parent: Plugins | ||
--- | ||
'''.format(plugin_name=plugin_name) | ||
text = append_text + text | ||
with open(index_file, 'w') as out: | ||
out.write(text) | ||
|
||
# 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, output_file): | ||
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(output_file, 'w') as out: | ||
out.write(text) | ||
|
||
def reformat_plugin_dir(plugin_input_dir, plugin_name, plugin_type='wiki'): | ||
# plugins_output_dir = '/Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins' | ||
plugin_output_dir = os.path.join('/Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins', plugin_name) | ||
if not os.path.exists(plugin_output_dir): | ||
os.makedirs(plugin_output_dir) | ||
# copy image directory from input to output dir | ||
if os.path.exists(os.path.join(plugin_input_dir, 'images')): | ||
shutil.copytree(os.path.join(plugin_input_dir, 'images'), os.path.join(plugin_output_dir, 'images'), dirs_exist_ok=True) | ||
|
||
index_file = os.path.join(plugin_output_dir, 'index.md') | ||
if plugin_type == 'wiki': | ||
shutil.copyfile(os.path.join(plugin_input_dir, 'Home.md'), index_file) | ||
with open(index_file) as f: | ||
text = f.read() | ||
append_text = '''--- | ||
layout: default | ||
title: {plugin_name} | ||
long_title: {plugin_name} | ||
parent: Plugins | ||
categories: plugins | ||
has_children: true | ||
--- | ||
'''.format(plugin_name=plugin_name) | ||
text = append_text + text | ||
with open(index_file, 'w') as out: | ||
out.write(text) | ||
|
||
for root, dirs, files in os.walk(plugin_input_dir): | ||
for file in files: | ||
if file.endswith('.md') and not file.startswith('index') and not file.startswith('Home'): | ||
append_to_file(os.path.join(plugin_input_dir, file), file.strip('.md'), plugin_name, os.path.join(plugin_output_dir, file)) | ||
else: | ||
shutil.copyfile(os.path.join(plugin_input_dir, 'README.md'), index_file) | ||
with open(index_file) as f: | ||
text = f.read() | ||
append_text = '''--- | ||
layout: default | ||
title: {plugin_name} | ||
long_title: {plugin_name} | ||
parent: Plugins | ||
--- | ||
'''.format(plugin_name=plugin_name) | ||
text = append_text + text | ||
with open(index_file, 'w') as out: | ||
out.write(text) | ||
|
||
# main | ||
def main(): | ||
if len(sys.argv) != 4: | ||
print('Usage: python test.py <plugin_dir_path> <plugin_name> <plugin_type>') | ||
sys.exit(1) | ||
dirpath = sys.argv[1] | ||
plugin_name = sys.argv[2] | ||
plugin_type = sys.argv[3] | ||
reformat_plugin_dir(dirpath, plugin_name, plugin_type) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+61.5 KB
plugins/std_dipoleDensity/images/Dipoledensity_dipplotinteractive.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.