grim/youtrack-import
Clone
Summary
Browse
Changes
Graph
Convert bold, italic, and bold italic to the markdown version
draft
2020-08-04, Gary Kramlich
cdadae07e61c
Convert bold, italic, and bold italic to the markdown version
package
youtrack
import
(
"sort"
"time"
)
type
Comment
struct
{
Author
string
Text
string
Created
time
.
Time
Updated
time
.
Time
Markdown
bool
}
func
sortComments
(
comments
[]
*
Comment
)
{
sort
.
Slice
(
comments
,
func
(
i
,
j
int
)
bool
{
return
comments
[
i
].
Created
.
Before
(
comments
[
j
].
Created
)
})
}
func
(
c
*
Comment
)
extractAttachments
(
i
*
Issue
)
error
{
if
!
c
.
Markdown
{
return
nil
}
modified
,
attachments
,
err
:=
extractAttachments
(
i
.
Number
,
c
.
Author
,
c
.
Text
,
c
.
Created
,
)
if
err
!=
nil
{
return
err
}
if
len
(
attachments
)
>
0
{
c
.
Text
=
modified
i
.
Attachments
=
append
(
i
.
Attachments
,
attachments
...
)
}
return
nil
}