summaryrefslogtreecommitdiff
path: root/static-menu.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-09-07 02:10:36 +0200
committeremkael <emkael@tlen.pl>2017-09-07 02:10:36 +0200
commit4060fa99c23bca17895029ae1ffad24d0d024269 (patch)
treecf4f322e236d913e238366a2de30727d0d2561cb /static-menu.py
parent26f2934bcdfec9b32131ec01bbdd493146b3ad57 (diff)
Moving *.py scripts to separate directory, cleaning things up
Diffstat (limited to 'static-menu.py')
-rw-r--r--static-menu.py24
1 files changed, 0 insertions, 24 deletions
diff --git a/static-menu.py b/static-menu.py
deleted file mode 100644
index 9474d12..0000000
--- a/static-menu.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import copy, json, os, sys
-
-from bs4 import BeautifulSoup as bs4
-
-config_file = sys.argv[1]
-content_file = sys.argv[2]
-link_prefix = sys.argv[3] if len(sys.argv) > 3 else ''
-
-content = bs4(file(content_file), 'lxml')
-
-for menu_container in content.select('.static-menu'):
- menu_container.clear()
- for menu_item in json.load(file(config_file)):
- href = os.path.relpath(
- os.path.join(link_prefix, menu_item['url']),
- os.path.dirname(content_file)
- )
- 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']
- menu_container.append(link.a)
-
-file(content_file, 'w').write(content.prettify().encode('utf-8'))