-
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
a4b9843
commit 15b40d8
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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,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() |
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,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 |
Submodule SIFT.wiki
added at
c1aafb
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,8 @@ | ||
--- | ||
layout: default | ||
title: Plugins | ||
has_children: true | ||
has_toc: false | ||
nav_order: 7 | ||
--- | ||
This is a test |