From 21fb0187251d3195f9a983c696025318ab619994 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Mon, 27 May 2019 17:37:34 -0500 Subject: [PATCH] Bumped version Added support for custom link colors --- BSIPA-ModList/README.md | 4 +++- .../UI/ViewControllers/MarkdownView.cs | 19 +++++++++++++++---- BSIPA-ModList/manifest.json | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/BSIPA-ModList/README.md b/BSIPA-ModList/README.md index c3b4cdfd..fe2f7bdd 100644 --- a/BSIPA-ModList/README.md +++ b/BSIPA-ModList/README.md @@ -2,4 +2,6 @@ ============== Mod List is just an in-game viewer for the mods you have installed. It also lets you have more control over the updating already present in BSIPA. -Find all builds in [AppVeyor](https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/build/artifacts). \ No newline at end of file +Find all builds in [AppVeyor][appv_link]. + +[appv_link]: https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/build/artifacts "{color: #00FF00}" \ No newline at end of file diff --git a/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs b/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs index 9a8d4222..ef989f6e 100644 --- a/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs +++ b/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs @@ -13,6 +13,8 @@ using UnityEngine.EventSystems; using System.Diagnostics; using System.Collections; using System.IO; +using System.Text; +using System.Text.RegularExpressions; namespace BSIPA_ModList.UI.ViewControllers { @@ -283,8 +285,10 @@ namespace BSIPA_ModList.UI.ViewControllers None = 0, Bold = 1, Italic = 2, Underline = 4, Strikethrough = 8, } - private const string LinkDefaultColor = "#0061ff"; - private const string LinkHoverColor = "#009dff"; + private const string LinkDefaultColor = "#59B0F4"; + // private const string LinkHoverColor = "#009dff"; + + private static readonly Regex linkRefTitleColorRegex = new Regex(@"\{\s*color:\s*#?([a-fA-F0-9]{6})\s*\}", RegexOptions.Compiled | RegexOptions.Singleline); const float PSize = 3.5f; const float BlockCodeSize = PSize - .5f; @@ -597,7 +601,6 @@ namespace BSIPA_ModList.UI.ViewControllers break; case BlockTag.ReferenceDefinition: // i have no idea what the state looks like here - //block.DebugPrintTo(Logger.md.Info, 5); break; } } @@ -690,8 +693,16 @@ namespace BSIPA_ModList.UI.ViewControllers case InlineTag.Link: EnsureText(); Flag(CurrentTextFlags.Underline); + + var color = LinkDefaultColor; + var targetUrl = ResolveUri(inl.TargetUrl); + + var m = linkRefTitleColorRegex.Match(inl.LiteralContent); + if (m.Success) + color = "#" + m.Groups[1].Value; + if (node.IsOpening) - currentText.text += $""; + currentText.text += $""; else if (node.IsClosing) currentText.text += ""; break; diff --git a/BSIPA-ModList/manifest.json b/BSIPA-ModList/manifest.json index c9d9579c..cb6c70ba 100644 --- a/BSIPA-ModList/manifest.json +++ b/BSIPA-ModList/manifest.json @@ -11,7 +11,7 @@ "gameVersion": "1.0.1", "id": "BSIPA Mod List", "name": "BSIPA Mod List", - "version": "1.2.3", + "version": "1.2.4", "icon": "BSIPA_ModList.Icons.self.png", "dependsOn": { "BSIPA": "^3.12.19",