mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-13 05:50:27 +00:00
Strike-through tag
This commit is contained in:
parent
88bf3c3d3a
commit
8bc3fb9821
@ -41,7 +41,7 @@ func TestLex(t *testing.T) {
|
||||
</ul>`},
|
||||
{6, "<p id='6'>text</p>"},
|
||||
{7, "<p id='7'>more text</p>"},
|
||||
{8, `<p><a id='8' class='rocketlink wikilink_internal' href="/page/Pear">some link</a></p>`},
|
||||
{8, `<p><a id='8' class='rocketlink wikilink_internal' href="/page/pear">some link</a></p>`},
|
||||
{9, `<ul id='9'>
|
||||
<li>lin"+</li>
|
||||
</ul>`},
|
||||
|
@ -17,6 +17,7 @@ const (
|
||||
spanSuper
|
||||
spanSub
|
||||
spanMark
|
||||
spanStrike
|
||||
spanLink
|
||||
)
|
||||
|
||||
@ -78,7 +79,7 @@ func getTextNode(input *bytes.Buffer) string {
|
||||
escaping = false
|
||||
} else if b == '\\' {
|
||||
escaping = true
|
||||
} else if strings.IndexByte("/*`^,![", b) >= 0 {
|
||||
} else if strings.IndexByte("/*`^,![~", b) >= 0 {
|
||||
input.UnreadByte()
|
||||
break
|
||||
} else {
|
||||
@ -127,6 +128,9 @@ func ParagraphToHtml(hyphaName, input string) string {
|
||||
case startsWith("!!"):
|
||||
ret.WriteString(tagFromState(spanMark, tagState, "mark", "!!"))
|
||||
p.Next(2)
|
||||
case startsWith("~~"):
|
||||
ret.WriteString(tagFromState(spanMark, tagState, "s", "~~"))
|
||||
p.Next(2)
|
||||
case startsWith("[["):
|
||||
ret.WriteString(getLinkNode(p, hyphaName))
|
||||
default:
|
||||
@ -149,6 +153,8 @@ func ParagraphToHtml(hyphaName, input string) string {
|
||||
ret.WriteString(tagFromState(spanSub, tagState, "sub", ",,"))
|
||||
case spanMark:
|
||||
ret.WriteString(tagFromState(spanMark, tagState, "mark", "!!"))
|
||||
case spanStrike:
|
||||
ret.WriteString(tagFromState(spanMark, tagState, "s", "~~"))
|
||||
case spanLink:
|
||||
ret.WriteString(tagFromState(spanLink, tagState, "a", "[["))
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ func TestParagraphToHtml(t *testing.T) {
|
||||
{"Embedded //italic//", "Embedded <em>italic</em>"},
|
||||
{"double //italian// //text//", "double <em>italian</em> <em>text</em>"},
|
||||
{"it has `mono`", "it has <code>mono</code>"},
|
||||
{"it has ~~strike~~", "it has <s>strike</s>"},
|
||||
{"this is a left **bold", "this is a left <strong>bold</strong>"},
|
||||
{"this line has a ,comma, two of them", "this line has a ,comma, two of them"},
|
||||
{"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."},
|
||||
|
Loading…
Reference in New Issue
Block a user