From bda1f0ee35aee2460fee3c8bcf3c53b1b8ecdd35 Mon Sep 17 00:00:00 2001 From: Matthias Weiss Date: Thu, 28 Nov 2024 14:18:12 +0100 Subject: [PATCH] Moved taglist outside of page class --- .../File/Markdown/MarkdownConverter.cs | 3 +- .../Commands/File/Markdown/MarkdownWriter.cs | 2 +- OneMore/Models/Page.cs | 54 +++++++++---------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/OneMore/Commands/File/Markdown/MarkdownConverter.cs b/OneMore/Commands/File/Markdown/MarkdownConverter.cs index 9325630ff2..9a4790be75 100644 --- a/OneMore/Commands/File/Markdown/MarkdownConverter.cs +++ b/OneMore/Commands/File/Markdown/MarkdownConverter.cs @@ -7,6 +7,7 @@ namespace River.OneMoreAddIn.Commands using River.OneMoreAddIn.Models; using River.OneMoreAddIn.Styles; using System.Collections.Generic; + using System.Globalization; using System.Linq; using System.Text.RegularExpressions; using System.Xml.Linq; @@ -195,7 +196,7 @@ public MarkdownConverter RewriteTodo(IEnumerable paragraphs) else { // look for all other tags - foreach (var t in page.taglist) + foreach (var t in Page.taglist) { // check for other tags if (text.Value.Contains(t.name)) diff --git a/OneMore/Commands/File/Markdown/MarkdownWriter.cs b/OneMore/Commands/File/Markdown/MarkdownWriter.cs index 7dfd9e91b4..b3273e2c8f 100644 --- a/OneMore/Commands/File/Markdown/MarkdownWriter.cs +++ b/OneMore/Commands/File/Markdown/MarkdownWriter.cs @@ -438,7 +438,7 @@ private string WriteTag(XElement element, bool contained) .Select(e => int.Parse(e.Attribute("symbol").Value)) .FirstOrDefault(); var retValue = ""; - var tagSymbol = page.taglist.Find(x => x.id == symbol.ToString()); + var tagSymbol = Page.taglist.Find(x => x.id == symbol.ToString()); switch (symbol) { case 3: // to do diff --git a/OneMore/Models/Page.cs b/OneMore/Models/Page.cs index 1646c962bf..176712b5dc 100644 --- a/OneMore/Models/Page.cs +++ b/OneMore/Models/Page.cs @@ -28,33 +28,6 @@ internal partial class Page private const string HashAttributeName = "omHash"; - public List<(string name, string id, string topic, int type)> taglist = new List<(string name, string id, string topic, int type)> - { -// (":todo:", "3", "todo" , 0), - (":question:", "6", "question" , 0), - (":star:", "13", "important", 0 ), - (":exclamation:", "17", "critical", 0), - (":phone:", "18", "phone", 0), - (":bulb:", "21", "idea", 0), - (":house:", "23", "address", 0), - (":three:", "33", "three", 0), - (":zero:", "39", "zero", 0), - (":two:", "51", "two", 0), - (":arrow_right:", "59", "main agenda item", 0), - (":one:", "70", "one", 0), - (":information_desk_person:","94", "discuss person a/b", 21), - (":bellsymbol:", "97", "bellsymbol", 0), - (":busts_in_silhouette:", "116", "busts_in_silhouette", 0), - (":bell:", "117", "bell", 0), - (":letter:", "118", "letter", 0), - (":musical_note:", "121", "musical_note", 0), - (":secret:", "131", "idea", 0), - (":book:", "132", "book", 0), - (":movie_camera:", "133", "movie_camera", 0), - (":zap:", "140", "lightning_bolt", 0), - (":o:", "1", "default", 0) - }; - /// /// Initialize a new instance with the given page XML root /// @@ -148,6 +121,33 @@ public void OptimizeForSave(bool keep) public bool IsValid => Root != null; + public static List<(string name, string id, string topic, int type)> taglist = new List<(string name, string id, string topic, int type)> + { +// (":todo:", "3", "todo" , 0), + (":question:", "6", "question" , 0), + (":star:", "13", "important", 0 ), + (":exclamation:", "17", "critical", 0), + (":phone:", "18", "phone", 0), + (":bulb:", "21", "idea", 0), + (":house:", "23", "address", 0), + (":three:", "33", "three", 0), + (":zero:", "39", "zero", 0), + (":two:", "51", "two", 0), + (":arrow_right:", "59", "main agenda item", 0), + (":one:", "70", "one", 0), + (":information_desk_person:","94", "discuss person a/b", 21), + (":bellsymbol:", "97", "bellsymbol", 0), + (":busts_in_silhouette:", "116", "busts_in_silhouette", 0), + (":bell:", "117", "bell", 0), + (":letter:", "118", "letter", 0), + (":musical_note:", "121", "musical_note", 0), + (":secret:", "131", "idea", 0), + (":book:", "132", "book", 0), + (":movie_camera:", "133", "movie_camera", 0), + (":zap:", "140", "lightning_bolt", 0), + (":o:", "1", "default", 0) + }; + /// /// Gets the namespace used to create new elements for the page