mirror of
https://github.com/xoofx/markdig.git
synced 2026-11-18 10:21:28 +00:00
Fixes problem with multiple, similar abbreviations not parsing correctly.
This commit is contained in:
@@ -45,3 +45,15 @@ This is a 😃 HTML document
|
||||
.
|
||||
<p>This is a <abbr title="Hypertext Markup Language">😃 HTML</abbr> document</p>
|
||||
````````````````````````````````
|
||||
|
||||
Abbreviations may be similar:
|
||||
|
||||
```````````````````````````````` example
|
||||
*[1A]: First
|
||||
*[1A1]: Second
|
||||
*[1A2]: Third
|
||||
|
||||
We can abbreviate 1A, 1A1 and 1A2!
|
||||
.
|
||||
<p>We can abbreviate <abbr title="First">1A</abbr>, <abbr title="Second">1A1</abbr> and <abbr title="Third">1A2</abbr>!</p>
|
||||
````````````````````````````````
|
||||
|
||||
@@ -18226,6 +18226,30 @@ namespace Markdig.Tests
|
||||
Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 4, "Extensions Abbreviation");
|
||||
TestParser.TestSpec("*[😃 HTML]: Hypertext Markup Language\n\nThis is a 😃 HTML document ", "<p>This is a <abbr title=\"Hypertext Markup Language\">😃 HTML</abbr> document</p>", "abbreviations|advanced");
|
||||
}
|
||||
}
|
||||
// Abbreviations may be similar:
|
||||
[TestFixture]
|
||||
public partial class TestExtensionsAbbreviation
|
||||
{
|
||||
[Test]
|
||||
public void Example005()
|
||||
{
|
||||
// Example 5
|
||||
// Section: Extensions Abbreviation
|
||||
//
|
||||
// The following CommonMark:
|
||||
// *[1A]: First
|
||||
// *[1A1]: Second
|
||||
// *[1A2]: Third
|
||||
//
|
||||
// We can abbreviate 1A, 1A1 and 1A2!
|
||||
//
|
||||
// Should be rendered as:
|
||||
// <p>We can abbreviate <abbr title="First">1A</abbr>, <abbr title="Second">1A1</abbr> and <abbr title="Third">1A2</abbr>!</p>
|
||||
|
||||
Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 5, "Extensions Abbreviation");
|
||||
TestParser.TestSpec("*[1A]: First\n*[1A1]: Second\n*[1A2]: Third\n\nWe can abbreviate 1A, 1A1 and 1A2!", "<p>We can abbreviate <abbr title=\"First\">1A</abbr>, <abbr title=\"Second\">1A1</abbr> and <abbr title=\"Third\">1A2</abbr>!</p>", "abbreviations|advanced");
|
||||
}
|
||||
}
|
||||
// # Extensions
|
||||
//
|
||||
|
||||
@@ -53,17 +53,17 @@ namespace Markdig.Helpers
|
||||
CharNode nextNode;
|
||||
if (!node.TryGetValue(c, out nextNode))
|
||||
{
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
node = nextNode;
|
||||
if (node.Content != null)
|
||||
{
|
||||
match = node.Content;
|
||||
return true;
|
||||
}
|
||||
offset++;
|
||||
length--;
|
||||
}
|
||||
if (node.Content != null)
|
||||
{
|
||||
match = node.Content;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user