grim/youtrack-import

Convert inline comments. Fixes YI-35
draft
2020-08-03, Gary Kramlich
a2fccfd52984
Parents 6e41a2be36b1
Children c827e434f2aa
Convert inline comments. Fixes YI-35
--- a/trac/tickets.go Mon Aug 03 21:25:44 2020 -0500
+++ b/trac/tickets.go Mon Aug 03 22:19:58 2020 -0500
@@ -105,6 +105,10 @@
// trac supports [[br]] for an explicit line break, we repalce it with a
// <br/> tag.
breakRegex = regexp.MustCompile(`(?i)\[\[br\]\]`)
+
+ // trac's inline code is done via "``" and "{{{}}}", since markdown already
+ // handles "``" we just need to convert "{{{}}}" to "``"
+ inlineCodeRegex = regexp.MustCompile(`{{{(.+?)}}}`)
)
func (tc *ticketChange) cleanNewValue() string {
@@ -115,7 +119,10 @@
}
if strings.Contains(newComment, "{{{") {
+ // inline code uses the same syntax so we need to do code blocks
+ // first.
newComment = commentCodeBlockRegex.ReplaceAllString(newComment, "$1```$2```$3")
+ newComment = inlineCodeRegex.ReplaceAllString(newComment, "`$1`")
}
// repalce all [[br]]'s with <br/>