Skip to content

Commit 0b7e82d

Browse files
Fix raw script URLs in script pages.
1 parent 39fdd8c commit 0b7e82d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

script.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,14 @@ def render_script(
265265
process_line(line, script_name, text, data)
266266
for line in text[script_name]
267267
]
268+
chapters = data.get_chapters()
269+
if chapters is None:
270+
chapter_segment = ''
271+
else:
272+
chapter_segment = f'/{chapters[data.chapter]}'
268273
return env.get_template('script_page.html').render(
269274
script_name=script_name,
275+
raw_url=f"/raw{chapter_segment}/{script_name}.txt",
270276
lines=lines,
271277
game=data.get_game_name(),
272278
links=data.get_game_links(),

templates/script_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1>{{ game }} script viewer</h1>
1414
<strong><a href="index.html">&larr; back to main script listing</a></strong><br>
1515

1616
<h2>{{ script_name }}</h2>
17-
<small>(<a href="raw/{{ script_name }}.txt">view raw script w/o annotations or w/e</a>)</small>
17+
<small>(<a href="{{ raw_url }}">view raw script w/o annotations or w/e</a>)</small>
1818

1919
<table class="code">
2020
{% for line in lines %}

0 commit comments

Comments
 (0)