From f932b3c87a0d9f13f606a097d7ce7bee80fccc79 Mon Sep 17 00:00:00 2001 From: Franklin Tse Date: Thu, 3 Jan 2019 23:43:54 +0800 Subject: [PATCH 1/5] Use attribute name as value if value is null --- src/Markdig/Renderers/HtmlRenderer.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Markdig/Renderers/HtmlRenderer.cs b/src/Markdig/Renderers/HtmlRenderer.cs index 8373e93f9..7f4b32ac4 100644 --- a/src/Markdig/Renderers/HtmlRenderer.cs +++ b/src/Markdig/Renderers/HtmlRenderer.cs @@ -314,12 +314,9 @@ public HtmlRenderer WriteAttributes(HtmlAttributes attributes, Func Date: Thu, 3 Jan 2019 23:49:38 +0800 Subject: [PATCH 2/5] Update spec and test cases --- src/Markdig.Tests/Specs/MediaSpecs.md | 6 +++--- src/Markdig.Tests/Specs/Specs.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Markdig.Tests/Specs/MediaSpecs.md b/src/Markdig.Tests/Specs/MediaSpecs.md index e9bd49100..2a89bc30c 100644 --- a/src/Markdig.Tests/Specs/MediaSpecs.md +++ b/src/Markdig.Tests/Specs/MediaSpecs.md @@ -17,9 +17,9 @@ Allows to embed audio/video links to popular website: ![Video5](https://ok.ru/video/26870090463) . -

-

+

+

-

+

```````````````````````````````` \ No newline at end of file diff --git a/src/Markdig.Tests/Specs/Specs.cs b/src/Markdig.Tests/Specs/Specs.cs index 4d3234ce6..154b5c9ae 100644 --- a/src/Markdig.Tests/Specs/Specs.cs +++ b/src/Markdig.Tests/Specs/Specs.cs @@ -19769,14 +19769,14 @@ public void ExtensionsMedialinks_Example001() // ![Video5](https://ok.ru/video/26870090463) // // Should be rendered as: - //

- //

+ //

+ //

//

//

- //

+ //

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 1, "Extensions Media links"); - TestParser.TestSpec("![Video1](https://www.youtube.com/watch?v=mswPy5bt3TQ)\n\n![Video2](https://vimeo.com/8607834)\n\n![Video3](https://sample.com/video.mp4)\n\n![Audio4](https://music.yandex.ru/album/411845/track/4402274)\n\n![Video5](https://ok.ru/video/26870090463)", "

\n

\n

\n

\n

", "medialinks|advanced+medialinks"); + TestParser.TestSpec("![Video1](https://www.youtube.com/watch?v=mswPy5bt3TQ)\n\n![Video2](https://vimeo.com/8607834)\n\n![Video3](https://sample.com/video.mp4)\n\n![Audio4](https://music.yandex.ru/album/411845/track/4402274)\n\n![Video5](https://ok.ru/video/26870090463)", "

\n

\n

\n

\n

", "medialinks|advanced+medialinks"); } } // # Extensions From 0920001f45bb456dca73b5d059ccf4cd59a3951b Mon Sep 17 00:00:00 2001 From: Franklin Tse Date: Thu, 3 Jan 2019 23:51:04 +0800 Subject: [PATCH 3/5] Remove the unnecessary EOL at the end --- src/Markdig/Renderers/HtmlRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markdig/Renderers/HtmlRenderer.cs b/src/Markdig/Renderers/HtmlRenderer.cs index 7f4b32ac4..451f2b23a 100644 --- a/src/Markdig/Renderers/HtmlRenderer.cs +++ b/src/Markdig/Renderers/HtmlRenderer.cs @@ -361,4 +361,4 @@ public HtmlRenderer WriteLeafRawLines(LeafBlock leafBlock, bool writeEndOfLines, return this; } } -} +} \ No newline at end of file From 02bd8149ac1a0e47e166d9fdc0f668a4f176f4ac Mon Sep 17 00:00:00 2001 From: Franklin Tse Date: Fri, 4 Jan 2019 00:23:19 +0800 Subject: [PATCH 4/5] Use empty string instead of attribute name --- src/Markdig.Tests/Specs/MediaSpecs.md | 6 +++--- src/Markdig.Tests/Specs/Specs.cs | 14 +++++++------- src/Markdig/Renderers/HtmlRenderer.cs | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Markdig.Tests/Specs/MediaSpecs.md b/src/Markdig.Tests/Specs/MediaSpecs.md index 2a89bc30c..a96e9538d 100644 --- a/src/Markdig.Tests/Specs/MediaSpecs.md +++ b/src/Markdig.Tests/Specs/MediaSpecs.md @@ -17,9 +17,9 @@ Allows to embed audio/video links to popular website: ![Video5](https://ok.ru/video/26870090463) . -

-

+

+

-

+

```````````````````````````````` \ No newline at end of file diff --git a/src/Markdig.Tests/Specs/Specs.cs b/src/Markdig.Tests/Specs/Specs.cs index 154b5c9ae..63c16cc15 100644 --- a/src/Markdig.Tests/Specs/Specs.cs +++ b/src/Markdig.Tests/Specs/Specs.cs @@ -17643,10 +17643,10 @@ public void ExtensionsGenericAttributes_Example001() //

This is a heading

//

This is a link

//

This is a heading

- //

This is a paragraph with an attached attributes

+ //

This is a paragraph with an attached attributes

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 1, "Extensions Generic Attributes"); - TestParser.TestSpec("# This is a heading with an an attribute{#heading-link}\n\n# This is a heading # {#heading-link2}\n\n[This is a link](http://google.com){#a-link .myclass data-lang=fr data-value=\"This is a value\"}\n\nThis is a heading{#heading-link2}\n-----------------\n\nThis is a paragraph with an attached attributes {#myparagraph attached-bool-property attached-bool-property2}", "

This is a heading with an an attribute

\n

This is a heading

\n

This is a link

\n

This is a heading

\n

This is a paragraph with an attached attributes

", "attributes|advanced"); + TestParser.TestSpec("# This is a heading with an an attribute{#heading-link}\n\n# This is a heading # {#heading-link2}\n\n[This is a link](http://google.com){#a-link .myclass data-lang=fr data-value=\"This is a value\"}\n\nThis is a heading{#heading-link2}\n-----------------\n\nThis is a paragraph with an attached attributes {#myparagraph attached-bool-property attached-bool-property2}", "

This is a heading with an an attribute

\n

This is a heading

\n

This is a link

\n

This is a heading

\n

This is a paragraph with an attached attributes

", "attributes|advanced"); } } // The following shows that attributes can be attached to the next block if they are used inside a single line just preceding the block (and preceded by a blank line or beginning of a block container): @@ -19769,14 +19769,14 @@ public void ExtensionsMedialinks_Example001() // ![Video5](https://ok.ru/video/26870090463) // // Should be rendered as: - //

- //

- //

+ //

+ //

+ //

//

- //

+ //

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 1, "Extensions Media links"); - TestParser.TestSpec("![Video1](https://www.youtube.com/watch?v=mswPy5bt3TQ)\n\n![Video2](https://vimeo.com/8607834)\n\n![Video3](https://sample.com/video.mp4)\n\n![Audio4](https://music.yandex.ru/album/411845/track/4402274)\n\n![Video5](https://ok.ru/video/26870090463)", "

\n

\n

\n

\n

", "medialinks|advanced+medialinks"); + TestParser.TestSpec("![Video1](https://www.youtube.com/watch?v=mswPy5bt3TQ)\n\n![Video2](https://vimeo.com/8607834)\n\n![Video3](https://sample.com/video.mp4)\n\n![Audio4](https://music.yandex.ru/album/411845/track/4402274)\n\n![Video5](https://ok.ru/video/26870090463)", "

\n

\n

\n

\n

", "medialinks|advanced+medialinks"); } } // # Extensions diff --git a/src/Markdig/Renderers/HtmlRenderer.cs b/src/Markdig/Renderers/HtmlRenderer.cs index 451f2b23a..9e8a5412d 100644 --- a/src/Markdig/Renderers/HtmlRenderer.cs +++ b/src/Markdig/Renderers/HtmlRenderer.cs @@ -315,7 +315,7 @@ public HtmlRenderer WriteAttributes(HtmlAttributes attributes, Func Date: Fri, 4 Jan 2019 00:48:10 +0800 Subject: [PATCH 5/5] controls attribute is also changed --- src/Markdig.Tests/Specs/MediaSpecs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markdig.Tests/Specs/MediaSpecs.md b/src/Markdig.Tests/Specs/MediaSpecs.md index a96e9538d..7781a5a11 100644 --- a/src/Markdig.Tests/Specs/MediaSpecs.md +++ b/src/Markdig.Tests/Specs/MediaSpecs.md @@ -19,7 +19,7 @@ Allows to embed audio/video links to popular website: .

-

+

```````````````````````````````` \ No newline at end of file