add metadata links to mod compatibility list

This commit is contained in:
Jesse Plamondon-Willard 2019-07-14 17:49:33 -04:00
parent 1053232c20
commit 48f211f544
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
6 changed files with 38 additions and 1 deletions

View File

@ -24,6 +24,10 @@ These changes have not been released yet.
* Fixed map reloads not updating door warps. * Fixed map reloads not updating door warps.
* Fixed outdoor tilesheets being seasonalised when added to an indoor location. * Fixed outdoor tilesheets being seasonalised when added to an indoor location.
* For the mod compatibility list:
* Clicking a mod link now automatically adds it to the visible mods when the list is filtered.
* Added metadata links to advanced info, if any.
* For modders: * For modders:
* Mods are now loaded much earlier in the game launch. This lets mods intercept any content asset, but the game is not fully initialised when `Entry` is called (use the `GameLaunched` event if you need to run code when the game is initialised). * Mods are now loaded much earlier in the game launch. This lets mods intercept any content asset, but the game is not fully initialised when `Entry` is called (use the `GameLaunched` event if you need to run code when the game is initialised).
* Added support for content pack translations. * Added support for content pack translations.

View File

@ -127,6 +127,15 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
} }
} }
// parse links
List<Tuple<Uri, string>> metadataLinks = new List<Tuple<Uri, string>>();
foreach (HtmlNode linkElement in node.Descendants("td").Last().Descendants("a").Skip(1)) // skip anchor link
{
string text = linkElement.InnerText.Trim();
Uri url = new Uri(linkElement.GetAttributeValue("href", ""));
metadataLinks.Add(Tuple.Create(url, text));
}
// yield model // yield model
yield return new WikiModEntry yield return new WikiModEntry
{ {
@ -143,6 +152,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
Compatibility = compatibility, Compatibility = compatibility,
BetaCompatibility = betaCompatibility, BetaCompatibility = betaCompatibility,
Warnings = warnings, Warnings = warnings,
MetadataLinks = metadataLinks.ToArray(),
Anchor = anchor Anchor = anchor
}; };
} }

View File

@ -1,3 +1,6 @@
using System;
using System.Collections.Generic;
namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
{ {
/// <summary>A mod entry in the wiki list.</summary> /// <summary>A mod entry in the wiki list.</summary>
@ -48,6 +51,9 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
/// <summary>The human-readable warnings for players about this mod.</summary> /// <summary>The human-readable warnings for players about this mod.</summary>
public string[] Warnings { get; set; } public string[] Warnings { get; set; }
/// <summary>Extra metadata links (usually for open pull requests).</summary>
public Tuple<Uri, string>[] MetadataLinks { get; set; }
/// <summary>The link anchor for the mod entry in the wiki compatibility list.</summary> /// <summary>The link anchor for the mod entry in the wiki compatibility list.</summary>
public string Anchor { get; set; } public string Anchor { get; set; }
} }

View File

@ -58,6 +58,9 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki
/// <summary>The human-readable warnings for players about this mod.</summary> /// <summary>The human-readable warnings for players about this mod.</summary>
public string[] Warnings { get; set; } public string[] Warnings { get; set; }
/// <summary>Extra metadata links (usually for open pull requests).</summary>
public Tuple<Uri, string>[] MetadataLinks { get; set; }
/// <summary>The link anchor for the mod entry in the wiki compatibility list.</summary> /// <summary>The link anchor for the mod entry in the wiki compatibility list.</summary>
public string Anchor { get; set; } public string Anchor { get; set; }
@ -122,6 +125,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki
this.CustomSourceUrl = mod.CustomSourceUrl; this.CustomSourceUrl = mod.CustomSourceUrl;
this.CustomUrl = mod.CustomUrl; this.CustomUrl = mod.CustomUrl;
this.ContentPackFor = mod.ContentPackFor; this.ContentPackFor = mod.ContentPackFor;
this.MetadataLinks = mod.MetadataLinks;
this.Warnings = mod.Warnings; this.Warnings = mod.Warnings;
this.Anchor = mod.Anchor; this.Anchor = mod.Anchor;
@ -156,6 +160,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki
CustomUrl = this.CustomUrl, CustomUrl = this.CustomUrl,
ContentPackFor = this.ContentPackFor, ContentPackFor = this.ContentPackFor,
Warnings = this.Warnings, Warnings = this.Warnings,
MetadataLinks = this.MetadataLinks,
Anchor = this.Anchor, Anchor = this.Anchor,
// stable compatibility // stable compatibility

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki;
@ -37,6 +38,9 @@ namespace StardewModdingAPI.Web.ViewModels
/// <summary>The human-readable warnings for players about this mod.</summary> /// <summary>The human-readable warnings for players about this mod.</summary>
public string[] Warnings { get; set; } public string[] Warnings { get; set; }
/// <summary>Extra metadata links (usually for open pull requests).</summary>
public Tuple<Uri, string>[] MetadataLinks { get; set; }
/// <summary>A unique identifier for the mod that can be used in an anchor URL.</summary> /// <summary>A unique identifier for the mod that can be used in an anchor URL.</summary>
public string Slug { get; set; } public string Slug { get; set; }
@ -61,6 +65,7 @@ namespace StardewModdingAPI.Web.ViewModels
this.BetaCompatibility = entry.BetaCompatibility != null ? new ModCompatibilityModel(entry.BetaCompatibility) : null; this.BetaCompatibility = entry.BetaCompatibility != null ? new ModCompatibilityModel(entry.BetaCompatibility) : null;
this.ModPages = this.GetModPageUrls(entry).ToArray(); this.ModPages = this.GetModPageUrls(entry).ToArray();
this.Warnings = entry.Warnings; this.Warnings = entry.Warnings;
this.MetadataLinks = entry.MetadataLinks;
this.Slug = entry.Anchor; this.Slug = entry.Anchor;
} }

View File

@ -92,7 +92,14 @@
<span v-else class="mod-closed-source">no source</span> <span v-else class="mod-closed-source">no source</span>
</td> </td>
<td> <td>
<small><a v-bind:href="'#' + mod.Slug">#</a></small> <small>
<a v-bind:href="'#' + mod.Slug">#</a>
<span v-show="showAdvanced">
<template v-for="(link, i) in mod.MetadataLinks">
<a v-bind:href="link.Item1">{{link.Item2}}</a>
</template>
</span>
</small>
</td> </td>
</tr> </tr>
</tbody> </tbody>