improved static website
This commit is contained in:
parent
9d65ee912b
commit
2d52caf518
@ -28,6 +28,9 @@ http://icculus.org/jugglemaster/
|
||||
http://icculus.org/pyddr/
|
||||
http://icculus.org/toby/
|
||||
http://iichantra.ru/en/
|
||||
https://github.com/armory3d/iron
|
||||
https://github.com/AxioDL/urde
|
||||
https://github.com/Gramps/GodotSteam
|
||||
http://insideastarfilledsky.net/
|
||||
http://lazerbears.wixsite.com/lazerbears/cr-editor
|
||||
http://libagar.org/agar/index.html.en
|
||||
@ -48,6 +51,7 @@ http://roguebasin.roguelikedevelopment.org/index.php?title=Main_Page
|
||||
http://sam.zoy.org/monsterz/
|
||||
http://senseis.xmp.net/?GoPlayingPrograms
|
||||
http://sio2interactive.com/
|
||||
https://github.com/EasyRPG/Editor-Qt
|
||||
http://slick.ninjacave.com/
|
||||
http://snowstorm.sourceforge.net/cgi-bin/site.cgi
|
||||
http://sol.gfxile.net/ambrose3d/index.html
|
||||
|
@ -5,20 +5,31 @@ Uses Jinja2 (see https://jinja.palletsprojects.com/en/2.11.x/)
|
||||
"""
|
||||
|
||||
# TODO index.html tiles, content
|
||||
# TODO index.html image
|
||||
# TODO index.html image (maybe downloaded and assembled from osgameclones)
|
||||
# TODO index.html only count games
|
||||
# TODO Font awesome 5 (icons for OS, for Github, Gitlab and maybe others)
|
||||
# TODO contribute.html tiles? content
|
||||
# TODO games pages links to licenses (wikipedia)
|
||||
# TODO games pages edit/contribute button
|
||||
# TODO indexes: make categories bold that have a certain amount of entries!
|
||||
# TODO everywhere: style URLs (Github, Wikipedia, Internet archive, SourceForge, ...)
|
||||
# TODO developers pages links to games and more information, styles, block around entry, edit/contribute button
|
||||
# TODO inspirations pages, add link to games and more information, styles, block around entry, edit/contribute button
|
||||
# TODO developers pages links to games and more information, styles
|
||||
# TODO inspirations pages, add link to games and more information, styles
|
||||
# TODO navbar add is active
|
||||
# TODO statistics page: better and more statistics with links where possible
|
||||
# TODO meaningful information (links, license, last updated with lower precision)
|
||||
# TODO singular, plural everywhere (game, entries, items)
|
||||
# TODO background and shadow for the boxes
|
||||
# TODO line breaks and spaces in html source and output
|
||||
# TODO rename fields (Home to Homepage, Inspirations to Inspiration)
|
||||
# TODO developers contact expand to links to Github, Sourceforge
|
||||
# TODO games keywords as labels (some as links)
|
||||
# TODO games links to licenses and languages
|
||||
# TODO platforms as labels and with links
|
||||
# TODO split games in libraries/tools/frameworks and real games
|
||||
# TODO statistics with nice graphics (pie charts in SVG) with matplotlib, seaborn, plotly?
|
||||
# TODO statistics, get it from common statistics generator
|
||||
# TODO optimize jinja for line breaks and indention
|
||||
# TODO @notices in entries
|
||||
|
||||
import os
|
||||
import shutil
|
||||
@ -37,6 +48,19 @@ games_path = 'games'
|
||||
inspirations_path = 'inspirations'
|
||||
developers_path = 'developers'
|
||||
|
||||
plurals = {k: k+'s' for k in ('Assets license', 'Contact', 'Code language', 'Code license', 'Developer', 'Download', 'Inspiration', 'Game', 'Home', 'Organization', 'Platform')}
|
||||
for k in ('Media', 'Play', 'Keywords'):
|
||||
plurals[k] = k
|
||||
for k in ('Code repository', 'Code dependency'):
|
||||
plurals[k] = k[:-1] + 'ies'
|
||||
|
||||
def get_plural_or_singular(name, amount):
|
||||
if not name in plurals.keys():
|
||||
raise RuntimeError('"{}" not a known singular!'.format(name))
|
||||
if amount == 1:
|
||||
return name
|
||||
return plurals[name]
|
||||
|
||||
html5parser = html5lib.HTMLParser(strict=True)
|
||||
|
||||
|
||||
@ -107,10 +131,13 @@ def divide_in_columns(categorized_lists, transform):
|
||||
def url_to(current, target):
|
||||
"""
|
||||
|
||||
:param current:
|
||||
:param current: Current path
|
||||
:param target:
|
||||
:return:
|
||||
"""
|
||||
# if it's an absolute url, just return
|
||||
if any(target.startswith(x) for x in ('http://', 'https://')):
|
||||
return target
|
||||
# split by slash
|
||||
if current:
|
||||
current = current.split('/')
|
||||
@ -189,31 +216,147 @@ def developer_index(developer):
|
||||
e['tags'] = n
|
||||
return e
|
||||
|
||||
def shortcut_url(url):
|
||||
|
||||
def add_entries_links_to_inspirations(inspirations, entries):
|
||||
# gitlab
|
||||
gl_prefix = 'https://gitlab.com/'
|
||||
if url.startswith(gl_prefix):
|
||||
return 'GL: ' + url[len(gl_prefix):]
|
||||
# github
|
||||
gh_prefix = 'https://github.com/'
|
||||
if url.startswith(gh_prefix):
|
||||
return 'GH: ' + url[len(gh_prefix):]
|
||||
|
||||
# sourceforge
|
||||
sf_prefix = 'https://sourceforge.net/projects/'
|
||||
if url.startswith(sf_prefix):
|
||||
return 'SF: ' + url[len(sf_prefix):]
|
||||
|
||||
# archive link
|
||||
ia_prefix = 'https://web.archive.org/web/'
|
||||
if url.startswith(ia_prefix):
|
||||
return 'Archive: ' + url[len(ia_prefix):]
|
||||
|
||||
# Wikipedia link
|
||||
wp_prefix = 'https://en.wikipedia.org/wiki/'
|
||||
if url.startswith(wp_prefix):
|
||||
return 'WP: ' + url[len(wp_prefix):]
|
||||
|
||||
# cutoff common prefixes
|
||||
for prefix in ('http://', 'https://'):
|
||||
if url.startswith(prefix):
|
||||
return url[len(prefix):]
|
||||
# as is
|
||||
return url
|
||||
|
||||
|
||||
def convert_inspirations(inspirations, entries):
|
||||
entries_references = {entry['Title']:entry['href'] for entry in entries}
|
||||
for inspiration in inspirations:
|
||||
fields = []
|
||||
# media
|
||||
if 'Media' in inspiration:
|
||||
entries = inspiration['Media']
|
||||
entries = [{'href': url, 'name': shortcut_url(url)} for url in entries]
|
||||
field = {
|
||||
'name': 'Media',
|
||||
'entries': entries
|
||||
}
|
||||
fields.append(field)
|
||||
# inspired entries (with links to them)
|
||||
inspired_entries = inspiration['Inspired entries']
|
||||
inspired_entries = [(entries_references[entry], entry) for entry in inspired_entries]
|
||||
inspiration['Inspired entries'] = inspired_entries
|
||||
entries = [{'href': entries_references[entry], 'name': entry} for entry in inspired_entries]
|
||||
field = {
|
||||
'name': 'Inspired {}'.format(get_plural_or_singular('Game', len(entries)).lower()),
|
||||
'entries': entries
|
||||
}
|
||||
fields.append(field)
|
||||
inspiration['fields'] = fields
|
||||
inspiration['name'] = inspiration['Name']
|
||||
|
||||
|
||||
def add_entries_links_to_developers(developers, entries):
|
||||
def convert_developers(developers, entries):
|
||||
entries_references = {entry['Title']:entry['href'] for entry in entries}
|
||||
for developer in developers:
|
||||
fields = []
|
||||
# games field
|
||||
developed_entries = developer['Games']
|
||||
developed_entries = [(entries_references[entry], entry) for entry in developed_entries]
|
||||
developer['Games'] = developed_entries
|
||||
entries = [{'href': entries_references[entry], 'name': entry} for entry in developed_entries]
|
||||
field = {
|
||||
'name': 'Open source {}'.format(get_plural_or_singular('Game', len(entries))),
|
||||
'entries': entries
|
||||
}
|
||||
fields.append(field)
|
||||
for field in c.optional_developer_fields:
|
||||
if field in developer:
|
||||
entries = developer[field]
|
||||
if field in c.url_developer_fields:
|
||||
entries = [{'href': entry, 'name': shortcut_url(entry)} for entry in entries]
|
||||
else:
|
||||
entries = [{'href': '', 'name': entry} for entry in entries]
|
||||
field = {
|
||||
'name': get_plural_or_singular(field, len(entries)),
|
||||
'entries': entries
|
||||
}
|
||||
fields.append(field)
|
||||
developer['fields'] = fields
|
||||
developer['name'] = developer['Name']
|
||||
|
||||
|
||||
def add_inspirations_and_developers_links_to_entries(entries, inspirations, developers):
|
||||
def convert_entries(entries, inspirations, developers):
|
||||
inspirations_references = {inspiration['Name']: inspiration['href'] for inspiration in inspirations}
|
||||
developer_references = {developer['Name']: developer['href'] for developer in developers}
|
||||
for entry in entries:
|
||||
if 'Inspirations' in entry:
|
||||
entry['Inspirations'] = [(inspirations_references[inspiration.value], inspiration.value) for inspiration in entry['Inspirations']]
|
||||
if 'Developer' in entry:
|
||||
entry['Developer'] = [(developer_references[developer.value], developer.value) for developer in entry['Developer']]
|
||||
fields = []
|
||||
for field in ('Home', 'Inspirations', 'Media', 'Download', 'Play', 'Developer', 'Keywords'):
|
||||
if field in entry:
|
||||
e = entry[field]
|
||||
if field == 'Inspirations':
|
||||
field = 'Inspiration' # TODO this is a bug, rename in entries
|
||||
if isinstance(e[0], osg.osg_parse.ValueWithComment):
|
||||
e = [x.value for x in e]
|
||||
if field == 'Inspiration':
|
||||
e = [{'href': inspirations_references[x], 'name': x} for x in e]
|
||||
elif field == 'Developer':
|
||||
e = [{'href': developer_references[x], 'name': x} for x in e]
|
||||
elif field in c.url_fields:
|
||||
e = [{'href': x, 'name': shortcut_url(x)} for x in e]
|
||||
else:
|
||||
e = [{'href': '', 'name': x} for x in e]
|
||||
field = {
|
||||
'title': {'name': get_plural_or_singular(field, len(entries))},
|
||||
'entries': e
|
||||
}
|
||||
fields.append(field)
|
||||
if 'Note' in entry:
|
||||
fields.append({'entries': [{'href': '', 'name': entry['Note']}]})
|
||||
fields.append({'title': 'Technical info', 'entries': []})
|
||||
for field in ('Platform', 'Code language', 'Code license', 'Code repository', 'Code dependencies', 'Assets license'):
|
||||
if field in entry:
|
||||
e = entry[field]
|
||||
if not e:
|
||||
continue
|
||||
if field == 'Code dependencies':
|
||||
field = 'Code dependency' # bug, rename field
|
||||
if isinstance(e[0], osg.osg_parse.ValueWithComment):
|
||||
e = [x.value for x in e]
|
||||
if field in c.url_fields:
|
||||
e = [{'href': x, 'name': shortcut_url(x)} for x in e]
|
||||
else:
|
||||
e = [{'href': '', 'name': x} for x in e]
|
||||
field = {
|
||||
'title': {'name': get_plural_or_singular(field, len(entries))},
|
||||
'entries': e
|
||||
}
|
||||
fields.append(field)
|
||||
entry['fields'] = fields
|
||||
entry['name'] = entry['Title']
|
||||
|
||||
def add_license_links_to_entries(entries):
|
||||
for entry in entries:
|
||||
licenses = entry['Code license']
|
||||
licenses = [(c.license_urls.get(license.value, ''), license.value) for license in licenses]
|
||||
entry['Code license'] = licenses
|
||||
|
||||
|
||||
def generate(entries, inspirations, developers):
|
||||
@ -230,9 +373,12 @@ def generate(entries, inspirations, developers):
|
||||
preprocess(developers, 'Name', developers_path)
|
||||
|
||||
# set internal links up
|
||||
add_entries_links_to_inspirations(inspirations, entries)
|
||||
add_entries_links_to_developers(developers, entries)
|
||||
add_inspirations_and_developers_links_to_entries(entries, inspirations, developers)
|
||||
convert_inspirations(inspirations, entries)
|
||||
convert_developers(developers, entries)
|
||||
convert_entries(entries, inspirations, developers)
|
||||
|
||||
# set external links up
|
||||
add_license_links_to_entries(entries)
|
||||
|
||||
# sort into categories
|
||||
games_by_alphabet = sort_into_categories(entries, extended_alphabet, lambda item, category: category == item['letter'])
|
||||
@ -260,21 +406,24 @@ def generate(entries, inspirations, developers):
|
||||
|
||||
# multiple times used templates
|
||||
template_categorical_index = environment.get_template('categorical_index.jinja')
|
||||
template_list = environment.get_template('list.jinja')
|
||||
template_listing = environment.get_template('listing.jinja')
|
||||
|
||||
# top level folder
|
||||
base['url_to'] = partial(url_to, '')
|
||||
|
||||
# index.html
|
||||
base['active_nav'] = 'index'
|
||||
index = {'number_games': len(entries)}
|
||||
template = environment.get_template('index.jinja')
|
||||
write(template.render(index=index), 'index.html')
|
||||
|
||||
# contribute.html
|
||||
base['active_nav'] = 'contribute'
|
||||
template = environment.get_template('contribute.jinja')
|
||||
write(template.render(), 'contribute.html')
|
||||
|
||||
# statistics
|
||||
base['active_nav'] = 'statistics'
|
||||
|
||||
# preparation
|
||||
template = environment.get_template('statistics.jinja')
|
||||
@ -304,35 +453,38 @@ def generate(entries, inspirations, developers):
|
||||
|
||||
# games folder
|
||||
base['url_to'] = partial(url_to, games_path)
|
||||
base['active_nav'] = 'games'
|
||||
|
||||
# generate games pages
|
||||
template = environment.get_template('games_for_letter.jinja')
|
||||
for letter in extended_alphabet:
|
||||
data = {
|
||||
'title': 'Games with {}'.format(letter.capitalize()),
|
||||
'games': games_by_alphabet[letter]
|
||||
listing = {
|
||||
'title': 'Games starting with {}'.format(letter.capitalize()),
|
||||
'items': games_by_alphabet[letter]
|
||||
}
|
||||
write(template.render(data=data), os.path.join(games_path, '{}.html'.format(letter.capitalize())))
|
||||
write(template_listing.render(listing=listing), os.path.join(games_path, '{}.html'.format(letter.capitalize())))
|
||||
|
||||
# generate games index
|
||||
index = divide_in_columns(games_by_alphabet, game_index)
|
||||
index['title'] = 'Alphabetical index'
|
||||
index['title'] = 'Games alphabetical index'
|
||||
index['categories'] = extended_alphabet
|
||||
write(template_categorical_index.render(index=index), os.path.join(games_path, 'index.html'))
|
||||
|
||||
# genres
|
||||
base['active_nav'] = 'filter genres'
|
||||
index = divide_in_columns(games_by_genre, game_index)
|
||||
index['title'] = 'Games by genre'
|
||||
index['categories'] = genres
|
||||
write(template_categorical_index.render(index=index), os.path.join(games_path, 'genres.html'))
|
||||
|
||||
# games by language
|
||||
base['active_nav'] = 'filter code language'
|
||||
index = divide_in_columns(games_by_language, game_index)
|
||||
index['title'] = 'Games by language'
|
||||
index['categories'] = c.known_languages
|
||||
write(template_categorical_index.render(index=index), os.path.join(games_path, 'languages.html'))
|
||||
|
||||
# games by platform
|
||||
base['active_nav'] = 'filter platforms'
|
||||
index = divide_in_columns(games_by_platform, game_index)
|
||||
index['title'] = 'Games by platform'
|
||||
index['categories'] = c.valid_platforms + ('Unspecified',)
|
||||
@ -340,31 +492,39 @@ def generate(entries, inspirations, developers):
|
||||
|
||||
# inspirations folder
|
||||
base['url_to'] = partial(url_to, inspirations_path)
|
||||
base['active_nav'] = 'filter inspirations'
|
||||
|
||||
# inspirations
|
||||
|
||||
# inspirations index
|
||||
index = divide_in_columns(inspirations_by_alphabet, inspiration_index)
|
||||
index['title'] = 'Inspirations index'
|
||||
index['title'] = 'Inspirations alphabetical index'
|
||||
index['categories'] = extended_alphabet
|
||||
write(template_categorical_index.render(index=index), os.path.join(inspirations_path, 'index.html'))
|
||||
|
||||
# inspirations single pages
|
||||
template = environment.get_template('inspirations_for_letter.jinja')
|
||||
for letter in extended_alphabet:
|
||||
write(template.render(letter=letter, inspirations=inspirations_by_alphabet[letter]), os.path.join(inspirations_path, '{}.html'.format(letter.capitalize())))
|
||||
listing = {
|
||||
'title': 'Inspirations ({})'.format(letter.capitalize()),
|
||||
'items': inspirations_by_alphabet[letter]
|
||||
}
|
||||
write(template_listing.render(listing=listing), os.path.join(inspirations_path, '{}.html'.format(letter.capitalize())))
|
||||
|
||||
# developers folder
|
||||
base['url_to'] = partial(url_to, developers_path)
|
||||
base['active_nav'] = 'developers'
|
||||
|
||||
# developers single pages
|
||||
template = environment.get_template('developers_for_letter.jinja')
|
||||
for letter in extended_alphabet:
|
||||
write(template.render(letter=letter, developers=developers_by_alphabet[letter]), os.path.join(developers_path, '{}.html'.format(letter.capitalize())))
|
||||
listing = {
|
||||
'title': 'Developers ({})'.format(letter.capitalize()),
|
||||
'items': developers_by_alphabet[letter]
|
||||
}
|
||||
write(template_listing.render(listing=listing), os.path.join(developers_path, '{}.html'.format(letter.capitalize())))
|
||||
|
||||
# developers index
|
||||
index = divide_in_columns(developers_by_alphabet, developer_index)
|
||||
index['title'] = 'Developers index'
|
||||
index['title'] = 'Developers alphabetical index'
|
||||
index['categories'] = extended_alphabet
|
||||
write(template_categorical_index.render(index=index), os.path.join(developers_path, 'index.html'))
|
||||
|
||||
|
@ -1,71 +1,40 @@
|
||||
{% import "macros.jinja" as macros -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ base['title'] }}</title>
|
||||
<link rel="stylesheet" href="{{ base['url_to']('css/bulma.min.css') }}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ base['title'] }}</title>
|
||||
<link rel="stylesheet" href="{{ base['url_to']('css/bulma.min.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="container navbar" role="navigation" aria-label="main navigation">
|
||||
<nav class="navbar container is-light" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" href="{{ base['url_to']('index.html') }}">
|
||||
Home
|
||||
</a>
|
||||
|
||||
<a class="navbar-item" href="{{ base['url_to']('games/index.html') }}">
|
||||
Games
|
||||
</a>
|
||||
|
||||
<a class="navbar-item" href="{{ base['url_to']('developers/index.html') }}">
|
||||
Developers
|
||||
</a>
|
||||
|
||||
<a class="navbar-item{% if 'index' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('index.html') }}">Home</a>
|
||||
<a class="navbar-item{% if 'games' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('games/index.html') }}">Games</a>
|
||||
<a class="navbar-item{% if 'developers' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('developers/index.html') }}">Developers</a>
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link">
|
||||
Filter
|
||||
</a>
|
||||
|
||||
<a class="navbar-link{% if 'filter' in base['active_nav'] %} is-active{% endif %}">Filter</a>
|
||||
<div class="navbar-dropdown">
|
||||
<a class="navbar-item" href="{{ base['url_to']('inspirations/index.html') }}">
|
||||
By inspiration
|
||||
</a>
|
||||
<a class="navbar-item" href="{{ base['url_to']('games/genres.html') }}">
|
||||
By category
|
||||
</a>
|
||||
<a class="navbar-item" href="{{ base['url_to']('games/languages.html') }}">
|
||||
By code language
|
||||
</a>
|
||||
<a class="navbar-item" href="{{ base['url_to']('games/platforms.html') }}">
|
||||
By OS support
|
||||
</a>
|
||||
<a class="navbar-item{% if 'inspirations' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('inspirations/index.html') }}">By inspiration</a>
|
||||
<a class="navbar-item{% if 'genres' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('games/genres.html') }}">By category</a>
|
||||
<a class="navbar-item{% if 'code language' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('games/languages.html') }}">By code language</a>
|
||||
<a class="navbar-item{% if 'platforms' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('games/platforms.html') }}">By OS support</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="navbar-item" href="{{ base['url_to']('statistics.html') }}">
|
||||
Statistics
|
||||
</a>
|
||||
|
||||
<a class="navbar-item" href="{{ base['url_to']('contribute.html') }}">
|
||||
Contribute
|
||||
</a>
|
||||
|
||||
<a class="navbar-item" href="https://github.com/Trilarion/opensourcegames">
|
||||
On GitHub
|
||||
</a>
|
||||
|
||||
<a class="navbar-item{% if 'statistics' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('statistics.html') }}">Statistics</a>
|
||||
<a class="navbar-item{% if 'contribute' in base['active_nav'] %} is-active{% endif %}" href="{{ base['url_to']('contribute.html') }}">Contribute</a>
|
||||
<a class="navbar-item" href="https://github.com/Trilarion/opensourcegames">On GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container is-size-7">
|
||||
<a href="https://trilarion.blogspot.com/search/label/osgames">Blog</a><br>
|
||||
Last updated on {{ base['creation-date'] }}
|
||||
Last updated on {{ base['creation-date'] }}<br>
|
||||
Disclaimer / License
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
@ -4,21 +4,23 @@
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<div class="box">
|
||||
<h1 class="title">{{ index['title'] }}</h1>
|
||||
{% set comma = joiner(",") %}
|
||||
{% for category in index['categories'] %}
|
||||
{{ comma() }} <a href="#{{ category }}" class="is-size-4">{{ category }}</a> with {{ index['number_entries'][category] }} item(s)
|
||||
{% endfor %}
|
||||
<div class="block"><h1 class="title">{{ index['title'] }}</h1></div>
|
||||
{% set comma = joiner(", ") %}
|
||||
<div class="is-size-4">
|
||||
{% for category in index['categories'] -%}
|
||||
{{ comma() }} <a href="#{{ category }}" class="has-text-weight-semibold">{{ category }}</a> ({{ index['number_entries'][category] }})
|
||||
{%- endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% for category in index['categories'] %}
|
||||
<div class="box">
|
||||
<h2 id="{{ category }}" class="is-size-4">{{ category }}</h2>
|
||||
<div class="block"><h2 id="{{ category }}" class="is-size-4 has-text-weight-semibold">{{ category }}</h2></div>
|
||||
<div class="columns">
|
||||
{% for entries_column in index['entries'][category] %}
|
||||
<div class="column">
|
||||
<ul>
|
||||
{% for entry in entries_column %}
|
||||
<li><a href="{{ base['url_to'](entry['href']) }}">{{ entry['name'] }}</a> {% if 'tags' in entry %}<span class="is-light is-size-7">({{ entry['tags'] }})</span>{% endif %}</li>
|
||||
<li>{{ macros.url(entry['href'], entry['name']) }} {% if 'tags' in entry %}<span class="is-light is-size-7">({{ entry['tags'] }})</span>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -1,4 +1,3 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
@ -1,16 +0,0 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">Developers ({{ letter.capitalize() }})</h1>
|
||||
{% for developer in developers %}
|
||||
<div class="box">
|
||||
<h2 id="{{ developer['anchor-id'] }}">{{ developer['Name'] }}</h2><br>
|
||||
{% set comma = joiner(", ") %}
|
||||
Game(s):{% for game in developer['Games'] %}{{ comma() }}<a href="{{ base['url_to'](game[0]) }}">{{ game[1] }}</a>{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
@ -1,44 +0,0 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">{{ data['title'] }}</h1>
|
||||
{% for g in data['games'] %}
|
||||
<div class="box">
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<h2 id="{{ g['anchor-id'] }}">{{ g['Title'] }}</h2>
|
||||
</div>
|
||||
<div class="level-right is-size-7">
|
||||
<p class="level-item"><a href="{{ base['url_to']('contribute.html') }}">Edit</a></p>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{%- set comma = joiner(", ") -%}
|
||||
Home: {% for url in g['Home'] %}{{ comma() }}<a href="{{ url }}">{{ url }}</a>{% endfor %}<br>
|
||||
{% if 'Inspirations' in g %}
|
||||
{%- set comma = joiner(", ") -%}
|
||||
Inspirations: {% for inspiration in g['Inspirations']%}{{ comma() }}<a href="{{ base['url_to'](inspiration[0]) }}">{{ inspiration[1] }}</a>{% endfor %}<br>
|
||||
{% endif%}
|
||||
{%- set comma = joiner(", ") -%}
|
||||
{% if 'Media' in g %}Media: {% for url in g['Media'] %}{{ comma() }}<a href="{{ url }}">{{ url }}</a>{% endfor %}<br>{% endif%}
|
||||
{%- set comma = joiner(", ") -%}
|
||||
{% if 'Download' in g %}Download: {% for url in g['Download'] %}{{ comma() }}<a href="{{ url }}">{{ url }}</a>{% endfor %}<br>{% endif%}
|
||||
{%- set comma = joiner(", ") -%}
|
||||
{% if 'Play' in g %}Play: {% for url in g['Play'] %}{{ comma() }}<a href="{{ url }}">{{ url }}</a>{% endfor %}<br>{% endif%}
|
||||
{% if 'Developer' in g %}
|
||||
{%- set comma = joiner(", ") -%}
|
||||
Developer: {% for developer in g['Developer']%}{{ comma() }}<a href="{{ base['url_to'](developer[0]) }}">{{ developer[1] }}</a>{% endfor %}<br>{% endif%}
|
||||
{% if 'Note' in g %}{{ g['Note'] }}<br>{% endif%}
|
||||
Technical info<br>
|
||||
{%- set comma = joiner(", ") -%}
|
||||
Language: {% for language in g['Code language'] %}{{ comma() }}{{ language }}{% endfor %}<br>
|
||||
{%- set comma = joiner(", ") -%}
|
||||
License: {% for license in g['Code license'] %}{{ comma() }}{{ license }}{% endfor %}<br>
|
||||
{% if 'Build system' in g['Building'] %}Build system: <br>{% endif%}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
@ -1,12 +1,14 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<section class="hero is-light is-bold">
|
||||
<div class="hero-body">
|
||||
<div class="container">
|
||||
<h1 class="title">Open source games list (OSGL)</h1>
|
||||
<p class="subtitle">
|
||||
Contains information about {{ index['number_games'] }} open source games.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
@ -1,17 +0,0 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">Inspirations ({{ letter.capitalize() }})</h1>
|
||||
{% for inspiration in inspirations %}
|
||||
<div class="box">
|
||||
<h2 id="{{ inspiration['anchor-id'] }}">{{ inspiration['Name'] }}</h2><br>
|
||||
{% if 'Media' in inspiration %}Media: {{ inspiration['Media'] }}<br>{% endif %}
|
||||
{% set comma = joiner(", ") %}
|
||||
Inspired entries: {% for game in inspiration['Inspired entries'] %}{{ comma() }}<a href="{{ base['url_to'](game[0]) }}">{{ game[1] }}</a>{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
@ -1,14 +0,0 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1>{{ data['title'] }}</h1>
|
||||
<ul>
|
||||
{% for item in data['items'] %}
|
||||
<li>{{ item }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
24
code/html/listing.jinja
Normal file
24
code/html/listing.jinja
Normal file
@ -0,0 +1,24 @@
|
||||
{% extends "base.jinja" %}
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">{{ listing['title'] }}</h1>
|
||||
{% for item in listing['items'] %}
|
||||
<div class="box">
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<h2 id="{{ item['anchor-id'] }}" class="title is-4">{{ item['name'] }}</h2>
|
||||
</div>
|
||||
<div class="level-right is-size-7">
|
||||
<p class="level-item"><a href="{{ base['url_to']('contribute.html') }}">Edit</a></p>
|
||||
</div>
|
||||
</nav>
|
||||
{% for field in item['fields'] %}{% set comma = joiner(", ") %}
|
||||
{{ macros.listing_field_title(field['title']) }}{% for entry in field['entries'] %}{{ comma() }}{{ macros.url(entry['href'], entry['name']) }}{% endfor %}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<a class="is-light is-size-7" href="#">Back to top</a>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
13
code/html/macros.jinja
Normal file
13
code/html/macros.jinja
Normal file
@ -0,0 +1,13 @@
|
||||
{% macro url(href, name) -%}
|
||||
{% if href %}
|
||||
<a href="{{ base['url_to'](href) }}">{{ name }}</a>
|
||||
{% else %}
|
||||
{{ name }}
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro listing_field_title(title) -%}
|
||||
{% if title %}
|
||||
{{ title['name'] }}:
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
@ -1,9 +1,7 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">{{ data['title'] }}</h1>
|
||||
{% set comma = joiner(",") %}
|
||||
{% for section in data['sections'] %}
|
||||
@ -24,5 +22,4 @@
|
||||
</div>
|
||||
</section>
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
@ -1,4 +1,3 @@
|
||||
{% extends "base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
@ -90,7 +90,9 @@ license_urls = {
|
||||
'3-clause BSD': 'https://en.wikipedia.org/wiki/BSD_licenses#3-clause_license_(%22BSD_License_2.0%22,_%22Revised_BSD_License%22,_%22New_BSD_License%22,_or_%22Modified_BSD_License%22)',
|
||||
'AFL-3.0': 'https://en.wikipedia.org/wiki/Academic_Free_License',
|
||||
'AGPL-3.0': 'https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License',
|
||||
'Apache-2.0': 'https://en.wikipedia.org/wiki/Apache_License'
|
||||
'Apache-2.0': 'https://en.wikipedia.org/wiki/Apache_License',
|
||||
'GPL-2.0': 'https://en.wikipedia.org/wiki/GNU_General_Public_License#Version_2',
|
||||
'GPL-3.0': 'https://en.wikipedia.org/wiki/GNU_General_Public_License#Version_3'
|
||||
}
|
||||
|
||||
# valid multiplayer modes (can be combined with "+" )
|
||||
@ -116,10 +118,12 @@ general_code_dependencies_without_entry = {'OpenGL': 'https://www.opengl.org/',
|
||||
|
||||
# developer information (in the file all fields will be capitalized)
|
||||
essential_developer_fields = ('Name', 'Games')
|
||||
valid_developer_fields = essential_developer_fields + ('Contact', 'Home', 'Organization')
|
||||
optional_developer_fields = ('Contact', 'Home', 'Organization')
|
||||
valid_developer_fields = essential_developer_fields + optional_developer_fields
|
||||
url_developer_fields = ('Home',)
|
||||
|
||||
# inspiration/original game information (in the file all fields will be capitalized)
|
||||
essential_inspiration_fields = ('Name', 'Inspired entries')
|
||||
valid_inspiration_fields = essential_inspiration_fields + ('Media',)
|
||||
optional_inspiration_fields = ('Media',)
|
||||
valid_inspiration_fields = essential_inspiration_fields + optional_inspiration_fields
|
||||
url_inspiration_fields = ('Media',)
|
Loading…
x
Reference in New Issue
Block a user