Skip to content

Commit

Permalink
Markdown: Use correct tags for italic and bold text (exercism#294)
Browse files Browse the repository at this point in the history
* Fix exercism#286 - Linked List: change pop and shift to return option

* Linked List: Add missing Ignore attribute

* Markdown: Use correct tags for italic and bold text

* Revert "Fix exercism#286 - Linked List: change pop and shift to return option"

This reverts commit 9da0115.
  • Loading branch information
balazsbotond authored and ErikSchierboom committed Feb 5, 2017
1 parent 899a76a commit 7ed1023
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions exercises/markdown/Example.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ let boldMarkdown = "__"
let italicMarkdown = "_"
let listItemMarkdown = "*"

let boldTag = "em"
let italicTag = "i"
let boldTag = "strong"
let italicTag = "em"
let paragraphTag = "p"
let listTag = "ul"
let listItemTag = "li"
Expand Down
16 changes: 8 additions & 8 deletions exercises/markdown/Markdown.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ let rec parse (markdown: string) =

if __pos' > -1 then
if __pos + 2 >= (line.Length - 1) then
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 2 .. __pos' - 1] + "</em>"
line <- line.[0.. __pos - 1] + "<strong>" + line.[__pos + 2 .. __pos' - 1] + "</strong>"
__pos <- __pos' + 1
else
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 2 .. __pos' - 1] + "</em>" + line.[__pos' + 2 ..]
line <- line.[0.. __pos - 1] + "<strong>" + line.[__pos + 2 .. __pos' - 1] + "</strong>" + line.[__pos' + 2 ..]
__pos <- __pos' + 1
else
__pos <- -1
Expand All @@ -41,10 +41,10 @@ let rec parse (markdown: string) =

if __pos' > -1 then
if __pos + 1 >= (line.Length - 1) then
line <- line.[0.. __pos - 1] + "<i>" + line.[__pos + 1 .. __pos' - 1] + "</i>"
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 1 .. __pos' - 1] + "</em>"
__pos <- __pos' + 1
else
line <- line.[0.. __pos - 1] + "<i>" + line.[__pos + 1 .. __pos' - 1] + "</i>" + line.[__pos' + 1 ..]
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 1 .. __pos' - 1] + "</em>" + line.[__pos' + 1 ..]
__pos <- __pos' + 1
else
__pos <- -1
Expand Down Expand Up @@ -75,10 +75,10 @@ let rec parse (markdown: string) =

if __pos' > -1 then
if __pos + 2 >= (line.Length - 1) then
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 2 .. __pos' - 1] + "</em>"
line <- line.[0.. __pos - 1] + "<strong>" + line.[__pos + 2 .. __pos' - 1] + "</strong>"
__pos <- __pos' + 1
else
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 2 .. __pos' - 1] + "</em>" + line.[__pos' + 2 ..]
line <- line.[0.. __pos - 1] + "<strong>" + line.[__pos + 2 .. __pos' - 1] + "</strong>" + line.[__pos' + 2 ..]
__pos <- __pos' + 1
else
__pos <- -1
Expand All @@ -90,10 +90,10 @@ let rec parse (markdown: string) =

if __pos' > -1 then
if __pos + 1 >= (line.Length - 1) then
line <- line.[0.. __pos - 1] + "<i>" + line.[__pos + 1 .. __pos' - 1] + "</i>"
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 1 .. __pos' - 1] + "</em>"
__pos <- __pos' + 1
else
line <- line.[0.. __pos - 1] + "<i>" + line.[__pos + 1 .. __pos' - 1] + "</i>" + line.[__pos' + 1 ..]
line <- line.[0.. __pos - 1] + "<em>" + line.[__pos + 1 .. __pos' - 1] + "</em>" + line.[__pos' + 1 ..]
__pos <- __pos' + 1
else
__pos <- -1
Expand Down
8 changes: 4 additions & 4 deletions exercises/markdown/MarkdownTest.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ let ``Parses normal text as a paragraph`` () =
[<Test>]
let ``Parsing italics`` () =
let input = "_This will be italic_"
let expected = "<p><i>This will be italic</i></p>"
let expected = "<p><em>This will be italic</em></p>"
Assert.That(parse input, Is.EqualTo(expected))

[<Test>]
let ``Parsing bold text`` () =
let input = "__This will be bold__"
let expected = "<p><em>This will be bold</em></p>"
let expected = "<p><strong>This will be bold</strong></p>"
Assert.That(parse input, Is.EqualTo(expected))

[<Test>]
let ``Mixed normal, italics and bold text`` () =
let input = "This will _be_ __mixed__"
let expected = "<p>This will <i>be</i> <em>mixed</em></p>"
let expected = "<p>This will <em>be</em> <strong>mixed</strong></p>"
Assert.That(parse input, Is.EqualTo(expected))

[<Test>]
Expand Down Expand Up @@ -55,5 +55,5 @@ let ``Unordered lists`` () =
[<Test>]
let ``With a little bit of everything`` () =
let input = "# Header!\n* __Bold Item__\n* _Italic Item_"
let expected = "<h1>Header!</h1><ul><li><em>Bold Item</em></li><li><i>Italic Item</i></li></ul>"
let expected = "<h1>Header!</h1><ul><li><strong>Bold Item</strong></li><li><em>Italic Item</em></li></ul>"
Assert.That(parse input, Is.EqualTo(expected))

0 comments on commit 7ed1023

Please sign in to comment.