1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Add a bare option to reduce html boilerplate.

For including in the site.
This commit is contained in:
Shlomi Fish 2018-09-06 10:28:36 +03:00
parent bcdb455950
commit 5f2cc55655
2 changed files with 8 additions and 3 deletions

View file

@ -23,7 +23,7 @@ rpm: all_games_html rules mo
python setup.py bdist_rpm
all_games_html:
PYTHONPATH=`pwd` ./scripts/all_games.py > docs/all_games.html
PYTHONPATH=`pwd` ./scripts/all_games.py html id doc/rules bare > docs/all_games.html
rules:
export PYTHONPATH=`pwd`; (cd html-src && ./gen-html.py)

View file

@ -26,6 +26,7 @@ sys.path[0] = os.path.normpath(pysollib_path)
rules_dir = os.path.normpath(os.path.join(pysollib_path, 'data/html/rules'))
# pprint(sys.path)
# print rules_dir
html_mode = None
fix_gettext()
@ -170,7 +171,8 @@ def all_games(sort_by='id'):
def create_html(sort_by):
print('''<!DOCTYPE html><html lang="en-US">
if html_mode != 'bare':
print('''<!DOCTYPE html><html lang="en-US">
<head>
<title>PySolFC - List of solitaire games</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@ -192,7 +194,8 @@ def create_html(sort_by):
print('<h2>The games</h2>')
all_games(sort_by)
print('</section>')
print('</body></html>')
if html_mode != 'bare':
print('</body></html>')
def get_text():
@ -272,6 +275,8 @@ if len(sys.argv) < 2 or sys.argv[1] == 'html':
sort_by = sys.argv[2]
if len(sys.argv) > 3:
rules_dir = sys.argv[3]
if len(sys.argv) > 4:
html_mode = sys.argv[4]
create_html(sort_by)
elif sys.argv[1] == 'gettext':
get_text()