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:
parent
bcdb455950
commit
5f2cc55655
2 changed files with 8 additions and 3 deletions
2
Makefile
2
Makefile
|
@ -23,7 +23,7 @@ rpm: all_games_html rules mo
|
||||||
python setup.py bdist_rpm
|
python setup.py bdist_rpm
|
||||||
|
|
||||||
all_games_html:
|
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:
|
rules:
|
||||||
export PYTHONPATH=`pwd`; (cd html-src && ./gen-html.py)
|
export PYTHONPATH=`pwd`; (cd html-src && ./gen-html.py)
|
||||||
|
|
|
@ -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'))
|
rules_dir = os.path.normpath(os.path.join(pysollib_path, 'data/html/rules'))
|
||||||
# pprint(sys.path)
|
# pprint(sys.path)
|
||||||
# print rules_dir
|
# print rules_dir
|
||||||
|
html_mode = None
|
||||||
|
|
||||||
fix_gettext()
|
fix_gettext()
|
||||||
|
|
||||||
|
@ -170,7 +171,8 @@ def all_games(sort_by='id'):
|
||||||
|
|
||||||
|
|
||||||
def create_html(sort_by):
|
def create_html(sort_by):
|
||||||
print('''<!DOCTYPE html><html lang="en-US">
|
if html_mode != 'bare':
|
||||||
|
print('''<!DOCTYPE html><html lang="en-US">
|
||||||
<head>
|
<head>
|
||||||
<title>PySolFC - List of solitaire games</title>
|
<title>PySolFC - List of solitaire games</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<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>')
|
print('<h2>The games</h2>')
|
||||||
all_games(sort_by)
|
all_games(sort_by)
|
||||||
print('</section>')
|
print('</section>')
|
||||||
print('</body></html>')
|
if html_mode != 'bare':
|
||||||
|
print('</body></html>')
|
||||||
|
|
||||||
|
|
||||||
def get_text():
|
def get_text():
|
||||||
|
@ -272,6 +275,8 @@ if len(sys.argv) < 2 or sys.argv[1] == 'html':
|
||||||
sort_by = sys.argv[2]
|
sort_by = sys.argv[2]
|
||||||
if len(sys.argv) > 3:
|
if len(sys.argv) > 3:
|
||||||
rules_dir = sys.argv[3]
|
rules_dir = sys.argv[3]
|
||||||
|
if len(sys.argv) > 4:
|
||||||
|
html_mode = sys.argv[4]
|
||||||
create_html(sort_by)
|
create_html(sort_by)
|
||||||
elif sys.argv[1] == 'gettext':
|
elif sys.argv[1] == 'gettext':
|
||||||
get_text()
|
get_text()
|
||||||
|
|
Loading…
Add table
Reference in a new issue