Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,30 @@ def generate(game: str):

index = process_scripts(data, decompiled_dir_ch)

related = {}

for section in index.sections.values():
if section.name == 'Scripts':
continue

for entries in section.entries.values():
names = [entry.name for entry in entries]
for entry in entries:
related[entry.name] = names

logger.info(f"['{chapter}'] Rendering index...")

write_index(index, data, output_dir_ch)

logger.info(f"['{chapter}'] Rendering scripts' pages...")

for script in tqdm(index.text.keys(), disable=None):
rendered = render_script(script, index.text, data)
rendered = render_script(
script,
index.text,
data,
related.get(script, [])
)

write_script(rendered, script, output_dir_ch)

Expand All @@ -157,14 +173,30 @@ def generate(game: str):

index = process_scripts(data, decompiled_dir)

related = {}

for section in index.sections.values():
if section.name == 'Scripts':
continue

for entries in section.entries.values():
rel_entries = [entry for entry in entries]
for entry in entries:
related[entry.name] = rel_entries

logger.info('Rendering index...')

write_index(index, data, output_dir)

logger.info("Rendering scripts' pages...")

for script in tqdm(index.text.keys(), disable=None):
rendered = render_script(script, index.text, data)
rendered = render_script(
script,
index.text,
data,
related.get(script, [])
)

write_script(rendered, script, output_dir)

Expand Down
10 changes: 7 additions & 3 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
import sys
from pathlib import Path
from typing import Dict, List
from typing import Dict, List, Optional

from jinja2 import Environment, FileSystemLoader, select_autoescape

Expand Down Expand Up @@ -306,7 +306,10 @@ def process_line(


def render_script(
script_name: str, text: Dict[str, List[str]], data: Data
script_name: str,
text: Dict[str, List[str]],
data: Data,
related_scripts: Optional[List[str]] = []
) -> str:
lines = [
process_line(line, script_name, text, data)
Expand All @@ -320,9 +323,10 @@ def render_script(
script_name=script_name,
raw_url=f'/raw{chapter_segment}/{script_name}.txt',
lines=lines,
related_scripts=related_scripts,
game=data.get_game_name(),
links=data.get_game_links(),
footer=data.get_game_footer(),
footer=data.get_game_footer()
)


Expand Down
53 changes: 53 additions & 0 deletions static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,59 @@
--function-box-background-color: rgba(30, 50, 30, 0.9);
}

@media (prefers-color-scheme: light) {
:root {
--background: #111;
--secondary-background: #080808;
--text-color: #CCC;
--link-color: #8AD;
--link-hover-color: #ADF;
--border-color: #999;
--junk-text-color: #999;

--selected-line-background-color: #333;
--lang-var-text-color: #c7d;
--lang-var-background-color: black;
--lang-var-border-color: #836;
--lang-text-text-color: #fbe;
--lang-text-background-color: black;
--lang-text-border-color: #969;
--wait-background-color: #555;
--wait-text-color: #fff;
--delay-background-color: #111;
--delay-text-color: #666;
--delay-collapsed-text-color: #aaa;
--close-background-color: #844;
--close-text-color: #fff;
--face-background-color: #252;
--face-text-color: #8c8;
--arg-background-color: #707;
--arg-text-color: #fff;
--arg-collapsed-text-color: #aaa;
--flag-not-found-text-color: #ec6;
--flag-found-text-color: #fd8;
--flag-found-background-color: black;
--flag-description-text-color: #ca4;
--room-text-color: #8f8;
--room-background-color: black;
--room-description-text-color: #494;
--alarm-link-text-color: #faa;
--alarm-link-text-color--hover: white;
--alarm-link-underline-color: #a66;
--alarm-box-border-color: #888;
--alarm-box-background-color: #222;
--alarm-connection-line-color: #444;
--alarm-background-color--hover: #400;
--alarm-border-color--hover: #f88;
--function-link-text-color: #8f8;
--function-link-underline-color: #292;
--function-link-background-color--hover: #272;
--function-link-text-color--hover: white;
--function-box-border-color: #8f8;
--function-box-background-color: rgba(30, 50, 30, 0.9);
}
}

html, body {
width: 100%;
height: 100%;
Expand Down
16 changes: 16 additions & 0 deletions templates/script_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ <h1>{{ game }} script viewer</h1>
<strong><a href="index.html">&larr; back to main script listing</a></strong><br>

<h2>{{ script_name }}</h2>

{% if related_scripts is defined and related_scripts|length > 0 %}
<div>
<strong>related scripts:</strong>
{% for script in related_scripts %}
{% if (script.prefix + script.suffix) == script_name %}
<strong>{{ script.suffix }} </strong>
{% else %}
<a href="{{ script.url }}">{{ script.suffix }}</a>
{% endif %}
{% if not loop.last %} &bull; {% endif %}
{% endfor %}
</div>
<br />
{% endif %}

<small>(<a href="{{ raw_url }}">view raw script w/o annotations or w/e</a>)</small>

<table class="code">
Expand Down
Loading