Skip to content

Commit

Permalink
upgrade no ads, fix liquid + js description mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
apple1417 committed Dec 7, 2024
1 parent f22f654 commit b1741d8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 25 deletions.
4 changes: 2 additions & 2 deletions _layouts/mod.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ <h1 id="title">{{ page.title }}</h1>
{{ content }}
{%- else -%}
{%- assign using_description_override = false -%}
<p>{{ page.pyproject.project.description | strip_html }}</p>
<p markdown="0">{{ page.pyproject.project.description | strip_html }}</p>
{%- endif -%}
</div>

{%- if page.legacy != "" -%}
{%- if page.legacy -%}
<p class="warning">
This is a legacy mod, which will be run in compatibility mode. It may behave slightly odd, and
it may stop working at some point in the future.
Expand Down
21 changes: 0 additions & 21 deletions _mods/NoAds.md

This file was deleted.

3 changes: 3 additions & 0 deletions _mods/no_ads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
pyproject_url: https://raw.githubusercontent.com/apple1417/willow2-sdk-mods/master/no_ads/pyproject.toml
---
5 changes: 3 additions & 2 deletions assets/js/pyproject-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function load_from_pyproject(url, fields) {

if (fields?.games) {
const ALLOWED_GAMES = {"BL2": "BL2", "TPS": "TPS", "AODK": "AoDK"};
const game_list = pyproject?.tool?.sdkmod?.supported_games || ALLOWED_GAMES;
const game_list = pyproject?.tool?.sdkmod?.supported_games || Object.keys(ALLOWED_GAMES);
const filtered_games = [...new Set(game_list.filter(x => x.toUpperCase() in ALLOWED_GAMES)
.map(x => ALLOWED_GAMES[x.toUpperCase()]))];
if (filtered_games) {
Expand Down Expand Up @@ -213,7 +213,8 @@ async function load_from_pyproject(url, fields) {
const paragraph = document.createElement("p");

// Strip html from the description to not show any tags meant for the mod
paragraph.innerText = strip_decode_html(description);
// Set innerHTML so that newlines get converted like from the markdown (i.e. they don't)
paragraph.innerHTML = strip_decode_html(description);

description_div.innerHTML = "";
description_div.appendChild(paragraph);
Expand Down

0 comments on commit b1741d8

Please sign in to comment.