-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from whistyun/fix_bug
Fix bug
- Loading branch information
Showing
13 changed files
with
552 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Avalonia.Collections; | ||
using Avalonia.Controls; | ||
using Avalonia.Metadata; | ||
using Markdown.Avalonia.Utils; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Markdown.Avalonia | ||
{ | ||
public class ContainerSwitch : AvaloniaDictionary<string, IContainerBlockHandler>, IContainerBlockHandler | ||
{ | ||
public Border ProvideControl(string assetPathRoot, string blockName, string lines) | ||
{ | ||
// blockName may be "name [title] (url) {option}". | ||
// This collect some character until "[", "(" or "{". | ||
var trimedBlockName = blockName.Trim(); | ||
var match = Regex.Match(trimedBlockName, @"[\(\[\{]"); | ||
if (match.Success) | ||
{ | ||
trimedBlockName = trimedBlockName.Substring(0, match.Index).Trim(); | ||
} | ||
|
||
if (this.TryGetValue(trimedBlockName, out var processor)) | ||
{ | ||
return processor.ProvideControl(assetPathRoot, blockName, lines); | ||
} | ||
else return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.