Skip to content

Commit

Permalink
Moved MarkdownEmojis into own class and file
Browse files Browse the repository at this point in the history
  • Loading branch information
weissm committed Jan 1, 2025
1 parent 7995639 commit 367d126
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion OneMore/Commands/File/Markdown/MarkdownConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public MarkdownConverter RewriteTodo(IEnumerable<XElement> paragraphs)
else
{
// look for all other tags
foreach (var t in Page.taglist)
foreach (var t in MarkdownEmojis.taglist)
{
// check for other tags
if (text.Value.Contains(t.name))
Expand Down
36 changes: 36 additions & 0 deletions OneMore/Commands/File/Markdown/MarkdownEmojis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.Generic;

namespace River.OneMoreAddIn.Commands
{
public static class MarkdownEmojis
{
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)
};


}
}
2 changes: 1 addition & 1 deletion OneMore/Commands/File/Markdown/MarkdownWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = MarkdownEmojis.taglist.Find(x => x.id == symbol.ToString());
switch (symbol)
{
case 3: // to do
Expand Down
4 changes: 1 addition & 3 deletions OneMore/Commands/File/Markdown/OneMoreDigExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ namespace River.OneMoreAddIn.Commands
using Markdig.Extensions.Emoji;
using System.Collections.Generic;
using System.Linq;
using River.OneMoreAddIn.Helpers.Office;
using System.Web.UI.WebControls;

internal static class OneMoreDigExtensions
{
Expand All @@ -21,7 +19,7 @@ public static MarkdownPipelineBuilder UseOneMoreExtensions(
var emojiDicNew = new Dictionary<string, string>();
foreach (var mappings in emojiDic)
{
var tagName = Models.Page.taglist.FirstOrDefault(x => x.name.Equals(mappings.Key)).name;
var tagName = MarkdownEmojis.taglist.FirstOrDefault(x => x.name.Equals(mappings.Key)).name;
if (tagName.IsNullOrEmpty())
{
emojiDicNew.Add(mappings.Key,mappings.Value);
Expand Down
28 changes: 0 additions & 28 deletions OneMore/Models/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,34 +121,6 @@ public void OptimizeForSave(bool keep)

public bool IsValid => Root is not 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)
};


/// <summary>
/// Gets the namespace used to create new elements for the page
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions OneMore/OneMore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
</Compile>
<Compile Include="Commands\Edit\ConvertMarkdownCommand.cs" />
<Compile Include="Commands\Edit\CopyAsTextCommand.cs" />
<Compile Include="Commands\File\Markdown\MarkdownEmojis.cs" />
<Compile Include="Commands\File\Markdown\WikilinkExtension.cs" />
<Compile Include="Commands\File\Markdown\WikilinkParser.cs" />
<Compile Include="Commands\File\Markdown\WikilinkRenderer.cs" />
Expand Down

0 comments on commit 367d126

Please sign in to comment.