From a742cf2873c54a6395650115db4a69994c42eda9 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 12 Jan 2018 11:19:39 +0100 Subject: [PATCH] update update.py --- update.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/update.py b/update.py index 2194ab0..7b7df17 100755 --- a/update.py +++ b/update.py @@ -6,6 +6,9 @@ import ox api = ox.API('https://indiancine.ma/api/') doc = api.getDocument(id='DWA')['data']['text'] +indent = ' ' +indent_s = ' ' + section_html = [] menu_html = [] for section in doc.split('

')[1:]: @@ -13,11 +16,13 @@ for section in doc.split('

')[1:]: name = title.lower() html = section[section.index('

')+5:] menu_html.append('{}'.format(name, title)) - section_html.append('
{}\n
'.format(name, html)) + html = html.replace('

', '').replace('

', '') + html = '\n'.join([indent + r for r in html.strip().split('\n')]) + section_html.append(indent_s + '
\n{}\n{}
'.format(name, html, indent_s)) section_html = '\n'.join(section_html) -menu_html = '\n' -menu_html += ' \n' +menu_html = '\n' +menu_html += indent_s + '\n' with open('index.html') as fd: index = fd.read()