Fix issue while detecting generic attributes that was breaking parsing (issue #16)

This commit is contained in:
Alexandre Mutel
2016-06-20 13:42:15 +09:00
parent 3821bd00fe
commit cab3365104
2 changed files with 17 additions and 1 deletions

View File

@@ -46,7 +46,7 @@ namespace Markdig.Extensions.GenericAttributes
// Try to find if there is any attributes { in the info string on the first line of a FencedCodeBlock
if (line.Start < line.End)
{
var indexOfAttributes = line.Text.LastIndexOf('{', line.End);
int indexOfAttributes = line.IndexOf('{');
if (indexOfAttributes >= 0)
{
// Work on a copy

View File

@@ -221,6 +221,22 @@ namespace Markdig.Helpers
return false;
}
/// <summary>
/// Searches for the specified character within this slice.
/// </summary>
/// <returns>A value >= 0 if the character was found, otherwise &lt; 0</returns>
public int IndexOf(char c)
{
for (int i = Start; i <= End; i++)
{
if (Text[i] == c)
{
return i;
}
}
return -1;
}
/// <summary>
/// Searches the specified text within this slice (matching lowercase).
/// </summary>