summaryrefslogtreecommitdiff
path: root/scripts/menus-write.py
blob: e30c702d19f33b3cc48d51ecebee5281da36751e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import copy, json, os, sys

from bs4 import BeautifulSoup as bs4

content_file = sys.argv[1]
menu_content = file(sys.argv[2])

content = bs4(file(content_file), 'lxml')

for menu_container in content.select('.static-menu'):
    menu_container.clear()
    menu_container.append(bs4(menu_content, 'html.parser'))

file(content_file, 'w').write(content.prettify().encode('utf-8'))