Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roman Numeral V (5) is not computing correctly #772

Open
Matt-Scheetz opened this issue Feb 14, 2024 · 1 comment
Open

Roman Numeral V (5) is not computing correctly #772

Matt-Scheetz opened this issue Feb 14, 2024 · 1 comment

Comments

@Matt-Scheetz
Copy link

Looks like Roman Numeral V does not generate if there are sub-items under the previous item, IV.
Here are tests I ran. Only 1 and 3 passed.

  1. I have a simple list of 6 items it gets correctly converted to a roman numeral html list:
    image
[Test, Description("Simple List")]
public void TestListCreation()
{
    // Arrange
    var input = "Test list:\n\nI. Intro\n\nII. Background\n\nIII. Overall\n\nIV. Conclusion\n\nV. References\n\nVI. Appendix";
    var expected = "<p>Test list:</p>\n<ol type=\"I\">\n<li><p>Intro</p>\n</li>\n<li><p>Background</p>\n</li>\n<li><p>Overall</p>\n</li>\n<li><p>Conclusion</p>\n</li>\n<li><p>References</p>\n</li>\n<li><p>Appendix</p>\n</li>\n</ol>\n";
    var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();

    // Act
    var result = Markdown.ToHtml(input, pipeline);

    // Assert
    Assert.AreEqual(expected, result);
}
  1. List with sub-sections:
    image
[Test, Description("Detailed list with sub-sections")]
public void TestListCreation2()
{
    // Arrange
    var input = "Test list:\n\nI. Intro\n A. Part 1\n B. Part 2\n C. Part3\n\nII. Background\n A. Part 1\n B. Part 2\n C. Part3\n\nIII. Overall\n A. Part 1\n B. Part 2\n C. Part3\n\nIV. Conclusion\n A. Part 1\n B. Part 2\n C. Part3\n\nV. References\n A. Part 1\n B. Part 2\n C. Part3\n\nVI. Appendix\n A. Part 1\n B. Part 2\n C. Part3";
    var expected = "<p>Test list:</p>\n<ol type=\"I\">\n<li>Intro</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"2\">\n<li>Background</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"3\">\n<li>Overall</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"4\">\n<li>Conclusion</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"5\">\n<li>References</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"6\">\n<li>Appendix</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>";
    var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();

    // Act
    var result = Markdown.ToHtml(input, pipeline);

    // Assert
    Assert.AreEqual(expected, result);
}
  1. List with no sub-items on item IV but sub-items on V
    image
[Test, Description("List with no sub-itmes on IV but sub-items on V")]
public void TestListCreation4()
{
    // Arrange
    var input = "Test list:\n\nI. Intro\n A. Part 1\n B. Part 2\n C. Part3\n\nII. Background\n A. Part 1\n B. Part 2\n C. Part3\n\nIII. Overall\n A. Part 1\n B. Part 2\n C. Part3\n\nIV. Conclusion\n\nV. References\n A. Part 1\n B. Part 2\n C. Part3\n\nVI. Appendix\n A. Part 1\n B. Part 2\n C. Part3";
    var expected = "<p>Test list:</p>\n<ol type=\"I\">\n<li>Intro</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"2\">\n<li>Background</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"3\">\n<li>Overall</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"4\">\n<li><p>Conclusion</p>\n</li>\n<li><p>References</p>\n</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"6\">\n<li>Appendix</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n";
    var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();

    // Act
    var result = Markdown.ToHtml(input, pipeline);

    // Assert
    Assert.AreEqual(expected, result);
}
  1. List with sub-items on IV but no sub-items on V
    image
[Test, Description("List with sub-itmes on IV but no sub-items on V")]
public void TestListCreation5()
{
    // Arrange
    var input = "Test list:\n\nI. Intro\n A. Part 1\n B. Part 2\n C. Part3\n\nII. Background\n A. Part 1\n B. Part 2\n C. Part3\n\nIII. Overall\n A. Part 1\n B. Part 2\n C. Part3\n\nIV. Conclusion\n A. Part 1\n B. Part 2\n C. Part3\n\nV. References\n\nVI. Appendix\n A. Part 1\n B. Part 2\n C. Part3";
    var expected = "<p>Test list:</p>\n<ol type=\"I\">\n<li>Intro</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"2\">\n<li>Background</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"3\">\n<li>Overall</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n<ol type=\"I\" start=\"4\">\n<li>Conclusion</li>\n</ol>\n<ol type=\"A\">\n<li><p>Part 1</p>\n</li>\n<li><p>Part 2</p>\n</li>\n<li><p>Part3</p>\n</li>\n</ol>\n<ol type=\"I\" start=\"5\">\n<li>References</li>\n</ol>\n<ol type=\"I\" start=\"6\">\n<li>Appendix</li>\n</ol>\n<ol type=\"A\">\n<li>Part 1</li>\n<li>Part 2</li>\n<li>Part3</li>\n</ol>\n";
    var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();

    // Act
    var result = Markdown.ToHtml(input, pipeline);

    // Assert
    Assert.AreEqual(expected, result);
}
@Matt-Scheetz
Copy link
Author

@xoofx could you point me in the right direction on where to look for an update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants