diff options
author | emkael <emkael@tlen.pl> | 2017-09-08 01:28:21 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-09-08 01:28:21 +0200 |
commit | 8f795b1d445441daab5ffb75060a6dbf8ed0934a (patch) | |
tree | 15e55a2a7e03867ac0cccfb8303674d478510503 /scripts/menus-compile.py | |
parent | 655a9847513332e8e119f37f7ed95f4ab002b1a1 (diff) |
Renaming scripts so that their names make sense
Diffstat (limited to 'scripts/menus-compile.py')
-rw-r--r-- | scripts/menus-compile.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/menus-compile.py b/scripts/menus-compile.py new file mode 100644 index 0000000..7c9fd64 --- /dev/null +++ b/scripts/menus-compile.py @@ -0,0 +1,18 @@ +import json, os, sys + +from bs4 import BeautifulSoup as bs4 + +config_file = sys.argv[1] +base_directory = sys.argv[2] +menu_directory = sys.argv[3] + +for menu_item in json.load(file(config_file)): + href = os.path.relpath( + os.path.join(base_directory, menu_item['url']), + menu_directory + ) + link = bs4('<a class="btn btn-default"></a>', 'html.parser') + link.a['href'] = href + link.a['title'] = menu_item['header'] + link.a.string = menu_item['label'] + print link.a |