jawkom / markdownsharp

Automatically exported from code.google.com/p/markdownsharp
0 stars 0 forks source link

_emptyElementSuffix null when passing empty MarkdownOptions #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call public Markdown(MarkdownOptions options)
2. Transform text that generates empty html element (eg. <br />)
3. Inspect invalid html

What is the expected output? What do you see instead?
Expect html with '<br />', seeing '<br'

Please provide any additional information below.

This unit-test demonstrated the problem:
        [Test]
        public void BreaklinesWithEmptyOptions()
        {
            string input = "Bla bla:  \r\nFoo";
            string expected = "Bla bla:<br />\nAppHarbor Inc.";
            var markdownSharp = new Markdown(
                new MarkdownOptions{}
            );
            string actual = markdownSharp.Transform(input);
            Assert.AreEqual(expected, actual);
        }

It's due to bad option handling. Supposedly, emptyelementsuffix id initialized 
to a sane default in this line:
private string _emptyElementSuffix = " />";

But that gets overriden with 'null' if one foolishly passes an options-object 
without setting 'EmptyElementSuffix'

Original issue reported on code.google.com by fri...@gmail.com on 27 Jan 2011 at 1:29

GoogleCodeExporter commented 9 years ago
Whoops, this is actually a dupe of Issue 38: 
http://code.google.com/p/markdownsharp/issues/detail?id=38

Original comment by fri...@gmail.com on 27 Jan 2011 at 4:33

GoogleCodeExporter commented 9 years ago

Original comment by wump...@gmail.com on 28 Feb 2011 at 5:03